Quick&Dirty Port Scanner in AppleScript

7/03/2011
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

No Comments

URL Encoding in AppleScript

22/01/2011

Ich hatte da eine Perl-Zeile die mir einen String "url-encoded", nur funktionierte dieser "do shell script"-Aufruf nicht in Filemaker (wissen die Götter wie die AppleScript dort ausführen). Auf jeden Fall waren das Filemaker zuviele Sonderzeichen in dem Befehl und es kam nur Murks dabei raus. Und weil ja so viele schöne Skript-Sprachen auf dem Mac schon vorinstalliert sind hier meine Top 3 Aufrufe fürs URL-Encoding unter AppleScript (Platz 1 funktioniert dann auch, wenn er in Filemaker ausgeführt wird):

Read the rest of this article »
No Comments

Maus Zeiger in AppleScript via Python bewegen

18/09/2009
Von hinten durch AppleScript, via Python in das Cocoa-Framework ;-)
Code zum markieren einmal anklicken oder Code im Skript-Editor öffnen

do shell script "python -c \"import objc;bndl = objc.loadBundle('CoreGraphics', globals(), '/System/Library/Frameworks/ApplicationServices.framework');objc.loadBundleFunctions(bndl, globals(), [('CGWarpMouseCursorPosition', 'v{CGPoint=ff}')]);CGWarpMouseCursorPosition((0, 0));\""

Eine alltagstaugliche Alternative findest Du hier.
8 Comments