forked from m4ll0k/BBTz
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathgetrelationship.py
More file actions
40 lines (33 loc) · 1.01 KB
/
getrelationship.py
File metadata and controls
40 lines (33 loc) · 1.01 KB
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
import requests
from lxml import html
import os
import sys
if not sys.version_info.major >= 3:
sys.exit(print("[ ! ] Run this tool with python version 3.+"))
def usage():
print('Usage:\n')
print('\tpython3 {} domain1,domain2,domain3,..'.format(sys.argv[0]))
print('\tcat targets.txt | python3 {} '.format(sys.argv[0]))
print('\nby m4ll0k (@m4ll0k2)\n')
sys.exit(0)
def main(target: str) -> None:
try:
content = requests.get('https://builtwith.com/relationships/{0}'.format(target)).content
html_ = html.fromstring(content)
for target_ in html_.xpath('//td[@class="hbomb"]/a/text()'):
print(target_)
except Exception as err:
sys.exit(
print('[ ! ] ERROR: {0}'.format(
err
))
)
if len(sys.argv) > 1:
for target in sys.argv[1].split(','):
main(target)
else:
for target in sys.stdin.readlines():
t = target.strip()
if target == '\n':
usage()
main(t)