Saturday, June 23, 2012

import sys
import httplib
import re
from urlparse import urlparse
import urllib
import socket
appid='8F0213E2A58E37683CEBB707DDE557F920F12806' #_ML
webcount = 50
def http(method,url,params='',headers=''):
        url_parse = urlparse(url)
        host      = url_parse[1]
        path      = url_parse[2]
    query     = url_parse[4]
        http      = httplib.HTTPConnection(host)
        if method=='GET':
                http.request(method,path+'?'+query)
        elif method =='POST':
                http.request(method,path,params,headers)
        res       = http.getresponse()
        result    = res.read()
        http.close()
        return result
def retdomain(x):
    parse_domain = urlparse(x)
    return parse_domain[1].replace('www.','')
print '-'*50   
print '#    RevIP v1.0'
print '#    auth0r: _ML'
print '-'*50
if (len(sys.argv)>1):
    target      = sys.argv[1];
    print "Processing..."
    parsetarget = urlparse('http://'+target.replace('http://',''))
    ip = socket.gethostbyname(parsetarget[1])
    print target+'  ==>  '+ip
    if ip=='': sys.exit('failed')
    list_result = []
    url         = 'http://api.bing.com/xml.aspx?Appid='+appid+'&query=ip:'+ip+'&sources=web&web.count='+str(webcount)+'&web.offest=0'
    page        = http('GET',url)
    total       = re.search('<web:Total>([0-9]+)<\/web:Total>',page)
    total       = total.group(1)
    totalpage   = int(total)/50 + 1
    ###################################################
    print '[-] target: '+target
    print
    for i in range(0,totalpage+1):
        url         = 'http://api.bing.com/xml.aspx?Appid='+appid+'&query=ip:'+ip+'&sources=web&web.count='+str(webcount)+'&web.offest='+str(webcount*i)
        page        = http('GET',url)
        get_url     = re.findall(r'<web:Url>(.+?)<\/web:Url>',page)
        for g in get_url:   list_result.append(retdomain(g))
    result = set(list_result)
    i = 0
    parselog= urlparse(target)
    fw  = open('./result/'+str(parselog[1])+'.txt','a')
    fw.write('[-] target: '+target+'\r\n\r\n')
     
    for r in result:
        fw.write('  ['+str(i)+'] '+r+'\r\n')
        print ' ['+str(i)+'] '+r
        i += 1
    fw.write('\r\n\r\n')
    fw.close()
else:
    print 'usage: python revip.py #target(ip|domain)'
 Chú ý: nhớ tạo folder "result" và có quyền write để lưu kết quả sau khi hoàn thành nhé


Code:
Example:
python revip.py http://victim.com
python revip.py 123.456.789.000

[Python] Reverse IP v1.0

  • Uploaded by: MIN Software
  • Views:
  • Category: , ,
  • Share

    0 comments:

    Post a Comment

     

    Our Team Members

    Copyright © hacker va bao mat | Designed by Templateism.com | WPResearcher.com