Skip to content
This repository was archived by the owner on Apr 17, 2021. It is now read-only.

Commit 26b3f02

Browse files
committed
WIP: dorking :)
1 parent bc049ee commit 26b3f02

File tree

7 files changed

+134
-14
lines changed

7 files changed

+134
-14
lines changed

.gitmodules

+9
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@
44
[submodule "sqlmap"]
55
path = sqlmap
66
url = https://github.com/sqlmapproject/sqlmap
7+
[submodule "dorks"]
8+
path = dorks
9+
url = https://github.com/USSCltd/dorks
10+
[submodule "googler"]
11+
path = googler
12+
url = https://github.com/jarun/googler
13+
[submodule "ddgr"]
14+
path = ddgr
15+
url = https://github.com/jarun/ddgr

ddgr

Submodule ddgr added at b18c6fc

googler

Submodule googler added at 93dc6c2

install.sh

+1-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# And also chmod things up
66
pip install -r DorkNet/requirements.txt
77
pip install -r WhatWaf/requirements.txt
8+
pip install -r requirements.txt
89

910
echo ""
1011
echo "----------------------------"
@@ -18,13 +19,3 @@ echo "running chmod +x on *.py ..."
1819
chmod +x DorkNet/dorknet.py
1920
chmod +x WhatWaf/WhatWaf.py
2021
chmod +x sqlmap/sqlmap.py
21-
22-
# installation of geckodriver
23-
24-
echo "installing geckodriver..."
25-
# since we are pretty dumb as a shell programmer, just bulkly launch install commands with sudo privileges
26-
echo "Don't mind if there are errors, that's ok. You should get two of them"
27-
echo "If you're on macOS make sure that brew is in your PATH"
28-
sudo pacman -S geckodriver
29-
sudo apt-get install geckodriver
30-
brew install geckodriver

main.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
#!/usr/bin/env python3
2+
import argparse
3+
24
from src import log
5+
from src import findDorks
6+
7+
def search_dork(dork):
8+
return findDorks.dorkLines(([dork]))
39

4-
def DorkNet(dork):
5-
10+
def define_arguments():
11+
parser = argparse.ArgumentParser(
12+
usage="python autosqli.py [-d DORK] [-f DORKFILE]"
13+
)
14+
f = parser.add_argument_group("Files", "parameters relative to file manipulation")
615

16+
f.add_argument("-f", "--dork-file", metavar="dorkfile.txt", dest=dorkfile, help="if you already dorked, set a file where your dorks are contained ( one dork per line )")
717

818
def main():
9-
log.debug("Test to get some urls out of DorkNet")
10-
log.info(DorkNet("chaton mignon"))
19+
log.info("Welcome into AutoSQLi !")
20+
log.info("Enter a dork:")
21+
dork = input("dork: ")
22+
url_to_test = search_dork(dork)
1123

1224
if __name__ == "__main__":
1325
main()

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
argparse

src/findDorks.py

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env python3
2+
3+
# From jesuiscamille, and a part of the AutoSQLi project
4+
# Not the best piece of code I ever made, but do the job pretty well
5+
# I should do some adjustement on the ddgr and googler path thing
6+
# you should see a dorkoutput.txt file sitting on your $(pwd) after running this :)
7+
import subprocess
8+
import json
9+
import time
10+
11+
# here is the path thing
12+
ddgr_path = "ddgr/ddgr"
13+
googler_path = "googler/googler"
14+
15+
def main():
16+
filename = input("Enter your dork file name: ")
17+
print("Reading " + filename + " ...")
18+
# filename = "testdorks.txt"
19+
dorkFromFile(filename)
20+
21+
def dorkFromFile(filename):
22+
f = open(filename, 'r')
23+
lines = f.readlines() # read all the lines of the file into 'lines'
24+
f.close()
25+
dorkLines(lines)
26+
27+
def dorkLines(lines):
28+
# remove annoying trailing characters
29+
google_ban = False
30+
duck_ban = False
31+
32+
index = 0
33+
for i in lines:
34+
lines[index] = lines[index].rstrip()
35+
index += 1
36+
37+
results = []
38+
# dorking !
39+
for dork in lines:
40+
if google_ban == True and duck_ban == True:
41+
break
42+
43+
print(" |__ dork: " + dork)
44+
# dorking with google and writing to file
45+
if not google_ban:
46+
print(" |__ googly dorking...")
47+
result = googleSearch(dork)
48+
try:
49+
result_clean = json.loads(result)
50+
except:
51+
google_ban = True
52+
print("Google banned us, but don't worry, it's temporary")
53+
for x in result_clean:
54+
url = x['url']
55+
writeToFile(url)
56+
results.append(url)
57+
58+
if not duck_ban:
59+
print(" |__ ducky dorking...")
60+
result = duckSearch(dork)
61+
try:
62+
result_clean = json.loads(result)
63+
except:
64+
duck_ban = True
65+
print("DuckduckGo banned us, but don't worry, it's temporary")
66+
67+
for x in result_clean:
68+
url = x['url']
69+
writeToFile(url)
70+
results.append(url)
71+
72+
# waiting 15 seconds to not get caught
73+
print(" -- waiting 15 seconds --")
74+
time.sleep(15)
75+
76+
print("check out ./dorkoutput.txt :3")
77+
print("Thx 4 d0rk1ng ! Have fun")
78+
return results
79+
80+
81+
def execute(command):
82+
""" command shall be an array """
83+
""" returns the stdout of command """
84+
result = subprocess.run(command, stdout=subprocess.PIPE)
85+
return result.stdout.decode('utf-8')
86+
87+
def googleSearch(dork):
88+
""" dork shall be a string which contains... a dork. """
89+
""" returns the google json response for the specified dork """
90+
return execute([googler_path, "-n", "100", dork, "--noprompt", "--json"])
91+
92+
def duckSearch(dork):
93+
""" dork shall be a string which contains... a dork. """
94+
""" returns the duckduckgo json response for the specified dork """
95+
return execute([ddgr_path, dork, "--unsafe", "--json", "--np", "--num", "25"])
96+
97+
def writeToFile(text):
98+
""" write text to dorkoutput.txt """
99+
output = open("dorkoutput.txt", 'a')
100+
output.write(text)
101+
output.write('\n')
102+
output.close()
103+
104+
if __name__ == "__main__":
105+
main()

0 commit comments

Comments
 (0)