Ecco il testo del esercizio:
ecco il mio:
http://sprunge.us/RIMd?rb
=)
EDIT: WTF? colpo di culo?
Codice:
Scrivere un programma che trovi file su sprunge.us in maniera casuale :3
ecco il mio:
Codice:
require 'net/http'
$a = [] and (26).times {|x|
$a << (65+x).chr
} and (26).times {|x|
$a << (97+x).chr
}
$c = 0
def test(x)
buff = ""
4.times do
buff = buff + $a[rand($a.size)]
end
print "[+] Try /#{buff}\n"
http = Net::HTTP.new('sprunge.us')
data = http.get("/#{buff}")
if data.body != "#{buff} not found"
puts "Found => #{buff}\nFound after #{x} times..."
exit
end
end
while true
Thread.new do
$c += 1
test($c)
end
end
=)
EDIT: WTF? colpo di culo?
Codice:
evilmau@EviLMau-netbook:~/prog/Ruby$ ruby sprungerandom.rb
[+] Try /RIMd
Found => RIMd
Found after 1 times...
evilmau@EviLMau-netbook:~/prog/Ruby$