Skip to content

Commit

Permalink
setup file added
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Jan 10, 2017
1 parent 912e85a commit 29ba9e5
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 27 deletions.
56 changes: 29 additions & 27 deletions ip_finder.py
Expand Up @@ -6,6 +6,7 @@
import multiprocessing as mu # for multtiprocessing
import time

mask = "192.168.1."

def line(number,char="-"):
response=""
Expand All @@ -19,6 +20,7 @@ def ping(i): # ping function
return output
def ip_filter(i_list): # This Function Get A List Of IPs and Split IP
'''((list)->list'''
dic = list(string.digits + ".")
temp_list=[]
for i in range(len(i_list)):
for j in range(len(i_list[i])):
Expand Down Expand Up @@ -84,45 +86,45 @@ def find(mode="manual",my_ip="0.0.0.0",range_min=0,range_max=254): # This Functi
log_file.write(line(30, "*") + "\n")
log_file.close()

if __name__=="__main__":
mask="192.168.1."
def main():
mu.freeze_support()
dic=list(string.digits+".")
global mask
print("Running On Netmask: " + mask)
my_ip=socket.gethostbyname(socket.gethostname())
if my_ip=="127.0.0.1":
my_ip = socket.gethostbyname(socket.gethostname())
if my_ip == "127.0.0.1":
print("Problem In Netwrok Connection ( Please Check )")
input()
sys.exit()
ssh_test=sub.Popen("ssh",stdout=sub.PIPE,stderr=sub.PIPE,shell=True)
ssh_result=str(list(ssh_test.communicate())[1])
#print(ssh_result)
inp=int(input("Please Choose ARP[1] or Linear Search[2]"))
time_1=time.perf_counter()
if inp==1:
ssh_test = sub.Popen("ssh", stdout=sub.PIPE, stderr=sub.PIPE, shell=True)
ssh_result = str(list(ssh_test.communicate())[1])
# print(ssh_result)
inp = int(input("Please Choose ARP[1] or Linear Search[2]"))
time_1 = time.perf_counter()
if inp == 1:
print("Please Wait : Scan IPs . . . ")
find(mode="ARP",my_ip=my_ip)
time_2=time.perf_counter()
find(mode="ARP", my_ip=my_ip)
time_2 = time.perf_counter()
else:
get_mask=input("Please Enter Mask :")
get_mask = input("Please Enter Mask :")
try:
range_max_input=int(input("Please Enter Range Max : "))
range_min_input=int(input("Please Enter Range Min : "))
except ValueError: # If User Ignore Input Step
range_max_input=0
range_min_input=0
range_max_input = int(input("Please Enter Range Max : "))
range_min_input = int(input("Please Enter Range Min : "))
except ValueError: # If User Ignore Input Step
range_max_input = 0
range_min_input = 0
print("Please Wait : Scan IPs . . . ")
if get_mask.find("192.")!=-1 and get_mask.find("168.")!=-1:
if get_mask[-1]!=".":
get_mask=get_mask+"."
mask=get_mask
if range_max_input>range_min_input and range_max_input<256:
find(range_max=range_max_input,range_min=range_min_input)
if get_mask.find("192.") != -1 and get_mask.find("168.") != -1:
if get_mask[-1] != ".":
get_mask = get_mask + "."
mask = get_mask
if range_max_input > range_min_input and range_max_input < 256:
find(range_max=range_max_input, range_min=range_min_input)
else:
find()
time_2=time.perf_counter()
print("Scan Time :",str((time_2-time_1)/60)," min")
time_2 = time.perf_counter()
print("Scan Time :", str((time_2 - time_1) / 60), " min")
input("Press Any Key To Exit")




Expand Down
40 changes: 40 additions & 0 deletions log_file.txt
@@ -0,0 +1,40 @@
2017-01-10 14:44:12.181923
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-01-10 14:45:13.652645
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-01-10 14:46:57.686140
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-01-10 14:47:16.030922
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-01-10 14:49:40.847374
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IP : 192.168.1.36Is available
IP : 192.168.1.1Is available
IP : 192.168.1.255Is available
IP : 192.168.56.1Is available
IP : 192.168.56.254Is available
IP : 192.168.56.255Is available
IP : 192.168.226.1Is available
IP : 192.168.226.254Is available
IP : 192.168.226.255Is available
******************************
2017-01-10 14:49:54.296584
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-01-10 15:32:54.912293
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IP : 192.168.1.36Is available
IP : 192.168.1.1Is available
IP : 192.168.1.255Is available
IP : 192.168.56.1Is available
IP : 192.168.56.255Is available
IP : 192.168.226.1Is available
IP : 192.168.226.255Is available
******************************
2017-01-10 15:33:10.214484
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IP : 192.168.120.1 Is available
IP : 192.168.120.2 Is available
IP : 192.168.120.3 Is available
IP : 192.168.120.4 Is not available
IP : 192.168.120.5 Is not available
******************************
5 changes: 5 additions & 0 deletions setup.py
@@ -0,0 +1,5 @@
from ip_finder import *


if __name__=="__main__":
main()

0 comments on commit 29ba9e5

Please sign in to comment.