Double clicking the IP now opens and logs into the machine with default browser.

This commit is contained in:
Tristan Smith 2024-05-31 10:31:39 -04:00
parent 7fceebc82e
commit e7306eeb56

16
gui.py
View file

@ -1,12 +1,18 @@
import tkinter as tk import tkinter as tk
from tkinter import ttk, filedialog from tkinter import ttk, filedialog
from scapy.all import IP, UDP, Ether, sniff from scapy.all import IP, UDP, Ether, sniff
import webbrowser
# Define the destination IP address and UDP ports to filter # Define the destination IP address and UDP ports to filter
destination_ip = '255.255.255.255' # Destination IP address destination_ip = '255.255.255.255' # Destination IP address
source_port = 14236 # Source port source_port = 14236 # Source port
destination_port = 14235 # Destination port destination_port = 14235 # Destination port
# Username and password for the miners
# Adjust accordingly for appropriate credentials
username = "root"
password = "root"
# Function to extract packet information and display it in the tree view # Function to extract packet information and display it in the tree view
def extract_packet_info(packet): def extract_packet_info(packet):
# Check if the packet is an IP packet with UDP layer # Check if the packet is an IP packet with UDP layer
@ -58,6 +64,13 @@ def export_data():
file.write(f"IP Address: {row[0]}, MAC Address: {row[1]}\n") file.write(f"IP Address: {row[0]}, MAC Address: {row[1]}\n")
status_label.config(text=f"Data exported to {file_path}") status_label.config(text=f"Data exported to {file_path}")
# Function to open the IP address in the default web browser with credentials
def open_in_browser(event):
item = tree.selection()[0]
ip_address = tree.item(item, "values")[0]
url = f"http://{username}:{password}@{ip_address}"
webbrowser.open(url)
# Create the main window # Create the main window
root = tk.Tk() root = tk.Tk()
root.title("IP Reporter") root.title("IP Reporter")
@ -73,6 +86,9 @@ tree.heading("IP Address", text="IP Address")
tree.heading("MAC Address", text="MAC Address") tree.heading("MAC Address", text="MAC Address")
tree.pack(fill=tk.BOTH, expand=True) tree.pack(fill=tk.BOTH, expand=True)
# Bind double click to open in browser
tree.bind("<Double-1>", open_in_browser)
# Create a start button # Create a start button
start_button = tk.Button(root, text="Start", command=toggle_listening) start_button = tk.Button(root, text="Start", command=toggle_listening)
start_button.pack(pady=5) start_button.pack(pady=5)