(Oct-09-2017, 09:30 AM)Larz60+ Wrote: you can redirect stdout:
if __name__ == "__main__": import sys sys.stdout = open('textout.txt', 'w') ... rest of your code here ... sys.stdout.close()
so it should be like this?
if __name__ == "__main__": import sys sys.stdout = open('textout.txt', 'w') if lena == 1: for network, netmask, _, interface, address in scapy.config.conf.route.routes: # skip loopback network and default gw if network == 0 or interface == 'lo' or address == '127.0.0.1' or address == '0.0.0.0': continue if netmask <= 0 or netmask == 0xFFFFFFFF: continue net = to_CIDR_notation(network, netmask) if interface != scapy.config.conf.iface: # see http://trac.secdev.org/scapy/ticket/537 logger.warn("skipping %s because scapy currently doesn't support arping on non-primary network interfaces", net) #continue if net: scan_and_print_neighbors(net, interface) repr(network) sys.stdout.close() elif lena == 3 : print("Bye Bye ")
@Larz60+
thank u very much it's working <3