-
Notifications
You must be signed in to change notification settings - Fork 20
/
evildork.py
224 lines (171 loc) · 5.37 KB
/
evildork.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#
# Fricciolosa Red Team presents:
# _ _ _ _
# _____ _(_) | __| | ___ _ __| | __
# / _ \ \ / / | |/ _` |/ _ \| '__| |/ /
# | __/\ V /| | | (_| | (_) | | | <
# \___| \_/ |_|_|\__,_|\___/|_| |_|\_\
#
# Targeting your fiancee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
#
# @Repository: https://github.com/Fricciolosa-Red-Team/evildork
#
# @Author: Fricciolosa Red Team
# ======= IMPORT =========
import argparse
import os
import urllib.parse
# ======= INTRO ========
def banner():
RED = "\033[91m"
ENDC = "\033[0m"
banner = (
RED
+ """ _ _ _ _
_____ _(_) | __| | ___ _ __| | __
/ _ \\ \\ / / | |/ _` |/ _ \\| '__| |/ /
| __/\\ V /| | | (_| | (_) | | | <
\\___| \\_/ |_|_|\\__,_|\\___/|_| |_|\\_\\
"""
+ ENDC
)
print(banner)
print(" by Fricciolosa Red Team")
print()
# ======= GLOBAL VARS ========
dorks_file = "dorks.txt"
# ======= ARGUMENT ========
def get_parser():
"""Create and return a parser (argparse.ArgumentParser instance) for main()
to use"""
parser = argparse.ArgumentParser(description="Evildork targeting your fiancee")
target = parser.add_mutually_exclusive_group()
target.add_argument(
"-d",
"--domain",
type=str,
help="Set the target (a domain)",
)
parser.add_argument(
"-s",
"--subdomain",
action="store_true",
help="Search also for subdomains",
)
target.add_argument(
"-t",
"--target",
type=str,
help="Set the target (general)",
)
parser.add_argument(
"-v", "--version", action="store_true", help="Show the version of evildork"
)
return parser
# ======== FUNCTIONS =======
def create_output_folder(directory):
if not os.path.exists(directory):
os.makedirs(directory)
def create_output_file(directory, target):
create_output_folder(directory)
target = target.replace(" ", "-")
filename = directory + "/" + "evildork-" + target + ".html"
if os.path.exists(filename):
choice = input(
"[!] {} already exists. Do you want to overwrite? (y/n):".format(filename)
)
if str(choice).lower() != "y":
exit(1)
# if choice == y: ====> go forward. The file's content will be flushed and overwritten
else:
os.mknod(filename)
return filename
def add_HTML_banner(filename):
html_banner = """
<html>
<head>
<link rel="stylesheet" href="../style.css">
<title> EVILDORK </title>
</head>
<body>
<div class="topnav">
<a href="https://github.com/Fricciolosa-Red-Team">Fricciolosa Red Team</a>
<a href="https://github.com/Fricciolosa-Red-Team/evildork">Contribute to evildork</a>
</div>
<h1 class="evildork">EVILDORK</h1>
<h3 class="fricciolosa">by Fricciolosa Red Team </h3>
<ul>
"""
with open(filename, "w+") as f:
f.write(html_banner)
def add_HTML_footer(filename):
html_banner = """
</ul>
<div class="footer">
<p>evildork by <a href='https://github.com/Fricciolosa-Red-Team'>Fricciolosa Red Team</a></p>
</div>
<br><br><br><br><br><br><br><br>
</body>
</html>
"""
with open(filename, "a+") as f:
f.write(html_banner)
def add_dorks(target, filename, type_target):
if type_target == "domain":
dorks_file = "dorks-domain.txt"
else:
dorks_file = "dorks-target.txt"
with open(dorks_file, "r") as f:
text = f.readlines()
with open(filename, "a") as f:
if type_target == "domain":
for elem in text:
f.write("<li>" + encode(elem + " site:" + target) + "</li>\n")
else:
for elem in text:
f.write("<li>" + encode(elem + " " + target) + "</li>\n")
def encode(search):
base_url = "https://www.google.com/search?q="
result = base_url + urllib.parse.quote(search)
final = "<a href='" + result + "' target='_blank'>" + search + "</a>"
return final
def start_dorking(target, subdomain, type_target):
directory = "output-evildork"
if subdomain:
target = "*." + target
filename = create_output_file(directory, target)
add_HTML_banner(filename)
add_dorks(target, filename, type_target)
add_HTML_footer(filename)
command = "xdg-open " + filename
os.system(command)
def version():
print("v0.1")
def main():
banner()
parser = get_parser()
args = parser.parse_args()
if args.version:
version()
elif args.domain:
start_dorking(args.domain, args.subdomain, "domain")
elif args.target:
start_dorking(args.target, False, "target")
else:
parser.print_help()
if __name__ == "__main__":
main()