-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprofiler.py
executable file
·166 lines (145 loc) · 6.05 KB
/
profiler.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
"""
Title: profiler
Author: Mădălin Dogaru
Discord: techblade.
Date: 25-03-2023
Version: v0.1
License: GPLv3
Description: A Red Teaming tool focused on profiling the target.
"""
from colored_argument_parser import ColoredArgumentParser
from email_generator import EmailGenerator
from url_scanner import URLScanner
from ip_info import IPInfo
from domain_info import DomainInfo
from termcolor import colored
from godaddy_search import query_similar_domains
from dorks_search import google_dork
from holehe import EmailProfiler, EmailProfilerCSV
from username_search import UsernameProfiler
# Function for parsing command line arguments
def parse_arguments():
parser = ColoredArgumentParser(description='Get IP information and save to a file.')
parser.add_argument('-iplist', help='Specify a file with IPs, 1 per line, to get their COUNTRY|CITY|AREA.')
parser.add_argument('-ip', help='Specify an IP to get its COUNTRY|CITY|AREA.')
parser.add_argument('-d', '--domain', help='Specify a Domain to get its IP|COUNTRY|CITY|AREA.')
parser.add_argument('-dlist', help='Specify a file with Domains, 1 per line, to get their IP|COUNTRY|CITY|AREA.')
parser.add_argument('-url', help='Specify a folder path to get all URLs inside its files')
parser.add_argument('-o', '--output-file', help='Name of the output file.')
parser.add_argument('-egen', help='Path to the file containing the firstname and lastname pairs.')
parser.add_argument('-edom', help='Specify a domain name to be combined with the names specified with -egen')
parser.add_argument('-daddy', help='Specify a domain and get other available domain suffixes on GoDaddy.com.')
parser.add_argument('-domphish', help='Search for similarly looking domains for a user supplied domain.')
parser.add_argument('-dork', help='Specify a domain name for Google Dork search.')
parser.add_argument('-f', help='Specify a file containing Google dorks (one per line).')
parser.add_argument('-mails', help='Specify a file containing the emails to be profiled.')
parser.add_argument('-om', '--format-csv', help='Output mails results in CSV format')
parser.add_argument('-u', '--username', help='Username to search')
parser.add_argument('-v', '--verbose', help='Verbose mode, display errors', action='store_true')
parser.add_argument('-be', '--binary-edge', type=str, help='The target IP address for the BinaryEdge API.')
return parser.parse_args()
# Function for processing URL scans
def process_url_scan(folder_path, output_handle):
scanner = URLScanner(folder_path)
urls = scanner.scan_folder()
for url in urls:
print(url)
if output_handle:
output_handle.write(url + "\n")
output_handle.flush()
# Main function for handling command line arguments and processing input
def main():
args = parse_arguments()
input_file = args.iplist
single_ip = args.ip
domain = args.domain
domain_list = args.dlist
folder_path = args.url
output_file = args.output_file
firstname_lastname_list = args.egen
email_domain = args.edom
gdork_domain = args.dork
gdork_file = args.f
email_file = args.mails
format_csv = args.format_csv
username = args.username
verbose = args.verbose
binary_edge_ip = args.binary_edge
output_handle = open(output_file, "w") if output_file else None
if args.domphish:
# Define the character replacements here
replacements = {
'o': '0',
'0': 'o',
'i': 'l',
'l': 'i',
'g': 'q',
'q': 'g',
'm': 'n',
'n': 'm',
'u': 'v',
'v': 'u',
'1': 'l',
'l': '1',
}
query_similar_domains(args.domphish, replacements)
return
if firstname_lastname_list and email_domain:
email_generator = EmailGenerator(firstname_lastname_list, email_domain)
email_generator.process_name_list(output_handle)
return
elif input_file:
ip_info = IPInfo(output_handle)
ip_info.process_ip_list(input_file)
elif domain_list:
domain_info = DomainInfo(output_handle)
domain_info.process_domain_list(domain_list)
elif single_ip:
ip_info = IPInfo(output_handle)
result = ip_info.get_ip_info(single_ip)
if result:
print(result)
if output_handle:
output_handle.write(result + "\n")
output_handle.flush()
elif domain:
domain_info = DomainInfo(output_handle)
ip = domain_info.get_domain_ip(domain)
if ip:
ip_info = IPInfo(output_handle)
result = ip_info.get_ip_info(ip)
if result:
print(result)
if output_handle:
output_handle.write(result + "\n")
output_handle.flush()
elif folder_path:
process_url_scan(folder_path, output_handle)
elif username:
UsernameProfiler(username).run(verbose)
elif args.daddy:
query_similar_domains(args.daddy)
elif gdork_domain and gdork_file:
google_dork(gdork_domain, gdork_file)
elif binary_edge_ip:
from binaryedge import BinaryEdgeAPI
be_api = BinaryEdgeAPI('your_binary_edge_api_token') # replace with your actual token
host_details = be_api.get_host_details(binary_edge_ip)
formatted_data = be_api.format_data(host_details)
print(formatted_data)
if email_file:
if format_csv:
profiler = EmailProfilerCSV(email_file, format_csv)
profiler.profileCSV()
else:
profiler = EmailProfiler(email_file)
profiler.profile()
elif firstname_lastname_list and email_domain:
email_generator = EmailGenerator(firstname_lastname_list, email_domain)
email_generator.process_name_list(output_handle)
else:
print(colored("Go quickly to the help section (-h), you really screwed the pooch.", "yellow"))
if output_handle:
output_handle.close()
if __name__ == '__main__':
main()