-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathdorker.py
138 lines (119 loc) · 3.1 KB
/
dorker.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
import argparse
import sys
from helium import *
import time
import os
prev_url = -1
final = []
driver = -1
def banner():
print("""
______ ___________ _ __ ___________
| _ \ _ | ___ \ | / /| ___| ___ |
| | | | | | | |_/ / |/ / | |__ | |_/ /
| | | | | | | /| \ | __|| /
| |/ /\ \_/ / |\ \| |\ \| |___| |\ \
|___/ \___/\_| \_\_| \_/\____/\_| \_|
Created by @0xdln and @0xrj
""")
def parser_error(self):
banner()
print("Usage: python " + sys.argv[0] + " [Options] use -h for help")
sys.exit()
def parse_args():
parser = argparse.ArgumentParser(epilog='\tExample: \r\npython ' + sys.argv[0] + " -d 'THE-DORK-YOU-WANT'")
parser.error = parser_error
parser._optionals.title = "OPTIONS"
parser.add_argument('-f', '--dorkfile', required=False)
parser.add_argument('-d', '--dork', required=False)
parser.add_argument('-o', '--output', required=False)
args = parser.parse_args()
return args
def input_(dork):
helium.write(dork)
helium.press(ENTER)
time.sleep(2)
def re_enter():
global prev_url
global driver
driver = helium.start_firefox(headless=True)
time.sleep(5)
go_to(prev_url)
flow()
def urlExtract():
global final
urls = helium.find_all(S('.yuRUbf'))
url = [i.web_element.find_element_by_tag_name('a').get_attribute('href') for i in urls]
if (url == []):
kill_browser()
re_enter()
url = clean(url)
final.extend(url)
def pages():
global driver
global prev_url
while True:
try:
prev_url = driver.current_url
helium.scroll_down(num_pixels=100000)
helium.click('Next')
time.sleep(2)
urlExtract()
except:
break
def clean(li):
li = set(li)
return list(li)
def flow():
urlExtract()
time.sleep(2)
pages()
try:
kill_browser()
except:
pass
def exechaha(args,dorks):
global driver
if(args.dorkfile):
with open(dorks) as f:
while True:
line = f.readline()
if not line:
break
else:
driver = helium.start_firefox(headless=True)
go_to('www.google.com')
input_(line)
time.sleep(5)
flow()
else:
line = args.dork
driver = helium.start_firefox(headless=True)
time.sleep(5)
go_to('www.google.com')
input_(line)
time.sleep(5)
flow()
def main():
banner()
global final
args = parse_args()
dorks = args.dorkfile
exechaha(args,dorks)
if(args.output):
file1 = open(args.output, 'w')
for i in clean(final):
file1.write(i.strip()+'\n')
file1.close()
else:
for i in clean(final):
print(i)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print('\n[ERR]: Interrupted')
try:
sys.exit(0)
except SystemExit:
os._exit(0)