theHarvester/discovery/cymon.py

39 lines
1 KiB
Python
Raw Normal View History

from discovery.constants import *
from lib.core import *
2019-01-11 10:09:47 +08:00
from parsers import cymonparser
import requests
import time
2018-12-10 01:44:28 +08:00
2018-12-10 01:44:28 +08:00
class search_cymon:
def __init__(self, word):
self.word = word
self.url = ""
self.results = ""
2019-01-14 07:58:38 +08:00
self.server = 'cymon.io'
2018-12-10 01:44:28 +08:00
def do_search(self):
try:
headers = {'user-agent': Core.get_user_agent(), 'Accept': '*/*', 'Referer': self.url}
2018-12-10 01:44:28 +08:00
response = requests.get(self.url, headers=headers)
time.sleep(getDelay())
2018-12-10 01:44:28 +08:00
self.results = response.content
except Exception as e:
print(e)
def process(self):
try:
2019-01-14 07:58:38 +08:00
self.url = 'https://' + self.server + '/domain/' + str(self.word)
print('\tSearching results.')
2018-12-10 01:44:28 +08:00
self.do_search()
except Exception as e:
print(f'Error occurred: {e}')
2018-12-10 01:44:28 +08:00
def get_ipaddresses(self):
try:
ips = cymonparser.Parser(self)
2018-12-10 01:44:28 +08:00
return ips.search_ipaddresses()
except Exception as e:
print(f'Error occurred: {e}')