forked from KingOfBugbounty/Discovery-Header-Bug-Bounty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchHEADER.py
44 lines (35 loc) · 1.24 KB
/
searchHEADER.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
# Search Headers DoD Priv8
# @OFJAAAH & @wellpunk
# Script Server Banner
import requests
from colorama import Fore, Style
import sys
import argparse
# Parser
parser = argparse.ArgumentParser()
parser.add_argument(
"help", help="Run to code = python3 searchHEADER.py FileToUrls ")
args = parser.parse_args()
def headersURL():
with open(file, 'r') as arquivo:
dominios = arquivo.read().split('\n')[:-1]
with open('results.txt', 'w') as fp:
for url in dominios:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"}
try:
r = requests.get(url, headers=headers)
print(
f"{Fore.RED}{r.headers['server'] if r.headers['server'] else 'none'}{Style.RESET_ALL}:{url}")
fp.write(
f"{r.headers['server'] if r.headers['server'] else 'none'}:{url}\n")
except:
pass
if __name__ == "__main__":
try:
file = sys.argv[1]
headersURL()
except Exception as e:
print(
f"{Fore.RED}[!]{Style.RESET_ALL} Please pass a file with url's as argument")
exit(-1)