Pues bueno no se si sabran esto: [Enlace externo eliminado para invitados]
Pero esto es interesante:

#!/usr/bin/ruby

# This was a quick hack to download Facebook URLs from
# [Enlace externo eliminado para invitados]
#
# @author
# @date 2010-07-11

require 'net/http'
require 'uri'

File.open("input.txt", "r") do |infile|
while (path = infile.gets) do
if(path =~ /directory/) then
attempts = 0
while true do
begin
count = 0
$stderr.puts("PATH: " + path)
url = URI.parse(path)
res = Net::HTTP.start(url.host, url.port) {|http|
http.get(url.path, {"User-agent"=>"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"})
}
links = res.body.scan(/UIDirectoryBox_Item.*?a href="(.*?)"/)

links.each { |link|
link = link.shift
puts link
count = count + 1
}
$stderr.puts("Found %d links!" % count)

if(count == 0) then
attempts = attempts + 1
if(attempts > 3)
$stderr.puts("Giving up!")
break
else
$stderr.puts("Found no links, trying again (%d retries left)!" % (3 - attempts))
end
sleep(10)
else
break
end
rescue Exception
$stderr.puts("ERROR: " + $!)
sleep(30)
end
end
else
$stderr.puts("Skipping: " + path)
puts(path)
end
end
end
Aqui información del script:

description = [[
Spider Facebook's 'directory' service and download people's names.

This script, by design, requires significant intervention by the user.
It isn't intended as an automated script by any stretch. User beware!
]]

author = "Ron"
license = "Same as Nmap--See [Enlace externo eliminado para invitados]"
categories = {}

require 'http'
require 'nsedebug'

hostrule = function()
return true
end

action = function(host, port)
-- Parse arguments
local infilename = nmap.registry.args['infilename']

-- There are two types of outputs -- person and directory. The person file
-- gets a CVS list written to it (url,name), whereas the directory file
-- gets a list of URLs that still have to be checked.
local outfilename_names = nmap.registry.args['outfilename_names']
local outfilename_directory = nmap.registry.args['outfilename_directory']

if(not(infilename)) then
return "ERROR: the 'infilename' argument is required!"
end
if(not(outfilename_names)) then
return "ERROR: the 'outfilename_names' argument is required!"
end
if(not(outfilename_directory)) then
return "ERROR: the 'outfilename_directory' argument is required!"
end

-- Open the input file for reading
local infile = io.open(infilename, "r")
if(not(infile)) then
return string.format("ERROR: couldn't open file for reading", infilename)
end

-- Open the output files for writing
local outfile_names = io.open(outfilename_names, 'a')
if(not(outfile_names)) then
return string.format("ERROR: couldn't open file %s for writing", outfilename_names)
end
local outfile_directory = io.open(outfilename_directory, 'a')
if(not(outfile_directory)) then
return string.format("ERROR: couldn't open file %s for writing", outfilename_directory)
end

while true do
local line = infile:read("*line")
if(not(line)) then
break
end

-- Make sure it's a valid URL
if(string.find(line, "http")) then
-- Prepare to receive the body
local body = nil

-- Download the page, using multiple attempts if necessary
local attempts = 0
repeat
-- Unless there is our first try, delay
if(attempts > 0) then
stdnse.print_debug(1, "Waiting before next attempt...")
stdnse.sleep(5)
end

-- Keep track of number of attempts
attempts = attempts + 1
-- Try to download the page
stdnse.print_debug(1, "Downloading: %s (attempt #%d)", line, attempts)
local result = http.get_url(line, {header={"User-agent: Googlebot/2.1 (+[Enlace externo eliminado para invitados])"}})
if(result) then
body = result.body
end
until((body and string.find(body, "UIDirectoryBox_Item")) or attempts > 4)

-- Print an error if we ran out of attempts
if(attempts > 4) then
stdnse.print_debug(1, "ERROR: giving up on path: " .. line)
else
-- Now the fun part -- parse out the names + URLs
-- Each line for a directory looks like this:
-- <li class="UIDirectoryBox_Item"><a href="[Enlace externo eliminado para invitados] Adams - Tangee Adams</a></li>
-- And each line for a person looks like this:
-- <li class="UIDirectoryBox_Item"><a href="[Enlace externo eliminado para invitados] Almahmod</a></li>
local start, finish, url, name
finish = 0
local found = 0

while true do
start, finish, url, name = string.find(body, 'UIDirectoryBox_Item.-(http.-)">(.-)<', finish)
if(not(start)) then
break
end

-- Keep track of how many we found
found = found + 1

-- Check if it's a directory or a name
if(string.find(url, "directory")) then
outfile_directory:write(string.format("%s\n", url))
-- io.write("Directory: " .. url .. "\n")
else
outfile_names:write(string.format("%s,%s\n", url, name))
-- io.write("Name: " .. url .. "\n")
end
end

stdnse.print_debug(1, "Found %d links", found)
end
end
end
end




Suerte
No tiene los permisos requeridos para ver los archivos adjuntos a este mensaje.
Responder

Volver a “General”