def scan(sip, eip, ports=[], spoolsize=100, ppoolsize=100, t_c=5): global spool spool = Pool(spoolsize) portscanner.scan(sip, eip, ports=ports, poolsize=ppoolsize, callback=sscan, t_c=t_c) spool.join()
def run_app(): print('run') portscanner.open_ports = [] log_text.config(state=tk.NORMAL) scan_target = target_text.get() ports = portscanner.read_ports_from_file() results = portscanner.scan(ports, scan_target) log_text.insert(tk.END, 'Target: {}\n'.format(scan_target)) for port in results: log_text.insert(tk.END, 'Open port found: {}{}'.format(str(port), '\n'))
import portscanner ip = input("Enter your ip: ") portscanner.scan()
import portscanner ip = '192.168.50.128' portscanner.scan(ip)
def main(): global Server global Client global Ftps global Ftpd global Ps port=0 host="" path="" listener=0 open_port_list=[] argv=sys.argv[1:] if len(argv)==0: help() return try: opts,agr = getopt.getopt(argv,"l:p:i:o:O:zh",["port","ip","help"]) pass except getopt.error or ValueError as e: print(str(e)+"\n") help() return for o,a in opts: if o in ("-l"): listener=int(a) Server=True pass elif o in ("-p","--port"): port=a pass elif o in ("-i","--ip"): host=a pass elif o in ("-o",): path=a Ftps=True pass elif o in ("-O"): path=a Ftpd = True pass elif o in ("-z"): Ps=True pass elif o in ("-h","--help"): help() return pass if Server==True and ( Ftpd==True or Ftps == True or Ps== True): help() return elif Ftpd==True and (Server==True or Ftps == True or Ps== True): help() return elif Ftps==True and (Server==True or Ftpd==True or Ps== True): help() return elif Ps==True and (Server==True or Ftpd==True or Ftps == True): help() return if Server: Client=False try: port=int(port) pass except ValueError as e: print(str(e)) return pass TCPSERVER.CLS(port,listener) return elif Ftps: Client = False try: port = int(port) pass except ValueError as e: print(str(e)) return pass FTPSOURCE.ftpprep(host,port,path) return elif Ftpd: Client = False try: port = int(port) return pass except ValueError as e: print(str(e)) pass FTPDEST.ftpdest(port,path) return elif Ps: Client = False ports=["",""] i=0 for prt in port: if prt == "-": i+=1 pass else: ports[i]=ports[i]+prt open_port_list=PS.scan(host,int(ports[0]),int(ports[1])) flag=True for ports in open_port_list: flag=False print("[*] "+str(ports)+" open") if flag: print("No port open") os._exit(0) else: try: port = int(port) pass except ValueError as e: print(str(e)) return pass TCLIENT.client(host, port) return pass