Quick&Dirty Port Scanner in AppleScript

Wenn ich doch nur schon etwas besser in Python programmieren könnte....

--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

This entry was posted in Useful Snippets and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA:


nine × 7 =

Subscribe without commenting

  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...