summaryrefslogtreecommitdiff
path: root/netforge.py
diff options
context:
space:
mode:
authorgigagamerchaddhruv-spec <gigagamerchaddhruv@gmail.com>2026-05-02 20:50:17 +0530
committerGitHub <noreply@github.com>2026-05-02 20:50:17 +0530
commit47d8deaa5feac22a0509838d11cba9e26d8e946d (patch)
tree297550baaf05eb69970f7c8b970579c3f3a579d1 /netforge.py
parent7203cbf9930f98ec485d465ff814d98d71a533f6 (diff)
Add network scanner GUI application
Diffstat (limited to 'netforge.py')
-rw-r--r--netforge.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/netforge.py b/netforge.py
new file mode 100644
index 0000000..803f741
--- /dev/null
+++ b/netforge.py
@@ -0,0 +1,77 @@
+import socket
+import ipaddress
+import threading
+import tkinter as tk
+from tkinter import scrolledtext
+
+# =========================
+# CONFIG
+# =========================
+
+NETWORK = "192.168.1.0/24"
+
+# =========================
+# CORE SCANNER
+# =========================
+
+def is_host_up(ip):
+ try:
+ socket.create_connection((str(ip), 80), timeout=0.3)
+ return True
+ except:
+ return False
+
+
+def scan_network(output_box):
+ output_box.insert(tk.END, f"Scanning {NETWORK}...\n\n")
+
+ net = ipaddress.ip_network(NETWORK, strict=False)
+
+ for ip in net.hosts():
+
+ if is_host_up(ip):
+ msg = f"[+] Device found: {ip}\n"
+ output_box.insert(tk.END, msg)
+ output_box.see(tk.END)
+
+ output_box.insert(tk.END, "\nScan complete.\n")
+
+
+# =========================
+# GUI LOGIC
+# =========================
+
+def start_scan(output_box):
+ thread = threading.Thread(target=scan_network, args=(output_box,))
+ thread.daemon = True
+ thread.start()
+
+
+def build_gui():
+ window = tk.Tk()
+ window.title("NetForge - Network Scanner")
+ window.geometry("600x400")
+
+ title = tk.Label(window, text="NetForge", font=("Arial", 18))
+ title.pack(pady=10)
+
+ scan_btn = tk.Button(
+ window,
+ text="Scan Network",
+ font=("Arial", 12),
+ command=lambda: start_scan(output_box)
+ )
+ scan_btn.pack(pady=10)
+
+ output_box = scrolledtext.ScrolledText(window, width=70, height=15)
+ output_box.pack(padx=10, pady=10)
+
+ window.mainloop()
+
+
+# =========================
+# RUN
+# =========================
+
+if __name__ == "__main__":
+ build_gui()