mirror of
https://github.com/laramies/theHarvester.git
synced 2024-11-11 18:03:10 +08:00
Fix threatcrowd and move to grequests
This commit is contained in:
parent
81c78a248b
commit
84af726754
1 changed files with 6 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
from theHarvester.lib.core import *
|
||||
from theHarvester.parsers import myparser
|
||||
import requests
|
||||
import grequests
|
||||
|
||||
|
||||
class SearchThreatcrowd:
|
||||
|
@ -13,11 +13,12 @@ def __init__(self, word):
|
|||
self.counter = 0
|
||||
|
||||
def do_search(self):
|
||||
url = f'https://www.threatcrowd.org/searchApi/v2/domain/report/?domain={self.word}'
|
||||
base_url = f'https://www.threatcrowd.org/searchApi/v2/domain/report/?domain={self.word}'
|
||||
headers = {'User-Agent': Core.get_user_agent()}
|
||||
try:
|
||||
request = requests.get(url, headers=headers)
|
||||
self.results = request.text
|
||||
request = grequests.get(base_url, headers=headers)
|
||||
data = grequests.map([request])
|
||||
self.results = data[0].content.decode('UTF-8')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.totalresults += self.results
|
||||
|
@ -27,4 +28,5 @@ def get_hostnames(self):
|
|||
|
||||
def process(self):
|
||||
self.do_search()
|
||||
self.get_hostnames()
|
||||
print('\tSearching results.')
|
||||
|
|
Loading…
Reference in a new issue