Spaces:
Runtime error
Runtime error
Rename runtime.txt to 1app.py
Browse files- 1app.py +36 -0
- runtime.txt +0 -1
1app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
# scapy انسٹال کریں (اگر موجود نہیں)
|
| 5 |
+
subprocess.run(["pip", "install", "scapy"], check=False)
|
| 6 |
+
|
| 7 |
+
import scapy.all as scapy
|
| 8 |
+
|
| 9 |
+
def get_ip_info(target):
|
| 10 |
+
try:
|
| 11 |
+
arp_req = scapy.ARP(pdst=target)
|
| 12 |
+
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
|
| 13 |
+
arp_req_broadcast = broadcast / arp_req
|
| 14 |
+
answered = scapy.srp(arp_req_broadcast, timeout=3, verbose=False)[0]
|
| 15 |
+
|
| 16 |
+
result = []
|
| 17 |
+
for sent, received in answered:
|
| 18 |
+
result.append({"IP": received.psrc, "MAC": received.hwsrc})
|
| 19 |
+
|
| 20 |
+
if not result:
|
| 21 |
+
return "⚠️ کوئی ڈیوائس نہیں ملی۔ براہ کرم درست IP Range دیں۔"
|
| 22 |
+
|
| 23 |
+
return result
|
| 24 |
+
except Exception as e:
|
| 25 |
+
return f"❌ Error: {e}"
|
| 26 |
+
|
| 27 |
+
iface = gr.Interface(
|
| 28 |
+
fn=get_ip_info,
|
| 29 |
+
inputs=gr.Textbox(label="Enter IP Range (مثلاً 192.168.1.1/24)"),
|
| 30 |
+
outputs="json",
|
| 31 |
+
title="🔍 Network Scanner using Scapy",
|
| 32 |
+
description="یہ ایپ Scapy کا استعمال کرتے ہوئے IP addresses اور MACs اسکین کرتی ہے۔"
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
iface.launch()
|
runtime.txt
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
python-3.10
|
|
|
|
|
|