-
Notifications
You must be signed in to change notification settings - Fork 70
/
AutOSINT.py
executable file
·221 lines (177 loc) · 7.66 KB
/
AutOSINT.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
#!/usr/bin/env python
"""A tool to automate some OSINT tasks and put results into a docx report
By @arbitrary_code
https://github.com/bharshbarger/AutOSINT
Special thanks to:
@Beamr
@tatanus
unum alces!"""
#builtins
import argparse
import os
import re
import socket
import sys
import time
#AutOSINT module imports
from modules.whois import Whois
from modules.dnsquery import Dnsquery
from modules.hibp import Haveibeenpwned
from modules.googledork import Googledork
from modules.shodansearch import Shodansearch
from modules.pastebinscrape import Pastebinscrape
from modules.theharvester import Theharvester
from modules.credleaks import Credleaks
from modules.pyfoca import Pyfoca
from modules.webscrape import Scraper
from modules.reportgen import Reportgen
class Autosint(object):
"""autosint class"""
def __init__(self, args, parser):
"""start with arguments and parser objects"""
#import args and parser objects from argparse
self.args = args
self.parser = parser
#version
self.version = 'v2-09.19.17'
#defaults
self.lookup_list = []
self.client_name = None
self.autosint_db = 'AutOSINT.db'
self.report_directory = './reports/'
self.api_key_directory = './api_keys/'
self.databse_directory = './database/'
#module results lists
self.whois_result = []
self.dns_result = []
self.google_dork_result = []
self.shodan_query_result = []
self.pastebin_scrape_urls_result = []
self.pastebin_scrape_content_result = []
self.theharvester_module_result = []
self.scrape_result = []
self.cred_leak_search_result = []
self.pyfoca_module_result = []
self.haveibeenpwned_result = []
#start timer
self.start_time = time.time()
#module assign
self.cred_leaks_module = Credleaks()
self.pyfoca_module = Pyfoca()
self.web_scraper_module = Scraper()
self.theharvester_module = Theharvester()
self.dns_query_module = Dnsquery()
self.pastebin_scrape_module = Pastebinscrape()
self.shodan_search_module = Shodansearch()
self.google_dork_module = Googledork()
self.haveibeenpwned_api_module = Haveibeenpwned()
self.whois_query_module = Whois()
self.report_generator_module = Reportgen()
#check dirs
if not os.path.exists(self.report_directory):
os.makedirs(self.report_directory)
if not os.path.exists(self.api_key_directory):
os.makedirs(self.api_key_directory)
def clear(self):
"""clean up screen"""
os.system('cls' if os.name == 'nt' else 'clear')
def banner(self):
"""verbosity flag to print logo and args"""
if self.args.verbose is True:
print('''
_ _ ___ ____ ___ _ _ _____
/ \ _ _| |_ / _ \/ ___|_ _| \ | |_ _|
/ _ \| | | | __| | | \___ \| || \| | | |
/ ___ \ |_| | |_| |_| |___) | || |\ | | |
/_/ \_\__,_|\__|\___/|____/___|_| \_| |_|\n''')
if self.args.verbose is True:
print('AutOSINT.py {}: A way to automate various OSINT tasks and place results into a docx\n'.format(self.version))
if self.args.verbose is True:
print(self.args)
def check_arguments(self):
"""check local dirs for reports, apikey and database"""
#require at least one argument
if not (self.args.domain):
print('[-] No OSINT reference provided, add domain(s) with -d\n')
parser.print_help()
sys.exit(0)
#check to see if an ip or domain name was entered
if self.args.domain is not None:
for d in self.args.domain:
self.lookup_list = self.args.domain
for l in self.lookup_list:
if not os.path.exists(self.report_directory+l):
os.makedirs(self.report_directory+l)
if self.args.verbose is True:
print ('[+] Lookup Values: '+', '.join(self.lookup_list))
#check for a supplied client name and exit if none provided
if self.args.client is None:
print('\n[!] Client name required, please provide with -c <Clientname>\n')
parser.print_help()
sys.exit(0)
else:
#strip out specials in client name
self.client_name = re.sub('\W+', ' ', self.args.client).lower()
def run_queries(self):
"""invoke all the queries. assumption is that every run will want all data"""
#verified
self.whois_result = self.whois_query_module.run(self.args, self.lookup_list, self.report_directory)
#verified
self.dns_result = self.dns_query_module.run(self.args, self.lookup_list, self.report_directory)
#needs work
self.haveibeenpwned_result = self.haveibeenpwned_api_module.run(self.args, self.lookup_list, self.report_directory)
#verified
self.google_dork_result = self.google_dork_module.run(self.args, self.lookup_list, self.report_directory)
#verified
self.shodan_query_result = self.shodan_search_module.run(self.args, self.lookup_list, self.report_directory, self.api_key_directory)
#verified
self.pastebin_scrape_urls_result = self.pastebin_scrape_module.run(self.args, self.lookup_list, self.report_directory, self.api_key_directory)
#verified
self.theharvester_module_result = self.theharvester_module.run(self.args, self.lookup_list, self.report_directory)
self.cred_leak_search_result = self.cred_leaks_module.run(self.args, self.lookup_list, self.start_time, self.report_directory)
#needs work
self.scrape_result = self.web_scraper_module.run(self.args, self.lookup_list, self.report_directory, self.api_key_directory)
#pyfoca has to be present
self.pyfoca_module_result = self.pyfoca_module.run(self.args, self.lookup_list, self.report_directory)
def report(self):
"""run the docx report. text files happen in the respective functions"""
self.report_generator_module.run(\
self.args, \
self.report_directory, \
self.lookup_list, \
self.whois_result, \
self.dns_result, \
self.google_dork_result, \
self.shodan_query_result, \
self.pastebin_scrape_urls_result, \
self.theharvester_module_result, \
self.scrape_result, \
self.cred_leak_search_result, \
self.pyfoca_module_result)
def end(self):
"""ending stuff, right now just shows how long script took to run"""
print('\nCompleted in {:.2f} seconds\n'.format(time.time() - self.start_time))
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--client', \
metavar='FooCorp',\
help='The name you want to call target domain owner\'s name.')
parser.add_argument('-d', '--domain', \
metavar='foo.com', \
nargs=1, \
help='The Domain you want to search.')
parser.add_argument('-v', '--verbose', \
help='Verbosity option. Mainly just dumps all output to the screen.', \
action='store_true')
parser.add_argument('dorks', metavar='DORKS', type=str, nargs='+', help='user supplied dorks')
args = parser.parse_args()
#run functions with arguments passed
runAutosint = Autosint(args, parser)
runAutosint.clear()
runAutosint.banner()
runAutosint.check_arguments()
runAutosint.run_queries()
runAutosint.report()
runAutosint.end()
if __name__ == '__main__':
main()