import gradio as gr import subprocess # scapy انسٹال کریں (اگر موجود نہیں) subprocess.run(["pip", "install", "scapy"], check=False) import scapy.all as scapy def get_ip_info(target): try: arp_req = scapy.ARP(pdst=target) broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff") arp_req_broadcast = broadcast / arp_req answered = scapy.srp(arp_req_broadcast, timeout=3, verbose=False)[0] result = [] for sent, received in answered: result.append({"IP": received.psrc, "MAC": received.hwsrc}) if not result: return "⚠️ کوئی ڈیوائس نہیں ملی۔ براہ کرم درست IP Range دیں۔" return result except Exception as e: return f"❌ Error: {e}" iface = gr.Interface( fn=get_ip_info, inputs=gr.Textbox(label="Enter IP Range (مثلاً 192.168.1.1/24)"), outputs="json", title="🔍 Network Scanner using Scapy", description="یہ ایپ Scapy کا استعمال کرتے ہوئے IP addresses اور MACs اسکین کرتی ہے۔" ) if __name__ == "__main__": iface.launch()