-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhosthdbrute.py
executable file
·46 lines (35 loc) · 980 Bytes
/
hosthdbrute.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
import requests
import argparse
import os
parser=argparse.ArgumentParser()
parser.add_argument('-u',help='Full Url',dest='url')
parser.add_argument('-he',help='Header File',dest='header_file')
argument=parser.parse_args()
url=argument.url
header_file=argument.header_file
headers = []
if header_file:
with open(header_file, 'r', encoding="utf8") as file:
for line in file:
headers.append(line.strip('\n'))
if url:
FinalResult=[]
for header in headers:
page = requests.get(url,header)
FinalResult.append(page.text)
print(*FinalResult,sep="\n\n")
testp='output/'
isFile = os.path.isfile(testp)
if not isFile:
try:
os.mkdir(testp)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
if url:
count = 0
for item in FinalResult:
count += 1
filename = testp+'{}.txt'.format(count)
with open(filename, 'w') as f:
f.write('{}\n'.format(item))