23 de marzo de 2010

WebSearch usando "you get signal"

Recientemente he visto en Pentest.es un programa que dada un IP o lista de IPs busca los dominios que le pertenecen.

Para este objetivo hace uso de el API de Bing. Me ha parecido muy buena idea, y yo he creado una función que realiza lo mismo. Desde aquí invito a que añadan a WebSearch si les gusta.

Esta utilidad hace uso de YouGetSignal para obtener los datos de dominios.
'''
@license: LGPL [http://www.gnu.org/licenses/lgpl.html]
@author: ehooo [ehooo[de]rollanwar[punto]net]
'''
import json, httplib, urllib

def search_you_get_signal(ip):
params = urllib.urlencode({'remoteAddress': ip, 'key': ""})
connection = httplib.HTTPConnection("www.yougetsignal.com")
headers = {"Host":"www.yougetsignal.com",\
"User-Agent":"WebSearch (YouGetSignal version)",\
"Accept":"*/*",\
"X-Requested-With":"XMLHttpRequest",\
"X-Prototype-Version":"1.6.0",\
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}
url = "/tools/web-sites-on-web-server/php/get-web-sites-on-web-server-json-data.php"

connection.request("POST", url, params, headers)
response = connection.getresponse()
lista = []
if response.status is httplib.OK:
json_response = response.read()
json_parse = json.loads(json_response)
if 'domainArray' in json_parse:
for (domain, desc) in json_parse['domainArray']:
lista.append(domain)
else:
print "ERROR:"
print json_parse
else:
print "ERROR:"
print response.getheaders()
return lista

if __name__ == '__main__':
import getopt, sys
try:
opts, args = getopt.getopt(sys.argv[1:], "i:", ["ip="])
except getopt.error, msg:
print msg
print sys.argv[0] + " [ -i | --ip= ]"
exit(2)

ip = None
for o, a in opts:
if o in ("-i", "--ip"):
ip = a

if ip is None:
print sys.argv[0] + " [ -i | --ip= ]"
exit(1)

list_domain = search_you_get_signal(ip)
for domain in list_domain:
print domain


UPDATE: cambiado el nombre "list" por "lista" by david G.

No hay comentarios:

Publicar un comentario