-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscopy.py
150 lines (124 loc) · 4.78 KB
/
scopy.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import sys
import warnings
import requests
import time
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
class colours:
HEADER = "\033[95m"
COLOUR1 = "\033[94m"
COLOUR2 = "\033[35m"
WARNING = "\033[93m"
FAIL = "\033[91m"
ENDC = "\033[0m"
if sys.version_info < (3, 0):
sys.stdout.write(f"{colours.FAIL}[+] Sorry, this tool only works with Python 3.X\n{colours.ENDC}")
exit()
class printText:
ascii = f"""{colours.HEADER} ____ ____ ____ ___ _ _
[__ | | | |__] \_/
___] |___ |__| | | ᴍᴀᴅᴇ ʙʏ ᴀʟᴘʜᴀʀᴀᴏʜ{colours.ENDC}
"""
help = f""" ____ ____ ____ ___ _ _
[__ | | | |__] \_/
___] |___ |__| | | ᴍᴀᴅᴇ ʙʏ ᴀʟᴘʜᴀʀᴀᴏʜ
Usage: scopy.py [-n NAME] [-o] [-t TIME] [...]
Optional Args:
-h Displays this message
-n NAME(s) Name of program (hackerone.com/NAME)
-n NAME,NAME1,NAME2 (Make sure to have no spaces between , )
-o Output only results
-t TIME Time to allow javascript to load (Default: 4)
-s Add "https://" to scopes
"""
class main:
def __init__(self):
self.ttime = 4
self.show_visuals = True
self.show_http = False
self.programs = []
warnings.filterwarnings("ignore", category=DeprecationWarning)
def validation(self): #Validate input and program availability
for i in range(len(sys.argv)):
if sys.argv[i] == "-o":
self.show_visuals = False
elif sys.argv[i] == "-h":
print(printText.help)
exit()
elif sys.argv[i] == "-t":
if sys.argv[i+1] not in ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"]:
print(f"{colours.FAIL}[+] Error: Need valid time between 1-15s{colours.ENDC}")
exit()
else:
if sys.argv[i+1] in ["1","2","3"]:
print(f"{colours.WARNING}[+] Warning: Lower time may result in failure to load scopes{colours.ENDC}")
self.ttime = sys.argv[i+1]
elif sys.argv[i] == "-s":
self.show_http = True
elif sys.argv[i] == "-n":
try:
self.programs = (sys.argv[i+1]).split(",")
except:
print(f"{colours.FAIL}[+] Error: Name not specified{colours.ENDC}")
exit()
if self.show_visuals:
print(printText.ascii)
self.ttime = int(self.ttime)
self.ttime /= 2
if len(sys.argv) > 1:
try:
site = requests.get(f'https://hackerone.com/{self.programs[0]}')
if (site.status_code) != 200:
print(f"{colours.FAIL}[+] Error: Program(s) not found{colours.ENDC}")
exit()
except:
print(f"{colours.FAIL}[+] Error: Something went wrong {colours.ENDC}")
else:
print(f"{colours.FAIL}[+] Error: Missing argument {colours.ENDC}")
exit()
#Validated
self.run()
def run(self):
for j in self.programs:
if self.show_visuals:
print(f"{colours.COLOUR2}[+] Gathering data for {j}...{colours.ENDC}")
site = f"https://hackerone.com/{j}"
###################################################################################################
path = "/home/USER/Documents/chromedriver" #Please change chrome driver location
###################################################################################################
chrome_options = Options()
chrome_options.add_argument("--headless")
try:
driver = webdriver.Chrome(path, options=chrome_options)
except:
print(f"{colours.FAIL}[+] Error: Check if chrome driver path is changed in scopy.py {colours.ENDC}")
exit()
driver.get(site)
## 4s threshhold
time.sleep(self.ttime) #Allow javascript to load
if self.show_visuals:
print(f"{colours.COLOUR2}[+] Loading data...{colours.ENDC}")
time.sleep(self.ttime)
##
try:
scopes=[]
scopes = driver.find_elements_by_xpath("//td[@class='daisy-table__cell table__row--align-top break-word']/div/span/strong")
if self.show_visuals:
print(f"{colours.COLOUR1}[+] {len(scopes)} scopes found.{colours.ENDC}")
if len(scopes) <= 0:
print(f"{colours.FAIL}[+] Error: Failed to load scopes{colours.ENDC}")
for i in scopes:
tmp = i.text
tmp = tmp.replace("*.", "")
if " " in tmp:
pass
elif self.show_http:
print(f"https://{tmp}")
else:
print(tmp)
except Exception as e:
print(f"{colours.FAIL}[+] Error: {e}{colours.ENDC}")
print(f"{colours.WARNING}[+] Try: Increase threshhold time{colours.ENDC}")
main().validation()