-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
61 lines (52 loc) · 1.71 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Test
# Example: Simple Search in MrLooquer
# __Author__: Julian J. GOnzalez
# __Version__: 0.1
#
import sys
import os
sys.path.insert(0, str(os.path.dirname(
os.path.abspath(__file__)) +
os.path.sep + 'looquer' + os.path.sep))
from looquer import Mrlooquer
def show(r, q):
for key in r:
if key == 'numPages':
max_page = r[key]
if key == 'hits':
print (('Max Page {}'.format(max_page)))
for item in r[key]:
print ((item['domain']))
print ((item['port']))
print ((item['ip']))
if 'ip4' in list(item.keys()):
print ((item['ip4']))
print ((item['date']))
print ((item['banner']))
if __name__ == "__main__":
try:
print (' *********************')
print (' Testing Mrlooquer API')
print (' *********************')
# You must register in mrlooquer.com to get API-KEY
token = 'you_token_will_be_here'
n = Mrlooquer(token)
# Looking for info for Apache
query = 'apache'
n.search(query)
r = n.raw_data()
print ((show(r, query)))
except Exception as e:
import json
print (' MrLooquer Error')
print ('')
if '400' in str(e):
msg = {'Error': [{"Status": 400,
"QuoteExceded": "the quote exceeded"}]}
msg = json.dumps(msg)
print (msg)
if '403' in str(e):
msg = {'Error': [{"Status": 403,
"TokenNotValid": "the token is not valid"}]}
msg = json.dumps(msg)
print (msg)