import os
import time
#Menu (choose)
os.system("cls")
print()
print("====================")
print("LAN SCANNING BY PING")
print("====================")
print()
print("1) Whole LAN scanning")
print("2) One host scanning")
print("3) Settings")
print("0) Exit")
choose = int(input("Enter [1], [2], [3] or [0]: "))
#Whole LAN scanning
if choose==1:
print()
inp = open("C:/Users/Adam/Desktop/ping/new.txt", "r")
tnp = open("C:/Users/Adam/Desktop/ping/new2.txt", "r")
break_line = "-"
print(break_line * 56)
activehosts = []
unactivehosts = []
for one_line in inp.readlines():
one_line = one_line.rstrip()
response = os.system("ping " + one_line + " -n 1")
if response==0:
activehosts.append(one_line)
print("Host {} is active".format(one_line))
elif response==1:
unactivehosts.append(one_line)
print("Host {} is unactive or unreachable".format(one_line))
print(break_line * 56)
time.sleep(1)
for one_name in tnp.readlines():
one_name = one_name.rstrip()
print()
print("Active hosts:")
for x in activehosts:
print(x)
print()
print("Unactive or unreachable hosts: ")
for x in unactivehosts:
print(x)
inp.close
#One host scanning
elif choose==2:
print()
server_ip = input("Enter server's ip: ")
response = os.system("ping " + server_ip + " -n 1")
print()
if response==0:
print("Host {} is active ".format(server_ip))
else:
print("Host {} is unactive or unreachable".format(server_ip))
#Settings
elif choose==3:
print()
print("1) Show ip board file")
print("2) Edit ip board file")
print("0) Exit")
a = int(input("Enter [1], [2] or [0]: "))
if a==1:
print()
filename = 'C:/Users/Adam/Desktop/ping/new.txt'
inp = open("C:/Users/Adam/Desktop/ping/new.txt", "r")
lc = 0
for one_line in inp.readlines() :
lc += 1
one_line = one_line.rstrip()
print("{}) {}".format(lc, one_line))
time.sleep(0.5)
inp.close
elif a==2:
filename = 'C:/Users/Adam/Desktop/ping/new.txt'
os.startfile(filename)
elif a==3:
exit()
#Exit option
elif choose==0:
exit()
#Afrer complete above code
print()
restart = int(input("Enter [1] to restart the program or [0] to exit it: "))
if restart == 1:
os.system("cls")
os.system("python C:/Users/Adam/Desktop/ping/file.py")
else:
exit()
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}