![]() |
|
|||||||
| Register | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Registered Member
Join Date: Nov 2005
Posts: 2
|
Python NS Scripts
Has anyone sucessfully coded a python script for netstumbler? I've made some attempts at it using the VB master script as an example, but py and vb aren't imported in the same way. I see that NS uses some python library called axscript (in the win32com lib), but there is little documentation on it. Besides hacking through code (as I'm doing now), I'm hoping someone here has an example or at least a hint
. Thanks in advance! |
|
|
|
|
|
#3 (permalink) | |
|
Humourless EuroMod.
Join Date: Mar 2004
Location: City of Mermaids, Denmark
Posts: 6,813
|
Quote:
What NS does is start the scripting engine with the script specified and expose some variables and functions that the scripting engine can call to get data. Python AFAIK is not a scripting engine, but an interpreted programming language. Dutch
__________________
All your answers are belong to Google. SEARCH DAMMIT! Warning. Warning. Low C8H10N4O2 level detected. Operator halted.... |
|
|
|
|
|
|
#4 (permalink) |
|
Registered Member
Join Date: Oct 2006
Posts: 5
|
ok I installed ActivePython from ActiveState. NetStumbler now let me choose a python file as external script.
My python file looks like: Code:
PlaySound("C:\Program Files\Network Stumbler\ns-signal-1.wav")
Code:
---------------------------
NetStumbler
---------------------------
An error was reported in your script.
Python ActiveX Scripting Engine
Traceback (most recent call last):
File "<Script Block >", line 1, in ?
PlaySound("C:\Program Files\Network Stumbler\ns-signal-1.wav")
NameError: name 'PlaySound' is not defined
Line:1 Char: 0
Exception occurred.
So, which library defines PlaySound?? Thanks. |
|
|
|
|
|
#5 (permalink) | |
|
Did you do the math?
Join Date: Apr 2002
Location: Villa Straylight
Posts: 10,002
|
Quote:
Google "Python playsound" and "Python playsound winsound", and you should find plenty of references.
__________________
Thorn Sex and Violence. You can't enjoy one, if you don't survive the other. (And that works both ways...) Last edited by Thorn : 10-11-2006 at 05:41 AM. |
|
|
|
|
|
|
#6 (permalink) | |
|
Registered Member
Join Date: Oct 2006
Posts: 5
|
Quote:
Now, I can do stuff like: Code:
import winsound
import easygui
easygui.msgbox('lol')
winsound.PlaySound("ns-signal-1.wav", winsound.SND_FILENAME)
If I run above, it displays a message box and when I close it, it plays sound (easygui.msgbox probably has a loop). So far so good. Now, I want to try OnScalResult: First, using JScript: Code:
function OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen) {
PlaySound("ns-signal-1.wav");
}
Now, onto Python: Code:
import winsound
def OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen):
winsound.PlaySound("ns-signal-1.wav", winsound.SND_FILENAME)
Do I have to put OnScanResult to some specific module?? I don't know why JScript version works but not Python version... Ok, to make Python version really identical to JScript version, I did: Code:
import winsound
def PlaySound(name):
winsound.PlaySound(name, winsound.SND_FILENAME)
def OnScanResult(SSID,BSSID,CapFlags,Signal,Noise,LastSeen):
PlaySound("ns-signal-1.wav")
Help. Thanks. -edit Better yet, if there is a documentation that describes how netstumbler calls those functions..etc will be awesome!!!!!! Last edited by quhaha : 10-11-2006 at 06:46 AM. |
|
|
|
|
|
|
#7 (permalink) | |
|
Did you do the math?
Join Date: Apr 2002
Location: Villa Straylight
Posts: 10,002
|
Quote:
I do know a lot of other languanges for both programming and scripting, and the fact that you're using a GUI while you don't seem to know or understand the underlying library structure is working against you. GUIs are great tools to speed up the develpment process if you know what you are doing. However, if you don't know or understand the underlying language itself, a GUI will just complicate the subject. Real programmers use the command line. Maybe someone else can help, but it would seem that you really just need to read a book or three on Python, and learn to use some search tools.
__________________
Thorn Sex and Violence. You can't enjoy one, if you don't survive the other. (And that works both ways...) |
|
|
|
|
|
|
#9 (permalink) | |
|
Humourless EuroMod.
Join Date: Mar 2004
Location: City of Mermaids, Denmark
Posts: 6,813
|
Quote:
It's the script that calls the functions that Netstumbler exposes to the Scripting engines. You need to read up on how to call external functions from what ever scripting language you choose to use. See this for further information. Dutch
__________________
All your answers are belong to Google. SEARCH DAMMIT! Warning. Warning. Low C8H10N4O2 level detected. Operator halted.... Last edited by Dutch : 10-11-2006 at 07:13 AM. |
|
|
|
|
|
|
#10 (permalink) | ||
|
Did you do the math?
Join Date: Apr 2002
Location: Villa Straylight
Posts: 10,002
|
Quote:
Official NetStumbler Scripting Guide or http://www.stumbler.net/scripting.html Quote:
__________________
Thorn Sex and Violence. You can't enjoy one, if you don't survive the other. (And that works both ways...) |
||
|
|
|
|
|
#12 (permalink) | |
|
Humourless EuroMod.
Join Date: Mar 2004
Location: City of Mermaids, Denmark
Posts: 6,813
|
Quote:
Dutch
__________________
All your answers are belong to Google. SEARCH DAMMIT! Warning. Warning. Low C8H10N4O2 level detected. Operator halted.... |
|
|
|
|
|
|
#13 (permalink) | |
|
SpoonfeederExtraordinaire
Join Date: Jan 2005
Location: Maryland
Posts: 3,613
|
Quote:
__________________
:00475160 0E A6 AE A0 19 E3 A3 46 .......F
:00475168 0D 65 17 0C 53 70 6F 6F .e..Spoo :00475170 6E 66 65 65 64 65 72 2E nfeeder. :00475178 45 78 74 72 61 6F 72 64 Extraord :00475180 69 6E 61 69 72 65 5D 3B inaire]; :00475188 8B 9E 92 5A FF 5D A6 F0 ...Z.].. |
|
|
|
|
|
|
#14 (permalink) |
|
Registered Member
Join Date: Oct 2006
Posts: 5
|
Code:
#!C:/Perl/bin/perl.exe -w
sub OnScanResult {
my($sid,$mac,$flags,$signal,$noise,$ls) = @_;
PlaySound('ns-signal-1.wav');
}
I just noticed that NetStumbler supports Python.AXScript and PerlScript, not Python and Perl. I think win32com.axscript module isn't implemented yet (Not sure about this). Probably that explains why PerlScript already has access to PlaySound but Python.AXScript doesn't (I used winsound.PlaySound). |
|
|
|
|
|
#15 (permalink) | |
|
Humourless EuroMod.
Join Date: Mar 2004
Location: City of Mermaids, Denmark
Posts: 6,813
|
Quote:
Dutch
__________________
All your answers are belong to Google. SEARCH DAMMIT! Warning. Warning. Low C8H10N4O2 level detected. Operator halted.... |
|
|
|
|