Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 16 Octubre 2011, 02:50 am



Título: [Ruby] PasteBin Uploader
Publicado por: BigBear en 16 Octubre 2011, 02:50 am
Un simple programa para subir codigos a pastebin

Código
  1. #!usr/bin/ruby
  2. #PasteBin Uploader  (C) Doddy Hackman 2011
  3.  
  4. require "net/http"
  5.  
  6. def head()
  7. print "\n\n-- == PasteBin Uploader\n\n\n"
  8. end
  9.  
  10. def copyright()
  11. print "\n\n(C) Doddy Hackman 2011\n\n"
  12. exit(1)
  13. end
  14.  
  15. def uso()
  16. print "\n[+] up.rb <file> <titulo> <tipo>\n"
  17. end
  18.  
  19. def tomar(web,par)
  20.   return Net::HTTP.post_form(URI.parse(web),par).body
  21.   end
  22.  
  23. def subir(file,titulo,tipo)
  24.  
  25. begin
  26. archivo = File.open(file)
  27. lineas = archivo.readlines
  28. rescue
  29. print "\n[-] Error open file\n"
  30. end
  31.  
  32. print "[+] Uploading file\n\n"
  33.  
  34. code = tomar("http://pastebin.com/api_public.php",{"paste_code" =>lineas,"paste_name"=>titulo,"paste_format"=>tipo,"paste_expire_date"=>"N","paste_private"=>"public","submit"=>"submit"})
  35.  
  36. if code=~/Bad API request/
  37. print "[-] Error uploading\n"
  38. else
  39. print "[+] Enjoy : "+code+"\n"
  40.  
  41. end
  42. end
  43.  
  44. file = ARGV[0]
  45. titulo = ARGV[1]
  46. tipo = ARGV[2]
  47.  
  48. head()
  49. if !file and !titulo and !tipo
  50. uso()
  51. else
  52. subir(file,titulo,tipo)
  53. end
  54. copyright()
  55.  
  56. # ¿ The End ?
  57.