Repository: langsasec/Sign-Sacker
Branch: main
Commit: 4926e029c7fc
Files: 5
Total size: 18.2 KB
Directory structure:
gitextract_psw5z5nh/
├── .gitignore
├── LICENSE
├── README.md
├── Sign-Sacker.py
└── requirements.txt
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 langsasec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=langsasec/Sign-Sacker&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=langsasec/Sign-Sacker&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=langsasec/Sign-Sacker&type=Date" />
</picture>
# Sign-Sacker (签名掠夺者) - 2.0
## 介绍
Sign-Sacker(签名掠夺者):一款数字签名复制器,可将其他官方exe中数字签名,图标,详细信息复制到没有签名的exe中,作为免杀,权限维持,伪装的一种小手段。
## 2024-1-4 项目停更
1. 微调了下代码,只允许了exe,dll文件
2. 项目停更,江湖再见
## 更新 2.0
分别导入含有签名和需要签名的文件,点击生成即可,玩免杀的可能会用到。
新增功能:
1. 掠夺高清图标,完美复刻。
2. 掠夺exe详细信息,以假乱真。

## 效果对比
### 图标对比:


### 数字签名对比:

### 详细信息对比
唯一的遗憾是语言暂未更改,文件版本号是由于飞书实际和显示有差别,大多数是一致的,因此我未做细微调整。

