Quick&Dirty Port Scanner in AppleScript
7/03/2011--07.03.2011 hubionmac.com
--quick and dirty port scanner... I still have no idea of python :-/
set startport to 80
set endport to 80
set startip to 100
set endip to 100
set network_address to "192.168.0."
set a to {}
repeat with i from startip to endip
set theip to network_address & i
try
do shell script "/sbin/ping -c 2 -t 1 -q " & theip
set thecommand to "import sys
from socket import *
for port in range(int(" & startport & "), int(" & endport & ")+1):
try:
socket(AF_INET, SOCK_STREAM).connect((\"" & theip & "\", port))
print \"" & theip & " ----> \",port;
except: pass;"
set a to a & return & (do shell script "python -c " & quoted form of thecommand)
end try
end repeat
tell application "TextEdit"
make new document
set text of document 1 to a as text
end tell