Jump to content

AVvXsEi0Nkj2pYfytR3MP4aH6QnUVqrvmlVHLp3F

用GO编写的Powershell脚本混淆的工具。该计划的主要目的是混淆PowerShell代码,以使其分析和检测更加困难。该脚本提供了5个层次的混淆,从基本混淆到脚本碎片。这使用户可以根据其特定需求来量身定制混淆级别。

./psobf -h

██████╗███████╗███████╗██████╗

██╔══████╔════╝██╔═══════███╔═════╝

██████╔╝███████╗██║██████╔╝███████╗██║

██╔═══╝██╔═══╝

██║██║

╚═╝╚═══════╝╚════╝

@taurusomar

v.1.0

USAGE:/obfuscator -i inputfile -o outputfile -level 1 | 2 | 2 | 3 | 4 | 5

Options:

- 我字符串

PowerShell脚本文件的名称。

-Level int

混淆水平(1至5)。 (默认1)

-o字符串

混淆脚本的输出文件的名称。 (默认'obfuscated.ps1')

混淆级别:

1:基本的混淆,将脚本分为单个字符。

2: base64脚本编码。

3:替代基本64用不同的powershell解码方法编码。

4:脚本的压缩和基本64编码将在运行时解码和解压缩。

5:脚本分解为多个部分,并在运行时重建。

功能:

混淆级别:四个级别的混淆,每个级别都比上一个更为复杂。通过将脚本分配到单个字符中,Level 1观察。 2级基本64编码脚本。使用不同的powershell解码方法编码的3级替代基本64。脚本的4级压缩和基本64编码将在运行时解码和解压缩。 5级将脚本分解为多个部分,并在运行时重建。压缩和编码:级别4包括脚本压缩,然后在Base64中编码它。添加了可变的obfuscation:一个函数以混淆powershell脚本中的变量名称。随机字符串Generation:随机字符串是为可变名称混淆而生成的。AVvXsEi0Nkj2pYfytR3MP4aH6QnUVqrvmlVHLp3F

安装

GO安装github.com/taurusomar/psobf@latest

混淆级别的示例

混淆级别分为5个选项。首先,您需要有一个要混淆的powershell文件。假设您有一个名为script.ps1的文件,带有以下内容:

写作主持人“你好,世界!”

级别1:基本混淆

以1级混淆运行脚本。

./obfuscator -i script.ps1 -o obfuscated_level1.ps1 -level 1这将生成一个名为obfuscated_level1.ps1的文件,并带有混淆的内容。结果将是您脚本的一个版本,其中每个字符都被逗号分隔并在Runtime.Runtime.Runtime.Runtime(1级)$ obfuscated=$([char [char]]('w` w` w` w` w`, ``,'',`h` h` h` Invoke-Expression $ obfustated

级别2:base64编码

使用2级obfuscation :运行脚本

./obfuscator -i script.ps1 -o obfuscated_level2.ps1 -level 2这将生成一个名为obfuscated_level2.ps1的文件,其中base64中的内容。执行此脚本时,它将被解码并在Runtime.Result.Result(2级)$ obfuscated=[System.Text.Coding] :UTF8.GETSTRING([SYSTEM.CONVERT] 3:FROMBASE64STRING('V3JPDGUTSG9ZDCAISGVSBG8SIFDVCMXKISI='');调用表达$混淆

级别3:替代基本64编码

用3级obfuscation执行脚本:

./obfuscator -i script.ps1 -o obfuscated_level3.ps1 -level 3此级别使用PowerShell中的base64编码和解码的形式略有不同,添加了额外的offuscation.result.result(level 3)$ e==[System.Convert] : frombase64String('V3JPDGUTSG9ZDCAISGVSBG8SIFDVCMXKISI='); $ obfuscated=[System.Text.Coding] :UTF8.GETSTRING($ e);调用表达$混淆

级别4:压缩和基本64编码

用4级obfuscation执行脚本:

./obfuscator -i script.ps1 -o obfuscated_level4.ps1 -level 4此级别在base64中编码它之前会压缩脚本,从而使分析更加复杂。结果将在Runtime.Result(4级)$ compressed='H4SiaAaaAAAAAC+NIZCNJVL8PJUQQALRMFGWAAAAAA='; $ bytes=[system.convert] : frombase64string($ compressed); $ stream=new-object io.memorystream(,$ bytes); $ deckSpressed=new-object io.compression.gzipstream($ stream,[io.compression.compressionmode] :decompress); $ reader=new-object io.streamreader($ deckompresed); $ obfuscated=$ reader.readtoend(); Invoke-Expression $ obfuscated

级别5:脚本片段

使用5级obfuscation :运行脚本

./obfuscator -i script.ps1 -o obfuscated_level5.ps1 -level 5此级别片段将脚本片段分为多个部分,并在runtime.rantime.result.result.result(级别5)$ fragments=@(

'写-',

'输出'',

'你好,',

'wo',

'rld!',

'''

);

$ script=$ fragments -join'';

Invoke-Expression $脚本此程序用于教育和研究目的。它不应用于恶意活动。

0 Comments

Recommended Comments

There are no comments to display.

Guest
Add a comment...