================================================
FILE: Sign-Sacker.py
================================================
import io
import struct
import subprocess
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QLineEdit, QPushButton, QFileDialog, QVBoxLayout, \
QWidget, QMessageBox, QCheckBox
import sys
import os
import shutil
from PyQt5.QtWidgets import QDesktopWidget
class SignSacker(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("Sign-Sacker(签名掠夺者) By 浪飒 (关注浪飒sec公众号)")
self.setWindowIcon(QIcon('favicon.ico')) # 设置窗口图标
self.resize(700, 400)
# 设置窗口居中显示
screen = QDesktopWidget().screenGeometry()
window_size = self.geometry()
x = int((screen.width() - window_size.width()) / 2)
y = int((screen.height() - window_size.height()) / 2)
self.move(x, y)
widget = QWidget(self)
layout = QVBoxLayout()
widget.setLayout(layout)
self.setCentralWidget(widget)
self.file1_label = QLabel("受害者:", self)
layout.addWidget(self.file1_label)
self.file1_entry = QLineEdit(self)
layout.addWidget(self.file1_entry)
self.choose_button1 = QPushButton("选择含有签名的文件", self)
layout.addWidget(self.choose_button1)
self.choose_button1.clicked.connect(self.choose_file1)
self.file2_label = QLabel("掠夺者:", self)
layout.addWidget(self.file2_label)
self.file2_entry = QLineEdit(self)
layout.addWidget(self.file2_entry)
self.choose_button2 = QPushButton("选择需要伪造签名的文件", self)
layout.addWidget(self.choose_button2)
self.choose_button2.clicked.connect(self.choose_file2)
self.output_label = QLabel("生成文件名:", self)
layout.addWidget(self.output_label)
self.output_entry = QLineEdit(self)
layout.addWidget(self.output_entry)
self.icon_checkbox = QCheckBox("掠夺受害者高清图标(默认保存在'文件名_ico'路径下)", self)
self.details_checkbox = QCheckBox("掠夺受害者所有详细信息(右键属性->详细信息。包括文件说明,文件版本等)", self)
layout.addWidget(self.icon_checkbox)
layout.addWidget(self.details_checkbox)
self.output_label= QLabel("------------------------------------------------------------------------------------", self)
layout.addWidget(self.output_label)
self.output_label = QLabel("温馨提示:", self)
layout.addWidget(self.output_label)
self.output_label= QLabel("1.掠夺后语言默认为英语(美国)。", self)
layout.addWidget(self.output_label)
self.output_label= QLabel("2.掠夺后图标若无变化请粘贴到新的文件夹刷新即可。", self)
layout.addWidget(self.output_label)
self.output_label= QLabel("3.建议对掠夺者进行备份再执行程序。", self)
layout.addWidget(self.output_label)
self.output_label= QLabel("------------------------------------------------------------------------------------", self)
layout.addWidget(self.output_label)
self.process_button = QPushButton("生成文件", self)
layout.addWidget(self.process_button)
self.process_button.clicked.connect(self.process_files)
self.setStyleSheet("""
QLabel {
font-size: 16px;
color: #333;
}
QLineEdit, QPushButton {
font-size: 14px;
height: 30px;
}
QPushButton {
background-color: #4CAF50;
border: none;
color: white;
padding: 6px 12px;
text-align: center;
text-decoration: none;
font-size: 14px;
margin: 4px;
border-radius: 4px;
}
QPushButton:hover {
background-color: #45a049;
}
""")
def choose_file1(self):
file_name, _ = QFileDialog.getOpenFileName(self, "选择文件1", "", "Executable Files (*.exe *.dll)")
if file_name:
self.file1_entry.setText(file_name)
def choose_file2(self):
file_name, _ = QFileDialog.getOpenFileName(self, "选择文件2", "", "Executable Files (*.exe *.dll)")
if file_name:
self.file2_entry.setText(file_name)
# 自动填充生成文件名的文本框
base_name = os.path.basename(file_name)
extension = os.path.splitext(base_name)[1]
if extension.lower() == ".dll":
output_file = os.path.splitext(base_name)[0] + "-Signed.dll"
else:
output_file = os.path.splitext(base_name)[0] + "-Signed.exe"
self.output_entry.setText(os.getcwd().replace('\\','/')+'/'+output_file)
def process_files(self):
file1_path = self.file1_entry.text()
file2_path = self.file2_entry.text()
output_file = self.output_entry.text()
# 验证文件的有效性
if not os.path.exists(file1_path) or not os.path.isfile(file1_path):
self.show_message_box("错误", "文件1无效!")
return
if not os.path.exists(file2_path) or not os.path.isfile(file2_path):
self.show_message_box("错误", "文件2无效!")
return
icon = self.icon_checkbox.isChecked()
version_info = self.details_checkbox.isChecked()
if version_info:
info_sacker(file1_path, file2_path)
if icon:
ico_sacker(file1_path,file2_path)
writeCert(copyCert(file1_path), file2_path, output_file)
message = f"签名已写入:{output_file}"
self.show_message_box("生成文件", message)
def show_message_box(self, title, message):
msg_box = QMessageBox()
msg_box.setWindowTitle(title)
msg_box.setText(message)
msg_box.exec_()
# 获取可执行文件的一些信息,包括PE头中的各个字段的数值。
def gather_file_info_win(binary):
"""
Borrowed from BDF...
I could just skip to certLOC... *shrug*
"""
flItms = {}
binary = open(binary, 'rb')
binary.seek(int('3C', 16))
flItms['buffer'] = 0
flItms['JMPtoCodeAddress'] = 0
flItms['dis_frm_pehdrs_sectble'] = 248
flItms['pe_header_location'] = struct.unpack('<i', binary.read(4))[0]
flItms['COFF_Start'] = flItms['pe_header_location'] + 4
binary.seek(flItms['COFF_Start'])
flItms['MachineType'] = struct.unpack('<H', binary.read(2))[0]
binary.seek(flItms['COFF_Start'] + 2, 0)
flItms['NumberOfSections'] = struct.unpack('<H', binary.read(2))[0]
flItms['TimeDateStamp'] = struct.unpack('<I', binary.read(4))[0]
binary.seek(flItms['COFF_Start'] + 16, 0)
flItms['SizeOfOptionalHeader'] = struct.unpack('<H', binary.read(2))[0]
flItms['Characteristics'] = struct.unpack('<H', binary.read(2))[0]
flItms['OptionalHeader_start'] = flItms['COFF_Start'] + 20
binary.seek(flItms['OptionalHeader_start'])
flItms['Magic'] = struct.unpack('<H', binary.read(2))[0]
flItms['MajorLinkerVersion'] = struct.unpack("!B", binary.read(1))[0]
flItms['MinorLinkerVersion'] = struct.unpack("!B", binary.read(1))[0]
flItms['SizeOfCode'] = struct.unpack("<I", binary.read(4))[0]
flItms['SizeOfInitializedData'] = struct.unpack("<I", binary.read(4))[0]
flItms['SizeOfUninitializedData'] = struct.unpack("<I",
binary.read(4))[0]
flItms['AddressOfEntryPoint'] = struct.unpack('<I', binary.read(4))[0]
flItms['PatchLocation'] = flItms['AddressOfEntryPoint']
flItms['BaseOfCode'] = struct.unpack('<I', binary.read(4))[0]
if flItms['Magic'] != 0x20B:
flItms['BaseOfData'] = struct.unpack('<I', binary.read(4))[0]
if flItms['Magic'] == 0x20B:
flItms['ImageBase'] = struct.unpack('<Q', binary.read(8))[0]
else:
flItms['ImageBase'] = struct.unpack('<I', binary.read(4))[0]
flItms['SectionAlignment'] = struct.unpack('<I', binary.read(4))[0]
flItms['FileAlignment'] = struct.unpack('<I', binary.read(4))[0]
flItms['MajorOperatingSystemVersion'] = struct.unpack('<H',
binary.read(2))[0]
flItms['MinorOperatingSystemVersion'] = struct.unpack('<H',
binary.read(2))[0]
flItms['MajorImageVersion'] = struct.unpack('<H', binary.read(2))[0]
flItms['MinorImageVersion'] = struct.unpack('<H', binary.read(2))[0]
flItms['MajorSubsystemVersion'] = struct.unpack('<H', binary.read(2))[0]
flItms['MinorSubsystemVersion'] = struct.unpack('<H', binary.read(2))[0]
flItms['Win32VersionValue'] = struct.unpack('<I', binary.read(4))[0]
flItms['SizeOfImageLoc'] = binary.tell()
flItms['SizeOfImage'] = struct.unpack('<I', binary.read(4))[0]
flItms['SizeOfHeaders'] = struct.unpack('<I', binary.read(4))[0]
flItms['CheckSum'] = struct.unpack('<I', binary.read(4))[0]
flItms['Subsystem'] = struct.unpack('<H', binary.read(2))[0]
flItms['DllCharacteristics'] = struct.unpack('<H', binary.read(2))[0]
if flItms['Magic'] == 0x20B:
flItms['SizeOfStackReserve'] = struct.unpack('<Q', binary.read(8))[0]
flItms['SizeOfStackCommit'] = struct.unpack('<Q', binary.read(8))[0]
flItms['SizeOfHeapReserve'] = struct.unpack('<Q', binary.read(8))[0]
flItms['SizeOfHeapCommit'] = struct.unpack('<Q', binary.read(8))[0]
else:
flItms['SizeOfStackReserve'] = struct.unpack('<I', binary.read(4))[0]
flItms['SizeOfStackCommit'] = struct.unpack('<I', binary.read(4))[0]
flItms['SizeOfHeapReserve'] = struct.unpack('<I', binary.read(4))[0]
flItms['SizeOfHeapCommit'] = struct.unpack('<I', binary.read(4))[0]
flItms['LoaderFlags'] = struct.unpack('<I', binary.read(4))[0] # zero
flItms['NumberofRvaAndSizes'] = struct.unpack('<I', binary.read(4))[0]
flItms['ExportTableRVA'] = struct.unpack('<I', binary.read(4))[0]
flItms['ExportTableSize'] = struct.unpack('<I', binary.read(4))[0]
flItms['ImportTableLOCInPEOptHdrs'] = binary.tell()
flItms['ImportTableRVA'] = struct.unpack('<I', binary.read(4))[0]
flItms['ImportTableSize'] = struct.unpack('<I', binary.read(4))[0]
flItms['ResourceTable'] = struct.unpack('<Q', binary.read(8))[0]
flItms['ExceptionTable'] = struct.unpack('<Q', binary.read(8))[0]
flItms['CertTableLOC'] = binary.tell()
flItms['CertLOC'] = struct.unpack("<I", binary.read(4))[0]
flItms['CertSize'] = struct.unpack("<I", binary.read(4))[0]
binary.close()
return flItms
# 用于从可执行文件中提取签名证书
def copyCert(exe):
flItms = gather_file_info_win(exe)
if flItms['CertLOC'] == 0 or flItms['CertSize'] == 0:
# 无证书则退出
sys.exit(-1)
with open(exe, 'rb') as f:
f.seek(flItms['CertLOC'], 0)
cert = f.read(flItms['CertSize'])
return cert
# 写入证书并输出
def writeCert(cert, exe, output):
flItms = gather_file_info_win(exe)
if not output:
output = str(exe) + "_signed"
shutil.copy2(exe, output)
with open(exe, 'rb') as g:
with open(output, 'wb') as f:
f.write(g.read())
f.seek(0)
f.seek(flItms['CertTableLOC'], 0)
f.write(struct.pack("<I", len(open(exe, 'rb').read())))
f.write(struct.pack("<I", len(cert)))
f.seek(0, io.SEEK_END)
f.write(cert)
# 图标掠夺
def ico_sacker(victim, sacker):
save_location = f"{victim}_ico"
os.system('ico_sacker.exe /save "'+victim+'" "'+save_location+'" -icons')
ico_path= save_location+'/'+os.listdir(save_location)[0]
os.system(f'info_sacker.exe {sacker} --set-icon {ico_path}')
def get_version_string(file_path, string_name):
import warnings
try:
warnings.filterwarnings("ignore")
cmd = f'info_sacker.exe {file_path} --get-version-string "{string_name}"'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
version_string = result.stdout.strip()
return version_string
except:
pass
def set_version_string(file_path, string_name, string_value):
try:
subprocess.check_call(f'info_sacker.exe {file_path} --set-version-string "{string_name}" "{string_value}"',
shell=True)
except:
pass
def info_sacker(victim, sacker):
version_strings = {
"FileDescription": "",
"FileVersion": "",
"ProductName": "",
"ProductVersion": "",
"CompanyName": "",
"LegalCopyright": "",
"InternalName": "",
"OriginalFilename": ""
}
# 获取版本信息
for string_name in version_strings:
version_strings[string_name] = get_version_string(victim, string_name)
# 设置版本信息
for string_name, string_value in version_strings.items():
if string_value is not None:
set_version_string(sacker, string_name, string_value)
os.system(f'info_sacker.exe {sacker} --set-file-version {version_strings["FileVersion"]}')
if __name__ == '__main__':
app = QApplication(sys.argv)
window = SignSacker()
window.show()
sys.exit(app.exec_())
================================================
FILE: requirements.txt
================================================
PyQt5==5.15.9
gitextract_psw5z5nh/ ├── .gitignore ├── LICENSE ├── README.md ├── Sign-Sacker.py └── requirements.txt
SYMBOL INDEX (13 symbols across 1 files)
FILE: Sign-Sacker.py
class SignSacker (line 15) | class SignSacker(QMainWindow):
method __init__ (line 16) | def __init__(self):
method choose_file1 (line 110) | def choose_file1(self):
method choose_file2 (line 115) | def choose_file2(self):
method process_files (line 128) | def process_files(self):
method show_message_box (line 150) | def show_message_box(self, title, message):
function gather_file_info_win (line 158) | def gather_file_info_win(binary):
function copyCert (line 246) | def copyCert(exe):
function writeCert (line 259) | def writeCert(cert, exe, output):
function ico_sacker (line 278) | def ico_sacker(victim, sacker):
function get_version_string (line 285) | def get_version_string(file_path, string_name):
function set_version_string (line 297) | def set_version_string(file_path, string_name, string_value):
function info_sacker (line 305) | def info_sacker(victim, sacker):
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (21K chars).
[
{
"path": ".gitignore",
"chars": 3078,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
},
{
"path": "LICENSE",
"chars": 1066,
"preview": "MIT License\n\nCopyright (c) 2023 langsasec\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n"
},
{
"path": "README.md",
"chars": 1297,
"preview": "\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=langsasec/Sign-"
},
{
"path": "Sign-Sacker.py",
"chars": 13219,
"preview": "import io\r\nimport struct\r\nimport subprocess\r\n\r\nfrom PyQt5.QtGui import QIcon\r\nfrom PyQt5.QtWidgets import QApplication, "
},
{
"path": "requirements.txt",
"chars": 15,
"preview": "PyQt5==5.15.9\r\n"
}
]
About this extraction
This page contains the full source code of the langsasec/Sign-Sacker GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (18.2 KB), approximately 5.2k tokens, and a symbol index with 13 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.