# -*- coding: UTF-8 -*-
require 'rest_client'
require 'openssl'
require 'win32/registry'
exit if Object.const_defined?(:Ocra)
$formats = ""
$files = ""
def logo()
print "
@ @@
@ @ @ * *
@ @ @ * @@@ * @@@ @ @ *
*@ @ * @ * @ @ * @ @ @
@ * @ @ @@ @ @ @ @
@* @ @@ *@ @@@@ @ * @@ *
@ @ * @ @ @ @ * @ @ @ @
*@ @ @ @ @ @ @ @ * @ @* @
@ @@ @ * @ @@@@ @@@ @ @
v1.4
By Elektro H@cker\n"
end
def help()
print '
[Modo de empleo]
IShack (Opciones) (Archivo)
[Ejemplos]
[+] IShack -d Imagen.jpg
Devuelve el enlace directo de la imagen.
[+] IShack -d "C:\Imagen1.bmp" "C:\Imagen2.jpg" "C:\Imagen3.png"
Devuelve el enlace directo de varias imagenes.
[+] IShack --private -b -h "C:\Imagen.jpg"
Marca la imagen como privada, y devuelve el enlace BB y HTML de la imagen.
[+] IShack --resize 640x480 -d Imagen1.jpg Imagen2.bmp
Redimensiona las imagenes a XxY y devuelve el enlace directo.
[+] IShack --config
Muestra el menú de configuración de cuenta de acceso.
[Opciones]
-d --direct
Devuelve el enlace directo de la imagen.
-t --thumb
Devuelve el enlace directo de la miniatura de la imagen.
-b --bbcode
Devuelve el enlace de la imagen en formato BB.
-bt --bbcodethumb
Devuelve el enlace de la imagen con miniatura en formato BB.
-h --html
Devuelve el enlace de la imagen en formato HTML.
-ht --htmlthumb
Devuelve el enlace de la imagen con miniatura en formato HTML.
-i --imageshack
Devuelve el enlace web de la imagen en imageshack.
-y --yfrog
Devuelve el enlace web de la imagen en YFrog.
-yt --yfrogthumb
Devuelve el enlace de la miniatura de la imagen en YFrog.
-a --all
Devuelve el enlace de la imagen en todos los formatos.
-p --private
Marca la imagen como privada.
-r --resize
Redimensiona la imagen.
-c --config
Establece los datos de acceso a una cuenta de ImagesHack.
/? Muestra esta ayuda.
'
Process.exit
end
def arguments()
# 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 = "no" end
# -d --direct
if arg =~ /-d\z/i or arg =~ /--direct\z/i then $formats=$formats + "\n-d" end
# -t --thumb
if arg =~ /-t\z/i or arg =~ /--thumb\z/i then $formats=$formats + "\n-t" end
# -b --bbcode
if arg =~ /-b\z/i or arg =~ /--bbcode\z/i then $formats=$formats + "\n-b" end
# -bt --bbcodethumb
if arg =~ /-bt\z/i or arg =~ /--bbcodethumb\z/i then $formats=$formats + "\n-bt" end
# -h --html
if arg =~ /-h\z/i or arg =~ /--html\z/i then $formats=$formats + "\n-h" end
# -ht --htmlthumb
if arg =~ /-ht\z/i or arg =~ /--htmlthumb\z/i then $formats=$formats + "\n-ht" end
# -i --imageshack
if arg =~ /-i\z/i or arg =~ /--imageshack\z/i then $formats=$formats + "\n-i" end
# -y --yfrog
if arg =~ /-y\z/i or arg =~ /--yfrog\z/i then $formats=$formats + "\n-y" end
# -yt --yfrogthumb
if arg =~ /-yt\z/i or arg =~ /--yfrogthumb\z/i then $formats=$formats + "\n-yt" end
# -a --all
if arg =~ /-a\z/i or arg =~ /--all\z/i then $formats="\n-d"+"\n-t"+"\n-b"+"\n-bt"+"\n-h"+"\n-ht"+"\n-i"+"\n-y"+"\n-yt" end
# -r --resize
if arg =~ /-r\z/i or arg =~ /--resize\z/i
$resize_switch = "1"
$resize_size = ARGV.to_s.split('"'+arg+'", "').last.split('"').first
if not $resize_size[/^[0-9]{1,5}[x][0-9]{1,5}$/i]
print " [+] ERROR\n\n La resolución \"#{$resize_size}\" no es correcta...\n"
Process.exit
end
elsif arg =~ /-r\z/i or arg =~ /--resize\z/i
$resize_switch = "0"
print "hola"
sleep 3
end
# files to upload
if arg[/.bmp\z/i] or arg[/.gif\z/i] or arg[/.jpg\z/i] or arg[/.jpeg\z/i] or arg[/.png\z/i] or arg[/.tif\z/i] or arg[/.tiff\z/i]
if File.exist?(arg)
$files=$files + arg + "\n"
elsif
print " [+] ERROR\n\n La imagen #{arg} no existe...\n"
Process.exit
end
end
end # ARGV.each
# empty options
if $formats == ""
print " [+] ERROR\n\n Opción incorrecta...\n"
Process.exit
end
end
def configure()
$profile = "error id"
print "\n Puede configurar su cuenta de acceso de ImagesHack para subir las imagenes...\n\n"
until not $profile["error id"]
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
$profile = RestClient.post('http://imageshack.us/auth.php',
:username => $user.gsub("\n",""),
:password => $pass.gsub("\n",""),
:format => "xml"
)
if $profile["error id"] 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..."
Process.exit
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\\IShack\\") do |reg|
reg[keyname, Win32::Registry::REG_SZ] = value
end
end
def regread(keyname)
Win32::Registry::HKEY_CURRENT_USER.open("SOFTWARE\\IShack\\") do |reg|
reg[keyname]
end
end
def subir(file)
print "\n [ Subiendo la imagen #{file}... ]\n\n"
begin
$Imagen = RestClient.post('http://www.imageshack.us/upload_api.php',
:a_username => $user,
:a_password => $pass,
:key => "268BEKSV9465b858a45cd1b4d2b32d1195ee6f27",
:public => $privacity,
:fileupload => File.new(file),
:optimage => $resize_switch,
:optsize => $resize_size)
rescue
print ' [+] ERROR
El error puede ser debido a uno de los siguientes motivos:
- La página esté offline.
- El tamaño de la imagen supere los 10 MB.
- Haya superado el límite de 500 imagenes hospedadas en su cuenta.
'
Process.exit
end # exception
end
def show()
if $Imagen["http://www.imageshack.us/thumbnail."] then $thumbs="no" end
$nothumb = ' ImagesHack no creó ninguna miniatura. (La imagen es demasiado pequeña)' + "\n"
direct = $Imagen.split("<image_link>").last.split("</image_link>").first.to_s
thumb = $Imagen.split("<thumb_link>").last.split("</thumb_link>").first
b = "[IMG]"+$Imagen.split("<image_bb>").last.split("</image_bb>").first.split("[IMG]").last.split("[/IMG]").first+"[/IMG]"
bt = $Imagen.split("<thumb_bb>").last.split("</thumb_bb>").first
h = $Imagen.split("<image_html>").last.split("</image_html>").first.gsub(">", ">").gsub("<", "<").gsub(""", "\"")
ht = $Imagen.split("<thumb_html>").last.split("</thumb_html>").first.gsub(">", ">").gsub("<", "<").gsub(""", "\"")
i = $Imagen.split("<is_link>").last.split("</is_link>").first
y = $Imagen.split("<yfrog_link>").last.split("</yfrog_link>").first
yt = $Imagen.split("<yfrog_thumb>").last.split("</yfrog_thumb>").first
$formats.each_line do |link|
if link.gsub("\n","") == "-d" then print " [+] DIRECTO:\n\n" + direct + "\n\n" end
if link.gsub("\n","") == "-t"
print " [+] MINIATURA:\n\n"
if $thumbs=="no"
print $nothumb + "\n" + direct + "\n\n"
elsif
print thumb + "\n\n"
end
end # thumbail
if link.gsub("\n","") == "-b" then print " [+] BB CODE:\n\n" + b + "\n\n" end
if link.gsub("\n","") == "-bt"
print " [+] BB CODE MINIATURA:\n\n"
if $thumbs=="no"
print $nothumb + "\n" + "[URL="+direct+"][IMG]"+direct+"[/IMG][/URL]"+"\n\n"
elsif
print bt + "\n\n"
end
end # bb thumbnail
if link.gsub("\n","") == "-h" then print " [+] HTML:\n\n" + h + "\n\n" end
if link.gsub("\n","") == "-ht"
print " [+] HTML MINIATURA:\n\n"
if $thumbs=="no"
print $nothumb + "\n" + '<a href="' + direct + '" target="_blank"><img src="' + direct + '" alt="Imagen subida con IShack v1.4 (By Elektro H@cker)" border="0"/></a>'+"\n\n"
elsif
print ht + "\n\n"
end
end # ht thumbnail
if link.gsub("\n","") == "-i" then print " [+] IMAGESHACK:\n\n" + i + "\n\n" end
if link.gsub("\n","") == "-y" then print " [+] YFROG:\n\n" + y + "\n\n" end
if link.gsub("\n","") == "-yt" then print " [+] YFROG MINIATURA:\n\n" + yt + "\n\n" end
end # |link|
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","")
rescue
$user="guest"
$pass="guest"
end
$files.each_line do |file|
subir(file.gsub("\n",""))
show()
end
__END__