elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [RUBY] [WINDOWS] Pastebin Uploader
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [RUBY] [WINDOWS] Pastebin Uploader  (Leído 2,248 veces)
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.818



Ver Perfil
[RUBY] [WINDOWS] Pastebin Uploader
« en: 10 Diciembre 2012, 21:02 pm »



  ____        _  _
 (  _ \      / )( \
  ) __/      ) \/ (
 (__)astebin \____/ploader







Pastebin ha modificado la API así que el uploader de Doddy ya no funciona,
el programa "Click.to" es una muy buena alternativa si se quiere subir anónimamente a Pastebin, pero es muy limitad, así que he codeado esta versión en Ruby, para Windows.

PD: El formato del archivo se auto-reconoce (Ej. DOS), aunque aún faltan muchos formatos por añadir.


- Puedes configurar tu cuenta de Pastebin:



- Puedes subir varios archivos a la vez:



- Permite el uso del asterísco:



- Recomiendo encarecidamente usar una cuenta registrada en el script, porque el límite de uploads para "invitados" es de 10 archivos (mientras que para registrados son 25, y para premium 250):



Citar

 [Modo de empleo]
 
  PU (Opciones opcionales) (Archivo)
 
 [Opciones]
 
  -r  --raw
      Postea el código sin formato.
 
  -p  --private
      Marca el archivo como privado (Solo para usuarios registrados).

  -c  --config
      Establece los datos de acceso a una cuenta de Pastebin.

  /?   Muestra esta ayuda.


 [Ejemplos]
  
  • PU Archivo.txt
     Devuelve el enlace directo del archivo.
 
  
  • PU "C:\Archivo1.txt" "C:\Archivo2.bat" "C:\Archivo3.xml"
     Devuelve el enlace directo de varios archivos.
 
  
  • PU --raw Archivo.vbs
     Postea el código sin formato, y devuelve el enlace directo del archivo.

  
  • PU --private "C:\Archivo.txt"
     Marca el archivo como privado, y devuelve el enlace directo del archivo.

  
  • PU --config
     Muestra el menú de configuración de cuenta de acceso.






PU.exe
http://www.mediafire.com/?u967oeb4pc7m71y


Pastebin Uploader.exe (Instalador para el menú contextual del mouse)
http://www.mediafire.com/download.php?a9subk9tssu499l






PU.rb

Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3.  
  4. require 'rest_client'
  5. require 'openssl'
  6. require 'win32/registry'
  7.  
  8.  
  9. exit if Object.const_defined?(:Ocra)
  10.  
  11.  
  12. $files   = ""
  13.  
  14.  
  15. def logo()
  16.  print '
  17.  ____        _  _
  18. (  _ \     / )( \           [v0.2] By Elektro H@cker
  19.  ) __/      ) \/ (
  20. (__)astebin \____/ploader
  21.  
  22. '
  23. end
  24.  
  25.  
  26. def help()
  27. print '
  28. [Modo de empleo]
  29.  
  30.  PU (Opciones opcionales) (Archivo)
  31.  
  32.  
  33.  
  34. [Opciones]
  35.  
  36.  -r  --raw
  37.      Postea el código sin formato.
  38.  
  39.  -p  --private
  40.      Marca el archivo como privado (Solo para usuarios registrados).
  41.  
  42.  -c  --config
  43.      Establece los datos de acceso a una cuenta de Pastebin.
  44.  
  45.  /?   Muestra esta ayuda.
  46.  
  47.  
  48.  
  49. [Ejemplos]
  50.  
  51.  [+] PU Archivo.txt
  52.      Devuelve el enlace directo del archivo.
  53.  
  54.  [+] PU "C:\Archivo1.txt" "C:\Archivo2.bat" "C:\Archivo3.xml"
  55.      Devuelve el enlace directo de varios archivos.
  56.  
  57.  [+] PU --raw Archivo.vbs
  58.      Postea el código sin formato, y devuelve el enlace directo del archivo.
  59.  
  60.  [+] PU --private "C:\Archivo.txt"
  61.      Marca el archivo como privado, y devuelve el enlace directo del archivo.
  62.  
  63.  [+] PU --config
  64.      Muestra el menú de configuración de cuenta de acceso.
  65.  
  66. '
  67. exit
  68. end
  69.  
  70.  
  71. def arguments()
  72.  
  73.  $privacity = 0
  74.  
  75.  # empty arguments
  76.  if (ARGV.empty?) then help() end
  77.  
  78.  ARGV.each do |arg|
  79.  
  80.  # /?
  81.    if arg == "/?" then help() end
  82.  
  83.  # -c --config
  84.    if arg =~ /-c\z/i or arg =~ /--config\z/i then configure() end
  85.  
  86.  # private
  87.    if arg =~ /-p\z/i or arg =~ /--private\z/i then $privacity = 2 end
  88.  
  89.  # -r --raw
  90.    if arg =~ /-r\z/i or arg =~ /--raw\z/i then $raw="yes" end
  91.  
  92.  # files to upload
  93.    if arg[/\.[a-z]+$\z/i]
  94.      if File.exist?(arg)
  95.        $files=$files + arg + "\n"
  96.      elsif
  97.        print "  [+] ERROR\n\n      El archivo #{arg} no existe...\n"
  98.      end
  99.    end
  100.  end # ARGV.each
  101.  
  102. end
  103.  
  104.  
  105. def formats(file)
  106.  if file[/\.arm$/i]   then $format = "arm" end
  107.  if file[/\.asm$/i]   then $format = "asm" end
  108.  if file[/\.asp$/i]   then $format = "asp" end
  109.  if file[/\.au3$/i]   then $format = "autoit" end
  110.  if file[/\.avs$/i]   then $format = "avisynth" end
  111.  if file[/\.bat$/i]   then $format = "dos" end
  112.  if file[/\.c$/i]     then $format = "c" end
  113.  if file[/\.cmake$/i] then $format = "cmake" end
  114.  if file[/\.cmd$/i]   then $format = "dos" end
  115.  if file[/\.cpp$/i]   then $format = "cpp" end
  116.  if file[/\.css$/i]   then $format = "css" end
  117.  if file[/\.diff$/i]  then $format = "diff" end
  118.  if file[/\.div$/i]   then $format = "div" end
  119.  if file[/\.html$/i]  then $format = "html5" end
  120.  if file[/\.ini$/i]   then $format = "ini" end
  121.  if file[/\.iss$/i]   then $format = "inno" end
  122.  if file[/\.lua$/i]   then $format = "lua" end
  123.  if file[/\.mxml$/i]  then $format = "mxml" end
  124.  if file[/\.nsis$/i]  then $format = "nsis" end
  125.  if file[/\.php$/i]   then $format = "php" end
  126.  if file[/\.pl$/i]    then $format = "perl" end
  127.  if file[/\.ps$/i]    then $format = "powershell" end
  128.  if file[/\.py$/i]    then $format = "python" end
  129.  if file[/\.pyc$/i]   then $format = "pycon" end
  130.  if file[/\.pyw$/i]   then $format = "python" end
  131.  if file[/\.rb$/i]    then $format = "ruby" end
  132.  if file[/\.rbw$/i]   then $format = "ruby" end
  133.  if file[/\.reg$/i]   then $format = "reg" end
  134.  if file[/\.sh$/i]    then $format = "bash" end
  135.  if file[/\.sql$/i]   then $format = "sql" end
  136.  if file[/\.tcl$/i]   then $format = "tcl" end
  137.  if file[/\.txt$/i]   then $format = "text" end    
  138.  if file[/\.vb$/i]    then $format = "vbnet" end
  139.  if file[/\.vhdl$/i]  then $format = "vhdl" end
  140.  if file[/\.vim$/i]   then $format = "vim" end
  141.  if file[/\.xml$/i]   then $format = "xml" end
  142.  if file[/\.yaml$/i]  then $format = "yaml" end
  143. end
  144.  
  145.  
  146. def configure()
  147.  $profile = "invalid login"
  148.    print "\n Puede configurar su cuenta de acceso de Pastebin para subir los archivos...\n\n"
  149.  
  150.    until not $profile["invalid login"]
  151.      print " [+] Escriba su nombre de usuario: "
  152.      $user=STDIN.gets
  153.      if $user == "\n" then $user="guest\n" end
  154.  
  155.      print " [+] Escriba su password: "
  156.      $pass=STDIN.gets
  157.      if $pass == "\n" then $pass="guest\n" end
  158.  
  159.      get_userkey()
  160.  
  161.      if $profile["invalid login"] and not $user+$pass=="guest\nguest\n"
  162.        print "\n [+] ERROR\n\n     El nombre de usuario o contraseña son incorrectos.\n\n"
  163.      elsif $user=="guest\n" and $pass=="guest\n"
  164.        $profile="guest"
  165.      end
  166.    end # until
  167.    userencrypted=cifrar($user, "DES-EDE3-CBC")
  168.    passencrypted=cifrar($pass, "DES-EDE3-CBC")
  169.    regwrite("USER", userencrypted)
  170.    regwrite("PASS", passencrypted)
  171.    puts "\n Datos configurados, vuelva a ejecutar el programa..."
  172.    exit
  173. end
  174.  
  175.  
  176. def get_userkey()
  177.  $profile = RestClient.post('http://pastebin.com/api/api_login.php',
  178.    :api_dev_key => "412c0f8eb27faf4feb80451ff06a2c56",
  179.    :api_user_name => $user.gsub("\n",""),
  180.    :api_user_password => $pass.gsub("\n",""),
  181.    :format => "xml")
  182.  $user_key = $profile
  183. end
  184.  
  185.  
  186. def cifrar(datos, cifrado)
  187.  encrypt = OpenSSL::Cipher::Cipher.new(cifrado)
  188.  encrypt.encrypt
  189.  encrypt.update(datos) + encrypt.final      
  190. end
  191.  
  192.  
  193. def descifrar(datos, cifrado)
  194.  decrypt = OpenSSL::Cipher::Cipher.new(cifrado)
  195.  decrypt.decrypt
  196.  decrypt.update(datos) + decrypt.final
  197. end
  198.  
  199.  
  200. def regwrite(keyname, value)
  201.  Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\PastebinUploader\\") do |reg|
  202.    reg[keyname, Win32::Registry::REG_SZ] = value
  203.  end
  204. end
  205.  
  206.  
  207. def regread(keyname)
  208.  Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\PastebinUploader\\") do |reg|
  209.    reg[keyname]
  210.  end
  211. end
  212.  
  213.  
  214. def subir(file)
  215.  begin
  216.    $link = RestClient.post('http://pastebin.com/api/api_post.php',
  217.    :api_option        => "paste",
  218.    :api_dev_key       => "412c0f8eb27faf4feb80451ff06a2c56",
  219.    :api_user_key      => $user_key,    
  220.    :api_user_name     => $user,
  221.    :api_user_password => $pass,
  222.    :api_paste_private => $privacity,
  223.    :api_paste_code    => File.read(file),
  224.    :api_paste_name    => file,
  225.    :api_paste_format  => $format)
  226.  rescue
  227.    print ' [+] ERROR
  228.  
  229.     El error puede ser debido a uno de los siguientes motivos:
  230.  
  231.     - La página esté offline.
  232.     - El tamaño del archivo supere los 500 KB, o 10 MB para usuarios premium.
  233.     - Haya superado el límite de 25 uploads al día, o 250 para usuarios premium.
  234.    '
  235.  exit
  236.  end # exception
  237. end
  238.  
  239.  
  240. logo()
  241. arguments()
  242.  
  243.  
  244. begin
  245.  $user=regread("USER")
  246.  $pass=regread("PASS")
  247.  $user=descifrar($user, "DES-EDE3-CBC").gsub("\n","")
  248.  $pass=descifrar($pass, "DES-EDE3-CBC").gsub("\n","")
  249.  get_userkey()
  250. rescue
  251.  $user="guest"
  252.  $pass="guest"
  253. end
  254. $files.each_line do |file|
  255.  $format = "text"
  256.  if not $raw == "yes" then formats(file) end
  257.  subir(file.gsub("\n",""))
  258.  puts "[+] #{file.chomp}: #{$link.to_s}"
  259. end
  260.  
  261.  
  262. __END__
  263.  
  264.  


« Última modificación: 10 Diciembre 2012, 21:12 pm por EleKtro H@cker » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Perl] PasteBin Uploader
Scripting
BigBear 0 2,240 Último mensaje 8 Octubre 2011, 16:55 pm
por BigBear
[Ruby] PasteBin Uploader
Scripting
BigBear 0 1,968 Último mensaje 16 Octubre 2011, 02:50 am
por BigBear
[Python] PasteBin Uploader
Scripting
BigBear 1 3,514 Último mensaje 9 Febrero 2012, 15:03 pm
por Eleкtro
[APORTE] [RUBY] Shack (Imageshack Uploader)
Scripting
Eleкtro 0 1,680 Último mensaje 19 Marzo 2012, 15:18 pm
por Eleкtro
[RUBY] [WINDOWS] IShack v1.4 (ImagesHack Uploader) ...(24/10/2012)
Scripting
Eleкtro 6 5,426 Último mensaje 27 Octubre 2012, 00:33 am
por Garcad
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines