# -*- coding: UTF-8 -*-
require 'rest_client'
require 'openssl'
require 'win32/registry'
exit if Object.const_defined?(:Ocra)
$files = ""
def logo()
print '
____ _ _
( _ \ / )( \ [v0.2] By Elektro H@cker
) __/ ) \/ (
(__)astebin \____/ploader
'
end
def help()
print '
[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.
'
exit
end
def arguments()
$privacity = 0
# empty arguments
if (ARGV.empty?) then help() end
ARGV.each do |arg|
# /?
if arg == "/?" then help() end
# -c --config
if arg =~ /-c\z/i or arg =~ /--config\z/i then configure() end
# private
if arg =~ /-p\z/i or arg =~ /--private\z/i then $privacity = 2 end
# -r --raw
if arg =~ /-r\z/i or arg =~ /--raw\z/i then $raw="yes" end
# files to upload
if arg[/\.[a-z]+$\z/i]
if File.exist?(arg)
$files=$files + arg + "\n"
elsif
print " [+] ERROR\n\n El archivo #{arg} no existe...\n"
end
end
end # ARGV.each
end
def formats(file)
if file[/\.arm$/i] then $format = "arm" end
if file[/\.asm$/i] then $format = "asm" end
if file[/\.asp$/i] then $format = "asp" end
if file[/\.au3$/i] then $format = "autoit" end
if file[/\.avs$/i] then $format = "avisynth" end
if file[/\.bat$/i] then $format = "dos" end
if file[/\.c$/i] then $format = "c" end
if file[/\.cmake$/i] then $format = "cmake" end
if file[/\.cmd$/i] then $format = "dos" end
if file[/\.cpp$/i] then $format = "cpp" end
if file[/\.css$/i] then $format = "css" end
if file[/\.diff$/i] then $format = "diff" end
if file[/\.div$/i] then $format = "div" end
if file[/\.html$/i] then $format = "html5" end
if file[/\.ini$/i] then $format = "ini" end
if file[/\.iss$/i] then $format = "inno" end
if file[/\.lua$/i] then $format = "lua" end
if file[/\.mxml$/i] then $format = "mxml" end
if file[/\.nsis$/i] then $format = "nsis" end
if file[/\.php$/i] then $format = "php" end
if file[/\.pl$/i] then $format = "perl" end
if file[/\.ps$/i] then $format = "powershell" end
if file[/\.py$/i] then $format = "python" end
if file[/\.pyc$/i] then $format = "pycon" end
if file[/\.pyw$/i] then $format = "python" end
if file[/\.rb$/i] then $format = "ruby" end
if file[/\.rbw$/i] then $format = "ruby" end
if file[/\.reg$/i] then $format = "reg" end
if file[/\.sh$/i] then $format = "bash" end
if file[/\.sql$/i] then $format = "sql" end
if file[/\.tcl$/i] then $format = "tcl" end
if file[/\.txt$/i] then $format = "text" end
if file[/\.vb$/i] then $format = "vbnet" end
if file[/\.vhdl$/i] then $format = "vhdl" end
if file[/\.vim$/i] then $format = "vim" end
if file[/\.xml$/i] then $format = "xml" end
if file[/\.yaml$/i] then $format = "yaml" end
end
def configure()
$profile = "invalid login"
print "\n Puede configurar su cuenta de acceso de Pastebin para subir los archivos...\n\n"
until not $profile["invalid login"]
print " [+] Escriba su nombre de usuario: "
$user=STDIN.gets
if $user == "\n" then $user="guest\n" end
print " [+] Escriba su password: "
$pass=STDIN.gets
if $pass == "\n" then $pass="guest\n" end
get_userkey()
if $profile["invalid login"] and not $user+$pass=="guest\nguest\n"
print "\n [+] ERROR\n\n El nombre de usuario o contraseña son incorrectos.\n\n"
elsif $user=="guest\n" and $pass=="guest\n"
$profile="guest"
end
end # until
userencrypted=cifrar($user, "DES-EDE3-CBC")
passencrypted=cifrar($pass, "DES-EDE3-CBC")
regwrite("USER", userencrypted)
regwrite("PASS", passencrypted)
puts "\n Datos configurados, vuelva a ejecutar el programa..."
exit
end
def get_userkey()
$profile = RestClient.post('http://pastebin.com/api/api_login.php',
:api_dev_key => "412c0f8eb27faf4feb80451ff06a2c56",
:api_user_name => $user.gsub("\n",""),
:api_user_password => $pass.gsub("\n",""),
:format => "xml")
$user_key = $profile
end
def cifrar(datos, cifrado)
encrypt = OpenSSL::Cipher::Cipher.new(cifrado)
encrypt.encrypt
encrypt.update(datos) + encrypt.final
end
def descifrar(datos, cifrado)
decrypt = OpenSSL::Cipher::Cipher.new(cifrado)
decrypt.decrypt
decrypt.update(datos) + decrypt.final
end
def regwrite(keyname, value)
Win32::Registry::HKEY_CURRENT_USER.create("SOFTWARE\\PastebinUploader\\") do |reg|
reg[keyname, Win32::Registry::REG_SZ] = value
end
end
def regread(keyname)
Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\PastebinUploader\\") do |reg|
reg[keyname]
end
end
def subir(file)
begin
$link = RestClient.post('http://pastebin.com/api/api_post.php',
:api_option => "paste",
:api_dev_key => "412c0f8eb27faf4feb80451ff06a2c56",
:api_user_key => $user_key,
:api_user_name => $user,
:api_user_password => $pass,
:api_paste_private => $privacity,
:api_paste_code => File.read(file),
:api_paste_name => file,
:api_paste_format => $format)
rescue
print ' [+] ERROR
El error puede ser debido a uno de los siguientes motivos:
- La página esté offline.
- El tamaño del archivo supere los 500 KB, o 10 MB para usuarios premium.
- Haya superado el límite de 25 uploads al día, o 250 para usuarios premium.
'
exit
end # exception
end
logo()
arguments()
begin
$user=regread("USER")
$pass=regread("PASS")
$user=descifrar($user, "DES-EDE3-CBC").gsub("\n","")
$pass=descifrar($pass, "DES-EDE3-CBC").gsub("\n","")
get_userkey()
rescue
$user="guest"
$pass="guest"
end
$files.each_line do |file|
$format = "text"
if not $raw == "yes" then formats(file) end
subir(file.gsub("\n",""))
puts "[+] #{file.chomp}: #{$link.to_s}"
end
__END__