Repository navigation
Expand file tree
/
Copy pathtoolkit.py
More file actions
189 lines (142 loc) · 5.79 KB
/
Copy pathtoolkit.py
File metadata and controls
189 lines (142 loc) · 5.79 KB
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
#!/usr/bin/env python3
def run_directory_enumerator():
"""Prompt for inputs and enumerate directories"""
from tools.web.directory_enumerator import enumerate_directories
print("\n" + "=" * 50)
print(" Directory Enumeration")
print("=" * 50)
domain = input("\nEnter domain (E.g. http://example.com): ").strip()
wordlist_path = input("Enter path of directories wordlist: ").strip()
extension = input("Enter file optional extension (default is none): ").strip() or ""
result = enumerate_directories(domain, wordlist_path, extension)
print(f"\n[*] Enumeration complete!")
print(f"[*] Found {len(result)} directory(ies)\n")
def run_subdomain_enumerator():
"""Prompt for inputs and enumerate subdomains"""
from tools.web.subdomain_enumerator import enumerate_subdomains
print("\n" + "=" * 50)
print(" Subdomain Enumeration")
print("=" * 50)
domain = input("\nEnter domain: ").strip()
wordlist_path = input("Enter path of subdomains wordlist: ").strip()
urls = enumerate_subdomains(domain, wordlist_path)
print(f"\n[*] Enumeration complete!")
print(f"[*] Found {len(urls)} subdomain(s)\n")
def run_file_downloader():
"""Prompt for a URL or a file containing URLs and download"""
import os
from tools.web.file_downloader import download_urls_from_list, download_url
print("\n" + "=" * 50)
print(" File Downloader")
print("=" * 50)
target = input("\nEnter URL or path to file with URLs: ").strip()
if os.path.isfile(target):
save_dir = input("Enter save directory (leave empty to use Downloads): ").strip() or "Downloads"
download_urls_from_list(url_list_path=target, save_dir=save_dir)
else:
save_name = input("Enter save filename (leave empty to use URL filename): ").strip() or None
if not save_name:
save_name = target.split("/")[-1] or "downloaded_file"
download_url(target, save_name)
print()
def run_port_scanner():
"""Prompt for host and port range, then scan ports"""
from tools.network.port_scanner import resolve_host, scan_ports
print("\n" + "=" * 50)
print(" Port Scanner")
print("=" * 50)
hostname = input("\nEnter hostname or IP: ").strip()
max_port_input = input("Enter max port to scan (default 1024): ").strip() or None
max_port = int(max_port_input) if max_port_input else 1024
target = resolve_host(hostname)
if not target:
return
print(f"\n[*] Scanning {target}, ports 1 --> {max_port}...")
open_ports = scan_ports(target, range(1, max_port + 1))
print()
def run_arp_scanner():
"""Prompt for IP range and interface, then run ARP scan"""
from tools.network.arp_scanner import scan_arp_hosts
print("\n" + "=" * 50)
print(" ARP Scanner")
print("=" * 50)
ip_range =input("\nEnter IP range (e.g. 192.168.1.0/24): ").strip()
interface =input("Enter interface (default eth0): ").strip() or "eth0"
print(f"\n[*] Scanning {ip_range} on interface {interface}...")
alive_hosts = scan_arp_hosts(ip_range=ip_range, interface=interface)
if alive_hosts:
print(f"\n[+] Found {len(alive_hosts)} host(s):")
for ip, mac in alive_hosts:
print(f" {ip:<20} {mac}")
else:
print("\n[-] No hosts found")
print()
def run_ssh_bruteforcer():
"""Prompt for SSH bruteforce parameters and run the attack"""
from tools.auth.ssh_bruteforcer import brute_force_ssh_password
print("\n" + "=" * 50)
print(" SSH Brute Force")
print("=" * 50)
target = input("\nEnter target hostname or IP: ").strip()
username = input("Enter username: ").strip()
wordlist = input("Enter path to password wordlist: ").strip()
port_input = input("Enter port (default 22): ").strip() or None
port = int(port_input) if port_input else 22
password = brute_force_ssh_password(target, username, wordlist, port)
if password:
print(f"\n[+] Found credentials: {username}:{password}\n")
else:
print("\n[-] Couldn't find credentials\n")
def run_password_hash_cracker():
"""Prompt for hash, wordlist and algorithm and attempt to crack"""
from tools.crypto.password_hash_cracker import crack_password_hash
print("\n" + "=" * 50)
print(" Password Hash Cracker")
print("=" * 50)
target_hash = input("\nEnter target hash: ").strip()
wordlist = input("Enter path to wordlist: ").strip()
alg = input("Enter algorithm (default md5): ").strip() or "md5"
res = crack_password_hash(target_hash, wordlist, alg)
if res:
print(f"\n[+] Hash cracked successfully!")
print(f"[+] Plaintext: {res}\n")
else:
print("\n[-] Couldn't crack hash\n")
def show_menu():
"""Display the toolkit menu."""
print("\n" + "=" * 40)
print(" Python Pentester Toolkit")
print("=" * 40)
print(" 1. Directory Enumeration")
print(" 2. Subdomain Enumeration")
print(" 3. File Downloader")
print(" 4. Port Scan")
print(" 5. ARP Scan")
print(" 6. SSH Brute Force")
print(" 7. Password Hash Cracker")
print(" 8. Exit")
print("=" * 40)
# ----- Main loop -----
def main():
actions = {
"1": run_directory_enumerator,
"2": run_subdomain_enumerator,
"3": run_file_downloader,
"4": run_port_scanner,
"5": run_arp_scanner,
"6": run_ssh_bruteforcer,
"7": run_password_hash_cracker,
}
while True:
show_menu()
choice = input("\nSelect an option: ").strip()
if choice == "8":
print("\n[*] Exiting toolkit. Goodbye.")
break
elif choice in actions:
print()
actions[choice]()
else:
print("[!] Invalid option. Enter 1-8.")
if __name__ == "__main__":
main()