I have been working on a small toolkit for awhile now as a way to learn basic python. part of this toolkit is the code that follows this explanation. It is a basic network enumeration script, to simply ping all ip addresses in your local subnet. However I am having an issue implementing a few pieces. first the code
ip1=raw_input()
if ip1 == None:
ip="192.168.0.x"
else:
ip=ip1
ipend="1"
while ipend != 255:
ip.replace("x", ipend)
attempt=subprocess.Popen(["ping.exe", ip], stdout=subprocess.PIPE).communicate()[0]
if ("unreachable" in attempt):
pass
else:
print "The host at ", ip, "is UP!"
ipend += 1
if ipend == "255":
subprocess.stop
raw_input("Thank you for using PTK. Please press enter to exit.")
enum()
so my first issue, I believe is in my str.replace function, I am attempting to and an int to a str and due to this it seems to be unable to create, ping, and print the correct ip. I'm unsure if converting the entire string to a floating int would work, however its a thought I'm toying with. as previously stated I am very basic with python and am working on learning so please forgive me if this a stupid question with a simple fix.