## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-TAURUSOMAR-PSOBF
# PowerShell Obfuscator
هدفه هو تحويل الكود لإعاقة التحليل والتوقيعات الثابتة، مفيد في المختبرات وفي مهام Red Team/Pentesting المصرح بها.
يدعم 6 مستويات من التعتيم بالإضافة إلى بنية التحويلات/الأنابيب التي تسمح بتراكم تقنيات مثل ترقيم السلاسل النصية، تشفير بسيط للثوابت الحرفية، إخفاء الأرقام، تشويه المعرفات، "الارتعاش" في التنسيق، تحسينات تجميلية لتدفق التحكم، إدخال كود ميت، ملفات تعريف التجزئة، وملفات تعريف حتمية.
⚠️ الاستخدام المسؤول: هذه الأداة مخصصة للبحث والاختبار المصرح به فقط. **لا** تستخدم لأغراض ضارة.```powershell
./psobf -h
root@kitploit:~
██████╗ ███████╗ ██████╗ ██████╗ ███████╗
██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝
██████╔╝███████╗██║ ██║██████╔╝█████╗
██╔═══╝ ╚════██║██║ ██║██╔══██╗██╔══╝
██║ ███████║╚██████╔╝██████╔╝██║
╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝
Omar Salazar
v.2.0.0
Usage: psobf -i -o -level <1|2|3|4|5|6> [options]
Obfuscation Levels: 1 - Char join encoding 2 - Base64 encoding 3 - Base64 encoding (alternate) 4 - GZip + Base64 compression 5 - Script fragmentation 6 - AES-256 CTR encryption (NEW in 2.0.0)
Transform Pipeline Options (use with -pipeline): iden - Identifier morphing (use with -iden obf) strenc - String encryption (use with -strenc xor|rc4) stringdict - String tokenization (use with -stringdict N) numenc - Number encoding fmt - Format jitter (use with -fmt jitter) cf - Control flow obfuscation (use with -cf-opaque, -cf-shuffle) dead - Dead code injection (use with -deadcode N) hexenc - Hex string encoding (NEW) alias - Cmdlet alias substitution (NEW) unicode - Unicode character encoding (NEW) antidebug - Anti-debugging/VM detection (NEW) iexobf - Invoke-Expression obfuscation (NEW)
Examples:
# Simple obfuscation
psobf -i script.ps1 -o out.ps1 -level 2
# AES encryption with heavy profile
psobf -i script.ps1 -o out.ps1 -level 6 -profile heavy
# All new transforms
psobf -i script.ps1 -o out.ps1 -level 4 -pipeline "iden,alias,hexenc,antidebug,iexobf" -iden obf
# RC4 string encryption
psobf -i script.ps1 -o out.ps1 -level 4 -pipeline "strenc" -strenc rc4 -strkey 0011223344556677
root@kitploit:~
## الميزات
<h1 align="center">
<img src="https://assets.kitploit.com/production/public/readmes/6598/11956ab9f65e8dc1b0460652042c601f70d28bb67e9fd6f0a89813ed5369997f.gif" alt="psobf" width="700px"></a>
<br>
</h1>
<h1 align="center">
<img src="https://raw.githubusercontent.com/taurusomar/psobf/HEAD/static/poc2.gif" alt="psobf" width="700px"></a>
<br>
</h1>
---
## التثبيت```bash
go install github.com/TaurusOmar/psobf/v2/cmd/some-email@example.com
* * *
## البدء السريع```bash
psobf -i input.ps1 -o out.ps1 -level 1..6 [options] psobf -h # full help
root@kitploit:~
## الميزات
<h1 align="center">
<img src="https://assets.kitploit.com/production/public/readmes/6598/11956ab9f65e8dc1b0460652042c601f70d28bb67e9fd6f0a89813ed5369997f.gif" alt="psobf" width="700px"></a>
<br>
</h1>
<h1 align="center">
<img src="https://raw.githubusercontent.com/taurusomar/psobf/HEAD/static/poc2.gif" alt="psobf" width="700px"></a>
<br>
</h1>
---
## التثبيت```bash
go install github.com/TaurusOmar/psobf/cmd/some-email@example.com
## بداية سريعة```bash
psobf -i input.ps1 -o out.ps1 -level 1..6 [options] psobf -h # full help
root@kitploit:~
---
## مرجع كامل للأعلام
| Flag | Type / Values | Default | Description | Example | | |
| ------------- | ----------------- | ---------------: | ------------------------------------------- | ------------------------------------------------------------ | ------------------------------- | ---------------------- |
| `-i` | string | — | إدخال PS1 (استخدم `-stdin` للقراءة من الأنبوب) | `-i script.ps1` | | |
| `-o` | string | `obfuscated.ps1` | إخراج (استخدم `-stdout` للكتابة إلى STDOUT) | `-o out.ps1` | | |
| `-level` | 1..6 | 1 | الحزمة النهائية (انظر المستويات) | `-level 4` | | |
| `-noexec` | bool | false | إصدار الحمولة فقط (بدون `Invoke-Expression`) | `-noexec` | | |
| `-stdin` | bool | false | قراءة PS من STDIN | `-stdin` | | |
| `-stdout` | bool | false | كتابة النتيجة إلى STDOUT | `-stdout` | | |
| `-seed` | int64 | random | عشوائية قابلة للتكرار | `-seed 42` | | |
| `-q` | bool | false | هادئ (بدون شعار) | `-q` | | |
| `-pipeline` | csv | — | التحويلات المطلوب تطبيقها بالترتيب | `-pipeline "iden,strenc,stringdict,numenc,fmt,cf,dead,frag"` | | |
| `-iden` | `keep`/`obf` | `keep` | تحوير المعرفات (المتغيرات والدوال) | `-iden obf` | | |
| `-strenc` | `off`/`xor`/`rc4` | `off` | تشفير النصوص الحرفية | `-strenc rc4` | | |
| `-strkey` | hex | — | مفتاح لـ `-strenc` | `-strkey 0011223344556677` | | |
| `-stringdict` | 0..100 | 0 | رمزية السلاسل الطويلة؛ نسبة مئوية لكل حرفية | `-stringdict 40` | | |
| `-numenc` | bool | false | ترميز الأعداد كتعبيرات PS حسابية | `-numenc` | | |
| `-fmt` | `off`/`jitter` | `off` | عشوائية المسافات البيضاء/فواصل الأسطر | `-fmt jitter` | | |
| `-cf-opaque` | bool | false | تغليف في `if(1 -eq 1){...}` | `-cf-opaque` | | |
| `-cf-shuffle` | bool | false | إعادة ترتيب **كتل الدوال** | `-cf-shuffle` | | |
| `-deadcode` | 0..100 | 0 | احتمالية إدخال كود ميت | `-deadcode 20` | | |
| `-frag` | \`profile=tight | medium | loose\` | — | ملف تعريف التجزئة (المستوى 5) | `-frag profile=medium` |
| `-minfrag` | int | 10 | الحد الأدنى لحجم الشظية (المستوى 5) | `-minfrag 8` | | |
| `-maxfrag` | int | 20 | الحد الأقصى لحجم الشظية (المستوى 5) | `-maxfrag 16` | | |
| `-profile` | \`light | balanced | heavy\` | — | إعدادات مسبقة للـ pipeline/seed/إلخ. | `-profile heavy` |
| `-fuzz` | int | 0 | إنتاج N متغير (بذور مختلفة) | `-fuzz 5` | | |
| `-poly` | int | 0 | متغيرات متعددة الأشكال لكل تحويل | `-poly 3` | | |
> يتم تشغيل **pipeline** **قبل** التعبئة النهائية **`-level`**.
---
## نموذج نص إدخال (آمن)
للحفاظ على الأمثلة غير ضارة، سنستخدم:```powershell
Write-Host "Hello, World!"
$answer = 42
function Greet($name) { Write-Host ("Hi, " + $name) }
Greet "Ada"
* * *
## مستويات التعتيم (1–6) + مقتطفات المخرجات
> ما يلي يوضح **شكل** المخرجات (مقتطفات). ستختلف الحمولات الفعلية.
### المستوى 1 — ربط الأحرف```bash
psobf -i sample.ps1 -o out.ps1 -level 1
root@kitploit:~
**الإخراج (مقتطف):**```powershell
$obfuscated = $([char[]](87,114,105,116,101,45,72,111,115,116,32,34,72,101,108,108,111,44,32,87,111,114,108,100,33,34,10,36,97,110,115,119,101,114,32,61,32,52,50,10,102,117,110,99,116,105,111,110,32,71,114,101,101,116,40,36,110,97,109,101,41,32,123,32,87,114,105,116,101,45,72,111,115,116,32,40,34,72,105,44,32,34,32,43,32,36,110,97,109,101,41,32,125,10,71,114,101,101,116,32,34,65,100,97,34,10) -join ''); Invoke-Expression $obfuscated
### المستوى 2 — Base64```bash
psobf -i sample.ps1 -o out.ps1 -level 2
root@kitploit:~
**المخرجات (مقتطف):**```powershell
$obfuscated = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('V3JpdGUtSG9zdCAiSGVsbG8sIFdvcmxkISIKJGFuc3dlciA9IDQyCmZ1bmN0aW9uIEdyZWV0KCRuYW1lKSB7IFdyaXRlLUhvc3QgKCJIaSwgIiArICRuYW1lKSB9CkdyZWV0ICJBZGEiCg==')); Invoke-Expression $obfuscated
### المستوى 3 — Base64 (alt)```bash
psobf -i sample.ps1 -o out.ps1 -level 3
root@kitploit:~
**المخرجات (مقتطف):**```powershell
$e = [Convert]::FromBase64String('V3JpdGUtSG9zdCAiSGVsbG8sIFdvcmxkISIKJGFuc3dlciA9IDQyCmZ1bmN0aW9uIEdyZWV0KCRuYW1lKSB7IFdyaXRlLUhvc3QgKCJIaSwgIiArICRuYW1lKSB9CkdyZWV0ICJBZGEiCg=='); $obfuscated = [Text.Encoding]::UTF8.GetString($e); Invoke-Expression $obfuscated
### المستوى 4 — GZip + Base64```bash
psobf -i sample.ps1 -o out.ps1 -level 4
root@kitploit:~
**المخرجات (مقتطف):**```powershell
$compressed = 'H4sIAAAAAAAA/wovyixJ1fXILy5RUPJIzcnJ11EIzy/KSVFU4lJJzCsuTy1SsFUwMeJKK81LLsnMz1NwL0pNLdFQyUvMTdVUqFZA0q+h5JGpo6CkoK0Ala3lAitWUHJMSVTiAgQAAP//m+Ey2GoAAAA='; $bytes = [Convert]::FromBase64String($compressed); $ms = New-Object IO.MemoryStream(,$bytes); $gz = New-Object IO.Compression.GzipStream($ms,[IO.Compression.CompressionMode]::Decompress); $sr = New-Object IO.StreamReader($gz); $obfuscated = $sr.ReadToEnd(); Invoke-Expression $obfuscated
### المستوى 5 — التجزئة```bash
psobf -i sample.ps1 -o out.ps1 -level 5
root@kitploit:~
**المخرجات (مقتطف):**```powershell
$fragments = @('Write-Host "Hello',', World!"
$','answer = 42','
function G','reet($name)',' { Write-Ho','st ("Hi, " ','+ $name) }
','Greet "Ada"','
'); $script = $fragments -join ''; Invoke-Expression $script
### المستوى 6 — تشفير AES```bash
psobf -i sample.ps1 -o out.ps1 -level 6
root@kitploit:~
**مخرجات (مقتطف):**```powershell
$k=[Convert]::FromBase64String('...base64key...');$iv=[Convert]::FromBase64String('...base64iv...');$e=[Convert]::FromBase64String('...base64ciphertext...');$a=New-Object Security.Cryptography.AesManaged;$a.Key=$k;$a.IV=$iv;$d=$a.CreateDecryptor();$bytes=$d.TransformFinalBlock($e,0,$e.Length);$dec=[Text.Encoding]::UTF8.GetString($bytes);Invoke-Expression $dec
* * *
## التحويلات (خط الأنابيب) — التفاصيل والأمثلة
> استخدم `-noexec` لفحص الحمولات دون تنفيذ.
### المُعرِّف (`-iden`)
* يعيد تسمية المتغيرات و**الدوال** مع الحفاظ على الدلالات.
* احم أي شيء لا تريد إعادة تسميته باستخدام البادئة `__$`.
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "iden" -iden obf -seed 11
root@kitploit:~
**المخرجات (مقتطف)**```powershell
$WguE = 42
function QhZy($Chx){ Write-Host ("Hi, " + $Chx) }
QhZy "Ada"
* * *
### تشفير السلاسل النصية (`-strenc xor|rc4`)
يقوم بتشفير **النصوص الحرفية فقط** (لا تغيير في واجهة برمجة التطبيقات). يتم فك التشفير في الوقت الفعلي أثناء التشغيل. العلامات: -strenc xor|rc4, -strkey .
#### XOR
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "strenc" -strenc xor -strkey a1b2c3d4 -seed 42
root@kitploit:~
**المخرجات (مقتطف)**```powershell
$b=[Convert]::FromBase64String('EwAB...'); for($i=0;$i -lt $b.Length;$i++){$b[$i]=$b[$i] -bxor 0xA1}; [Text.Encoding]::UTF8.GetString($b)
#### RC4
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "strenc" -strenc rc4 -strkey 0011223344556677 -seed 7
root@kitploit:~
**المخرجات (مقتطف)**```powershell
function __decGWREVT($k,[byte[]]$d){ $s=0..255; $j=0; for($i=0;$i -lt 256;$i++){ $j=($j+$s[$i]+$k[$i%$k.Length])%256; $t=$s[$i];$s[$i]=$s[$j];$s[$j]=$t } $i=0;$j=0; for($x=0;$x -lt $d.Length;$x++){ $i=($i+1)%256;$j=($j+$s[$i])%256; $t=$s[$i];$s[$i]=$s[$j];$s[$j]=$t; $d[$x]=$d[$x] -bxor $s[($s[$i]+$s[$j])%256] } [Text.Encoding]::UTF8.GetString($d) }
...
( __decGWREVT ([byte[]](0..(8-1)|%{[Convert]::ToByte('0011223344556677'.Substring($_*2,2),16)})) ([Convert]::FromBase64String('m7m7...')) )
* * *
### قاموس السلسلة (`-stringdict`)
يُقسم السلاسل الطويلة إلى مصفوفة `$D` ويعيد بنائها في وقت التشغيل. يقلل من التواقيع المتكررة. العلم: -stringdict <0..100>
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 3 -pipeline "stringdict" -stringdict 40 -seed 1
root@kitploit:~
**المخرجات (مقتطف)**```powershell
$D=@('Hello',', World','!','Hi, ', 'Ada');
Write-Host ($D[0]+$D[1]+$D[2])
function Greet($name){ Write-Host ($D[3] + $name) }
Greet $D[4]
* * *
### Number Encoding (`-numenc`)
يستبدل الأرقام العادية بتعبيرات حسابية/بتية مكافئة (خارج السلاسل النصية).
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "numenc" -numenc -seed 1337
root@kitploit:~
**المخرجات (مقتطف)**```powershell
$answer = ((0x2A -bxor 0x00)+0)
تحذير: يجب أن تبقى عمليات إعادة التوجيه مثل `2>&1` متطابقة تمامًا. إذا كان مصدرك يحتوي على عمليات إعادة توجيه غير مقتبسة وتواجه مشكلات، فقم بتعطيل `-numenc` أو قم بتضمين تلك العمليات في سلاسل نصية داخل المصدر.
* * *
### تشويش التنسيق (`-fmt`)
يُحدث تباينًا عشوائيًا في المسافات والأسطر الجديدة.
**الأمر** ```bash psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "fmt" -fmt jitter -seed 20
root@kitploit:~
**المخرجات (مقتطف)**```powershell
Write-Host "Hello, World!"
$answer=42
function Greet($name) { Write-Host ("Hi, "+$name) }
Greet "Ada"
* * *
### التحكم في التدفق (`-cf-opaque`, `-cf-shuffle`)
* `-cf-opaque`: يقوم بتغليف النص البرمجي بأكمله في فرع لا يكون أبدًا خاطئًا.
* `-cf-shuffle`: يعيد ترتيب **كتل الدوال** (وليس العبارات الفردية). ستلاحظ التغييرات فقط إذا كان نصك البرمجي يعرّف دوال.
**الأمر**
root@kitploit:~
if __name__ == "__main__":
# Example: obfuscate a script
pyobfuscator -i input.py -o output.py -cf-opaque -cf-shuffle
``````bash
psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "cf" -cf-opaque -cf-shuffle -seed 77
**المخرجات (مقتطف)** ```powershell if(1 -eq 1){ function Greet($name){ Write-Host ("Hi, " + $name) } Write-Host "Hello, World!" $answer = 42 Greet "Ada" }
root@kitploit:~
### الشفرة الميتة (`-deadcode`)
يقوم بحقن دوال لا تفعل شيئًا، حلقات بعدد تكرارات صفرية، سلاسل غير ضارة، إلخ. يتم التحكم فيها بواسطة الاحتمالية.
العلم: `-deadcode <0..100>` (احتمالية حقن المقتطف).
**الأمر**```bash
psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "dead" -deadcode 25 -seed 5
**المخرجات (مقتطف)** ```powershell function __dummyzQJxJk { return } for($i=0;$i -lt 0;$i++){Start-Sleep -Milliseconds 0} $x='canary';$y=$x+$x|Out-Null Write-Host "Hello, World!" ...
root@kitploit:~
### التجزئة (`-frag`, `-minfrag`, `-maxfrag`)
يؤثر فقط على **المستوى 5** (تجزئة السلسلة + الانضمام أثناء التشغيل).
* **الملفات الشخصية**:
* `profile=tight` → أجزاء صغيرة (≈6–10)
* `profile=medium` → أجزاء متوسطة (≈10–18)
* `profile=loose` → أجزاء أكبر (≈14–28)
* **أو** ضبط باستخدام `-minfrag` / `-maxfrag`.
**الأوامر**```bash
# Profile based
psobf -i sample.ps1 -o out.ps1 -level 5 -frag profile=loose -seed 9
# Fine control
psobf -i sample.ps1 -o out.ps1 -level 5 -minfrag 8 -maxfrag 16 -seed 9
**مخرجات (مقتطف)** ```powershell $fragments=@('Write-Host "Hello,',' World!"',"`n", '$answer = 42',"`n",'function Greet($','name){ Write-Host ("Hi, "+$name)}',"`n",'Greet "Ada"'); $script=$fragments -join ''; Invoke-Expression $script
root@kitploit:~
---
### تحويلات جديدة (v2.0+)
#### ترميز سداسي عشري (`hexenc`)
يقوم بترميز النصوص الحرفية إلى سداسي عشري.```bash
psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "hexenc" -seed 42
**الإخراج (مقتطف):** ```powershell [Text.Encoding]:https://raw.githubusercontent.com/taurusomar/psobf/main/:UTF8.GetString(%5BConvert%5D::FromHexString(%2748656C6C6F%27))
root@kitploit:~
#### استبدال الأسماء المستعارة (`alias`)
يستبدل أوامر PowerShell الداخلية بأسمائها المستعارة القصيرة.```bash
psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "alias" -seed 42
**الإخراج (مقتطف):** ```powershell
# Write-Host → echo/write/outright
# Get-ChildItem → dir/ls/gci
# ForEach-Object → foreach/%
root@kitploit:~
#### ترميز Unicode (`unicode`)
تحول أحرف السلسلة إلى تنسيق `[char]0xNNNN`.```bash
psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "unicode" -seed 42
**المخرجات (مقتطف):** ```powershell "H[char]0x0065[char]0x006C[char]0x006Co"
root@kitploit:~
#### مكافحة التصحيح (`antidebug`)
يحقن مقتطفات كشف البيئة المعزولة/الجهاز الافتراضي/المصحح.```bash
psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "antidebug" -seed 42
**المخرجات (مقتطف):** ```powershell if($env:COMPUTERNAME -match '^(SANDBOX|MALWARE|VIRUS)'){ exit } if((Get-WmiObject Win32_ComputerSystem).Model -match '^(VirtualBox|VMware)'){ exit }
# ... original script ...
root@kitploit:~
#### إخفاء IEX (`iexobf`)
يستبدل `Invoke-Expression` بأشكال بديلة.```bash
psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "iexobf" -seed 42
**الإخراج (مقتطف):** ```powershell
# Invoke-Expression → IEX or .
. $code # instead of Invoke-Expression $code
root@kitploit:~
---
## Profiles (light, balanced, heavy)
الإعدادات المسبقة هي نقاط بداية ملائمة. أي علامة صريحة تمررها **تتجاوز** الإعداد المسبق. أي علامة تمررها بشكل صريح تأخذ الأولوية على الملف الشخصي.
* **light** ```
-pipeline "iden,stringdict,numenc,frag"
-frag profile=tight
-seed 1337
* **متوازن** ``` -pipeline "iden,strenc,stringdict,numenc,fmt,cf,dead,frag" -strenc xor -strkey a1b2c3d4 -stringdict 30 -deadcode 10 -fmt jitter -frag profile=medium -seed 424242
root@kitploit:~
* **ثقيل** ``` -pipeline "iden,strenc,stringdict,numenc,fmt,cf,dead,frag" -strenc rc4 -strkey 00112233445566778899aabbccddeeff -stringdict 50 -deadcode 25 -fmt jitter -frag profile=loose -seed 987654321
root@kitploit:~
* * *
## البذور، قابلية التكرار، والاختبار العشوائي
* `-seed N` → مخرجات حتمية لتكوين معين.
* بدون `-seed` → عشوائية معتمدة على بذور تشفيرية.
* `-fuzz N` → إنتاج **N** من المتغيرات (`out.ps1.v1.ps1`، `out.ps1.v2.ps1`، …)، ممتاز لاختبار التنوع.
**مثال** ```bash psobf -i sample.ps1 -o out.ps1 -level 4 -profile heavy -fuzz 3
root@kitploit:~
## STDIN/STDOUT و `-noexec`
* **Pipe in / out** ```bash
cat sample.ps1 | psobf -stdin -stdout -level 2 > out.ps1
* **التدقيق فقط (لا يوجد غلاف تنفيذ)** ```bash psobf -i sample.ps1 -o payload.txt -level 4 -noexec
# payload.txt contains just the artifact (e.g., base64/gzip) without Invoke-Expression
root@kitploit:~
* * *
## وصفات EDR/AV (الممارسة الهجومية)
> الهدف هو **تنويع** القطع الأثرية وتقليل التوقيعات المستقرة من أجل **البحث** في البيئات المصرح بها.
1. **التعبئة الكثيفة + التشفير الحرفي** ```bash psobf -i sample.ps1 -o out.ps1 -level 4
-pipeline "iden,strenc,stringdict" -iden obf -strenc rc4 -strkey 0011223344556677 -stringdict 40
-seed 20250827
root@kitploit:~
2. **التنوع الأقصى (التنسيق + التجزئة + الكود الميت)**```bash
psobf -i sample.ps1 -o out.ps1 -level 5 \
-pipeline "fmt,frag,dead" -fmt jitter -frag profile=loose -deadcode 15 \
-fuzz 5
3. **بناء متوازن متوافق مع CI** ```bash psobf -i sample.ps1 -o out.ps1 -level 3 -profile balanced -seed 777
root@kitploit:~
4. **تقليل IOCs الثابتة (أرقام + قاموس)**```bash
psobf -i sample.ps1 -o out.ps1 -level 2 -pipeline "numenc,stringdict" -numenc -stringdict 35 -seed 9
5. **RC4 + التجزئة الضيقة (عرض الطبقات المدمجة)** ```bash psobf -i sample.ps1 -o out.ps1 -level 5 -pipeline "strenc,frag" -strenc rc4 -strkey 0011223344556677 -frag profile=tight -seed 44
root@kitploit:~
---
## أفضل الممارسات والملاحظات الدفاعية
* قم بتدوير **`-strkey`** و **`-seed`** لكل بناء.
* يُفضل دمج الطبقات: `-strenc` + `-stringdict` + `-fmt jitter` + التجزئة.
* استخدم `-fuzz` لتوليد عائلات من المتغيرات لاختبار الكشف.
* احتفظ بخط أساس نظيف وحميد وتحقق من التكافؤ الوظيفي داخل بيئة الحماية قبل وبعد التحويلات.
* إذا كان السكريبت الخاص بك يعتمد على بناء جملة PS الحساس (مثل إعادة التوجيه)، فاحتفظ بها داخل علامات الاقتباس أو قم بتعطيل `-numenc`.
---
## مخطط البنية```
┌──────────────┐
│ input.ps1 │
└──────┬───────┘
│ read (-i / -stdin)
▼
┌──────────────┐
│ Pipeline │ order you choose
│ iden │ rename vars/funcs
│ strenc │ XOR/RC4 literals
│ stringdict │ tokenize + rejoin
│ numenc │ numeric masking
│ fmt │ whitespace jitter
│ cf │ opaque/shuffle
│ dead │ harmless noise
└──────┬───────┘
│ mutated script
▼
┌──────────────┐
│ Level 1..5 │ final packing
└──────┬───────┘
│ + Invoke-Expression (unless -noexec)
▼
┌──────────────┐
│ out.ps1 │
└──────────────┘
* * *
### ملخص سريع```bash
# Deterministic, simple
psobf -i sample.ps1 -o out.ps1 -level 2 -seed 123
# RC4 (correct invocation shape)
psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "strenc" -strenc rc4 -strkey 0011223344556677
# Tokenization + numeric masking
psobf -i sample.ps1 -o out.ps1 -level 3 -pipeline "stringdict,numenc" -stringdict 40 -numenc
# Heavy combo
psobf -i sample.ps1 -o out.ps1 -level 5
-pipeline "iden,strenc,stringdict,numenc,fmt,cf,dead,frag"
-iden obf -strenc xor -strkey a1b2c3d4 -stringdict 35 -numenc
-fmt jitter -cf-opaque -deadcode 15 -frag profile=medium -seed 777
# Level 6 - AES encryption (maximum protection)
psobf -i sample.ps1 -o out.ps1 -level 6 -profile heavy -seed 999
# New transforms - anti-debug + alias + hex
psobf -i sample.ps1 -o out.ps1 -level 4 -pipeline "antidebug,alias,hexenc" -seed 42
# All new transforms combined
psobf -i sample.ps1 -o out.ps1 -level 6
-pipeline "iden,alias,hexenc,unicode,antidebug,iexobf,strenc"
-iden obf -strenc rc4 -strkey 0011223344556677 -seed 42
# Inspect artifact only (no Invoke-Expression)
psobf -i sample.ps1 -o payload.txt -level 4 -noexec
root@kitploit:~
---
## قانوني
هذا المشروع مخصص **للأغراض التعليمية** و**الاختبارات المأذون بها** فقط. أنت المسؤول الوحيد عن استخدامك. لا يتحمل المؤلفون والمساهمون أي مسؤولية عن الأضرار المباشرة أو غير المباشرة.