How to use the censys.GetIp function in censys

To help you get started, we’ve selected a few censys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github t4mo / Http-Proxy-Scan / censys.py View on Github external
global exitFlag
    threads = []
    queue = Queue.Queue(10000)
    keyword = ['Squid','CCProxy','Tinyproxy','Wingate','Pound','Proxy','Mikrotik']
    portlist = [8080,80,3128]
    for key in keyword:
        exitFlag.clear()
        print '[*]Use Keyword: %s' %(key)
        query = {"query":key,"page":1}
        try:
            res = requests.post(API_URL+"ipv4",data=json.dumps(query),auth=(UID,SECRET),timeout=30)
            res_results = res.json()
            endpage = res_results['metadata']['pages']
            print '[*]Total Page: %s' %(endpage)
            startpage = 1
            g = GetIp(queue,startpage,endpage,key,portlist)
            g.start()
            for i in range(200):
                t = CheckIp(queue)
                t.setDaemon(True)
                t.start()
            g.join()
            queue.join()
            exitFlag.set()
            print '[*]Keyword:%s Is Done' %(key)
            time.sleep(60)
        except Exception,e:
            print '[*]Keyword:%s Error' %(key)
    print '[*]All Done...'