Exemple #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--search','-s',help="your fofa grammar ")
    parser.add_argument('--payloda','-p',help='your payloda')
    args = parser.parse_args()
    exps = importlib.import_module('bugscan.%s'% args.payloda)
    # 你自己的fofa api
    email, key = ('*****@*****.**','xxxx')
    client = fofa.Client(email, key)
    query_str = u"%s" % args.search
    urls = []
    # 从第1页查到第2页
    for page in range(1,2):
        # 查询F币剩余数量
        fcoin = client.get_userinfo()["fcoin"]
        print "Fb:%s" %fcoin
        if fcoin < 92:
            break
        data = client.get_data(query_str,page=page,fields="ip,port")
        for ip,port in data["results"]:
            if port == "443":
                urls.append('https://%s'% ip)
            else:
                urls.append('http://%s:%s'%(ip,port))
        for url in urls:
        	try:
        		print url
        		exps.audit("%s/"%url)
        	except:
        		print "sorry:%s"%url
Exemple #2
0
 def setUp(self):
     env_dist = os.environ
     email = env_dist.get('FOFA_EMAIL')
     key = env_dist.get('FOFA_KEY')
     if not email and not key:
         config = open('../CONFIG').read()
         email, key = config.split("\n")
     self.client = fofa.Client(email, key)
Exemple #3
0
def Request(m, k, p, q):
    email, key = (m, k)
    client = fofa.Client(email, key)
    global Sum
    query_str = q
    Sum = []
    for page in range(int(p) - 1):
        data = client.get_data(query_str, fields="host,title", page=page)
        Sum.append(data)
Exemple #4
0
def fofaStart(mail, key, rule, file, start, end):
    client = fofa.Client(mail, key)
    query_str = rule
    try:
        with open(file, 'a') as fi:
            for page in range(int(start), int(end)):
                print '第%d页' % page
                data = client.get_data(query_str, page=page, fields="ip,city")
                for ip, city in data["results"]:
                    fi.write('[%s]: %s\n' % (ip, city))
    except Exception as e:
        pass
 def Fofa(self, page=2):
     try:
         client = fofa.Client(self.fofa_email, self.fofa_token)
         for page in xrange(1, page):
             data = client.get_data(self.fofa_keyword,
                                    page=page,
                                    fields="ip,port")
             for ip, port in data["results"]:
                 print "[\033[0;32;40mFofa\033[0m] {}".format(ip + ":" +
                                                              str(port))
                 self.ips_result.add(ip + ":" + str(port))
     except:
         print "[\033[0;35;40mFofa\033[0m] Error"
         pass
Exemple #6
0
# -*- coding: utf-8 -*-
import fofa

if __name__ == "__main__":
    config = open('../CONFIG').read()
    email, key = config.split("\n")
    client = fofa.Client(email, key)
    query_str = 'header="thinkphp" || header="think_template"'
    for page in range(1,51):
        fcoin = client.get_userinfo()["fcoin"]
        if fcoin <= 249:
            break
        data = client.get_data(query_str,page=page,fields="ip,city")
        for ip,city in data["results"]:
            print "%s,%s"%(ip,city)
Exemple #7
0
# -*- coding: utf-8 -*-
import fofa

if __name__ == "__main__":
    email, key = ('*****@*****.**','2c2ac79b4c7f0f21b82a2018062c3b47') #输入email和key
    client = fofa.Client(email, key)                                  #将email和key传入fofa.Client类进行初始化和验证,并得到一个fofa client对象
    query_str = 'header="thinkphp" || header="think_template"'
    for page in range(1,51):                                          #从第1页查到第50页
        fcoin = client.get_userinfo()["fcoin"]                        #查询F币剩余数量
        if fcoin <= 10:
            break                                                     #当F币剩249个时,不再获取数据
        data = client.get_data(query_str,page=page,fields="ip,city")  #查询第page页数据的ip和城市
        for ip,city in data["results"]:
            print "%s,%s"%(ip,city)                                   #打印出每条数据的ip和城市
Exemple #8
0
helps = 'Please modify "EMAIL,KEY,query_string" before use...'

EMAIL = ''
KEY = ''
query_string = ''

result = []

init()
print(Fore.CYAN + usage)

if query_string == '' or EMAIL == '' or KEY == '':
    print(Fore.RED + '  ' + helps)
    sys.exit()

client = fofa.Client(EMAIL, KEY)

print(Fore.CYAN + "[+] Start to get the result of " + Fore.YELLOW +
      query_string + Fore.CYAN +
      " to {0}.txt".format(time.strftime("%Y-%m-%d")))
for page in range(1, 101):

    data = client.get_data(query_string,
                           page=page,
                           fields="domain, ip, port, city")

    if data['results'] == []:
        break
    else:
        print(Fore.CYAN + "[+] Crawling page {0}...".format(page))
        for domain, ip, port, city in data['results']:
Exemple #9
0
 def setUp(self):
     config = open('../CONFIG').read()
     email, key = config.split("\n")
     self.client = fofa.Client(email, key)
Exemple #10
0
 def __init__(self, email, key, query_str):
     self.client = fofa.Client(email, key)
     self.query_str = 'domain="{}"'.format(query_str)