Hi there, i have some logical problem. I dont get it done to write my for loops in that way that the ip address range which is given as arguments are correct processed. Meaning that only the ips are printed which the user defines as argument. I tried to make an if statement to stop at the end_adress but it didnt work as it will stop at the end range every time.
Here is my program so far: --------------------------------------------------------- sai = start_adress.split(".") eai = end_adress.split(".") # Prüfen auf gültige IP if eai < sai: help_here() #print sai,eai sa1=int(sai[0]) sa2=int(sai[1]) sa3=int(sai[2]) sa4=int(sai[3]) ea1=int(eai[0]) ea2=int(eai[1]) ea3=int(eai[2]) ea4=int(eai[3]) #print sa1,sa2,sa3,sa4 #print ea1,ea2,ea3,ea4 e1=ea1+1 # muß um 1 erhöht werden da sonst nur bis ea1-1 e2=ea2+1 e3=ea3+1 e4=ea4+1 ip="" for i in range(sa4,255): ip=sai[0]+"."+sai[1]+"."+sai[2]+"."+str(i) print ip print "-------4--------" for i in range(sa3+1,255): for i2 in range(1,255): ip=sai[0]+"."+sai[1]+"."+str(i)+"."+str(i2) print ip print "-------3--------" sa3=sa3+1 for i in range(sa2+1,e2): for i2 in range(1,255): for i3 in range(1,255): ip=sai[0]+"."+str(i)+"."+str(i2)+"."+str(i3) print ip print "-------2--------" for i in range(sa1+1,e1): for i2 in range(1,255): for i3 in range(1,255): for i4 in range(1,255): ip=str(i)+"."+str(i2)+"."+str(i3)+"."+str(i4) print ip print "-------1--------" --------------------------------------------------------- The start_adress and end_adress are the ip-range. For example: printdomains.py -s 192.168.178.0 -e 193.170.180.4 This should make all ips and stop at the end_adress. Maybe you can help. Thank you. Mac _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor