2010-04-30 08:40:19 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'net/http'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Pull Del.icio.us Links (URLs) for a domain',
|
2010-05-03 17:13:09 +00:00
|
|
|
'Description' => %q{
|
|
|
|
This module pulls and parses the URLs stored by Del.icio.us users for the
|
|
|
|
purpose of replaying during a web assessment. Finding unlinked and old pages.
|
|
|
|
},
|
2010-01-31 00:52:51 +00:00
|
|
|
'Author' => [ 'Rob Fuller <mubix [at] hak5.org>' ],
|
|
|
|
'License' => MSF_LICENSE,
|
2010-05-03 17:13:09 +00:00
|
|
|
'Version' => '$Revision$'))
|
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('DOMAIN', [ true, "Domain to request URLS for"]),
|
2010-04-30 08:40:19 +00:00
|
|
|
OptString.new('OUTFILE', [ false, "Where to output the list for use"])
|
2010-01-31 00:52:51 +00:00
|
|
|
], self.class)
|
|
|
|
|
|
|
|
register_advanced_options(
|
|
|
|
[
|
|
|
|
OptString.new('PROXY', [ false, "Proxy server to route connection. <host>:<port>",nil]),
|
|
|
|
OptString.new('PROXY_USER', [ false, "Proxy Server User",nil]),
|
|
|
|
OptString.new('PROXY_PASS', [ false, "Proxy Server Password",nil])
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def pull_urls(targetdom)
|
|
|
|
response = ""
|
|
|
|
list = []
|
|
|
|
lastpage = 0
|
|
|
|
pagenum = 1
|
|
|
|
while lastpage == 0
|
|
|
|
print_status("Page number: " + pagenum.to_s)
|
|
|
|
header = { 'User-Agent' => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/4.0.221.6 Safari/525.13"}
|
2010-11-23 01:26:59 +00:00
|
|
|
clnt = Net::HTTP::Proxy(@proxysrv,@proxyport,@proxyuser,@proxypass).new("www.delicious.com")
|
2010-01-31 00:52:51 +00:00
|
|
|
resp, data = clnt.get2("/search?p=site%3A"+targetdom+"&page="+pagenum.to_s,header)
|
|
|
|
response << data
|
2010-06-12 09:15:50 +00:00
|
|
|
response.each_line do |line|
|
2010-11-23 01:26:59 +00:00
|
|
|
list << line.gsub!(/(.+<a rel=\"nofollow)(.+=+\")(.+)(\".+)/, '\3')
|
2010-01-31 00:52:51 +00:00
|
|
|
end
|
|
|
|
if /pn\ next/.match(data)
|
|
|
|
pagenum += 1
|
|
|
|
else
|
|
|
|
lastpage = 1
|
|
|
|
end
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
list.delete_if{|x| x==nil}
|
|
|
|
list.uniq!
|
|
|
|
list.sort!
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
return list
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
def write_output(data)
|
|
|
|
print_status("Writing URLs list to #{datastore['OUTFILE']}...")
|
2010-04-30 08:40:19 +00:00
|
|
|
file_name = datastore['OUTFILE']
|
2010-01-31 00:52:51 +00:00
|
|
|
if FileTest::exist?(file_name)
|
|
|
|
print_status("OUTFILE already existed, appending..")
|
|
|
|
else
|
|
|
|
print_status("OUTFILE did not exist, creating..")
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-07-01 23:33:07 +00:00
|
|
|
File.open(file_name, 'ab') do |fd|
|
2010-01-31 00:52:51 +00:00
|
|
|
fd.write(data)
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
def run
|
|
|
|
if datastore['PROXY']
|
|
|
|
@proxysrv,@proxyport = datastore['PROXY'].split(":")
|
|
|
|
@proxyuser = datastore['PROXY_USER']
|
|
|
|
@proxypass = datastore['PROXY_PASS']
|
|
|
|
else
|
|
|
|
@proxysrv,@proxyport = nil, nil
|
|
|
|
end
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
target = datastore['DOMAIN']
|
|
|
|
|
|
|
|
urls = []
|
|
|
|
print_status("Pulling urls from Delicious.com")
|
|
|
|
urls = pull_urls(target)
|
2010-04-30 08:40:19 +00:00
|
|
|
|
2010-01-31 00:52:51 +00:00
|
|
|
print_status("Located #{urls.count} addresses for #{target}")
|
2010-04-30 08:40:19 +00:00
|
|
|
|
|
|
|
if datastore['OUTFILE']
|
2010-11-23 01:26:59 +00:00
|
|
|
write_output(urls.join)
|
2010-01-31 00:52:51 +00:00
|
|
|
else
|
|
|
|
urls.each do |i|
|
2011-09-11 02:42:39 +00:00
|
|
|
print_status(i)
|
2010-04-30 08:40:19 +00:00
|
|
|
end
|
2010-01-31 00:52:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|