Thursday, March 22, 2012

Ghetto As All Get Out Port Scanner

You're stuck in a network without internet access, you don't have a port scanner with you, can't leave to get one, no other options..... what do you do? WHAT DO YOU DO????

Thus was born the Ghetto as All Get Out Port Scanner. What an ugly bit of code.

This was being built into a larger script so there's some stuff missing here obviously. The File ~temp2 would have the list of  ip addresses. You would need to change the port (9100 in this case) or assign a new variable to handle running through the ports you wanted to check.

Of course you need telnet installed so this isn't windows vista / 7 compatible.

-=The Script=-

@echo off
for /f %%i in (~temp2) do (
    start /min telnet %%i 9100
    ping -n 5 > nul
    netstat -n | find /i "%%i:9100" | find /i "Established" && echo %%i >> up.txt
    taskkill /f /IM telnet.exe

No comments:

Post a Comment

All comments moderated.
Comments like "sweet dude" or "this is awesome" or "thanks" will be denied,
if you've got something genuinely interesting to say, say it. Other than that just sit back and bask in the glory.