This program will check the milw0rm database for exploits and then give you a list of exploits. You then tell it which exploit you would like and the script will fetch the exploit from milw0rm for you and save it to your hard drive.
Code:#!/usr/bin/ruby
#Programmed by: TheKlown
require 'net/http'
require 'uri'
class Milw0rmResults
def initialize(id, des, link, site)
@id =id
@des =des
@link =link
@site =site
end
def getID()
return @id
end
def getDes()
return @des
end
def getExploit()
url = URI.parse(@site)
res = Net::HTTP.start(url.host, url.port) {|http|
http.get(@link)
}
return res.body
end
end
class Milw0rm
def initialize(site)
@site =site
@sResult
end
def Search(search)
res =Net::HTTP.post_form(URI.parse(@site), {'dong'=>search});
@sResult =res.body();
end
def getList()
search =[]
@sResult [email protected]('<TR class=submit>')
#Once we have located the position that the search result starts at we then find its length and drop 2 of this
#the reasion we need to do this is because the last search result needs to be handled seperatly
max [email protected]
max -=1
#process the search results and store them in Milw0rmSearch
for i in 1..max
tmp =@sResult[i].split('<TD nowrap="nowrap" width=62 class=style14>')
tmp =tmp[1].split('</TD><TD nowrap="nowrap" width=375>')
des =tmp[1].split('>')
link =des[0].split('<a href=')
link =link[1].split(' target=')
link =link[0]
des =des[1].split('</A') #the description is stored in des[0]
search[i] =Milw0rmResults::new(i, des[0], link, @site)
end
return search
end
end
def Intro()
result ="Exploiter v1\n"
result +="Programmed by: Spider\n"
result +="irc: irc.hackedyourbox.net\n"
result +="A product of:\n\t"
result +="www.cyber-t3ch.net www.hackedyourbox.net www.striknyne.net & www.j4ck4lz.net\n"
return result;
end
#a function to remove all the html **** from the bottom
def removeBottom(str)
count =0
tmp =str.reverse #reverse the string so we can work from the top
str =""
tmp.each{ |i|
if(count >3) #once we have read the first two lines in we can start saving the file again
str +=i
end
count +=1
}
return str.reverse #reverse the file again so its the correct way up
end
print(Intro(), "\n")
print("Exploit>")
find =gets
find =find.split("\n")
#Exploiter starts here
milw0rm =Milw0rm::new("http://www.milw0rm.com/search.php")
milw0rm.Search(find[0])
exploits =milw0rm.getList()
max =exploits.length
max -=1
for i in 1..max
print(exploits[i].getID() ," : " ,exploits[i].getDes() ,"\n")
end
id =0
while(id.to_i >max or id.to_i ==0)
print("(press q to exit)\n")
print("exploit ID> ")
id =gets
if(id =="q\n")
exit 1
end
end
print("Filename> ")
filename =gets
filename =filename.split("\n") #we need to remove the new line from the filename
outfile =File::new(filename[0], 'w')
count =0
ex =exploits[id.to_i].getExploit()
ex =removeBottom(ex) #we need to remove all the html **** from the bottom of the file
ex.each{ |i|
if(count >4) #drop the first four lines from the file, this is so we dont get all the html **** in the file
outfile.write(i)
end
count +=1
}
outfile.close()
