-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcrawler.py
30 lines (25 loc) · 840 Bytes
/
crawler.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
import optparse
import requests
def discover_subdomains_and_urls(target):
subdomains = []
urls = []
def request(url):
try:
return requests.get("http://" + url)
except requests.exceptions.ConnectionError:
pass
with open("subdomains-wordlist.txt", "r") as wordlist:
for line in wordlist:
word = line.strip()
test_url = word + "." + target
response = request(test_url)
if response:
subdomains.append(test_url)
with open("files-and-dirs-wordlist.txt", "r") as wordlist:
for line in wordlist:
word = line.strip()
test_url = target + "/" + word
response = request(test_url)
if response:
urls.append(test_url)
return subdomains, urls