What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Release] Xniff (ActiveX Packet Sniffer) - Examples inside

Pages: (6): « First [ 1 ] 2 3 4 5 » Last »
[Release] Xniff (ActiveX Packet Sniffer) - Examples inside
Author: Message:
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. [Release] Xniff (ActiveX Packet Sniffer) - Examples inside
Starting with the whole discussion about window open/close notifiers, with questions to get the contact's font, and some other things people would like to access but can't with the current script engine, I decided to try and create an ActiveX based Packet sniffer.

Warning: if your script uses this, it may become unstable/useless if MSN changes protocol ! So be very carefull!

This allows you to start monitoring packets with a couple of lines of code, and provides easy methods to get what you want, quickly!

It gives you access to only 1 property and 2 methods:
» property IP : string containing the IP you want to listen
» function Start() : start monitoring the choosen IP
» function Stop() : stop monitoring the choosen IP
» function About() : displays a small about box

Examples: (with full commented code)
  • Window open/close notifier ( very reliable, only close notifier has a delay of 15/30seconds from the actual close of the window, due to a WLM limitation )
  • View All MSN packets (usefull to study what packets get sent/received when you do something specific and build your own script)

My first idea was to make the ActiveX MSN-only (only capture MSN packets), but then I thought that only one extra line of code (check if comming from MSN port) wouldn't matter if you could monitor the entire network.

So, here it is, hope you guys enjoy it.

I didn't test it very much, but there aren't that much things that can go wrong with 1 property and 2 basic methods, so I leave it for you guys to use !

Note: it's OCX because Delphi doesn't allow to create non-visual ActiveX Object (actually it allows, but it would take forever), so I created it visually and then added the flag to make the ActiveX invisible at runtime. So, don't worry about the extension being OCX and not DLL, just register it normally using regsvr32.

Note2: my imagination wasn't running that wild when I gave the ActiveX a name, so w00t.Xniff sounded like a good choice :P

Note3: I hope it works in every PCs, because hopefully it doesn't need Borland Runtime Packages to run (that's why the filesize is rather big). But I dunno, it's the first ActiveX I create so I can't know for sure...

.zip File Attachment: Xniff.zip (268.45 KB)
This file has been downloaded 1541 time(s).

This post was edited on 07-31-2006 at 12:13 AM by Pai.
07-30-2006 01:23 PM
Profile PM Find Quote Report
AberNStein
Full Member
***


Posts: 132
Reputation: 2
Joined: Jul 2006
RE: [Release] Xniff (ActiveX Packet Sniffer)
WOW.
you rock.
this will start a whole new wave of scripts.
[Image: gybouserbar6hc.gif]
07-30-2006 03:12 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: [Release] Xniff (ActiveX Packet Sniffer)
Yup :P nice job (y)

This post was edited on 07-30-2006 at 03:28 PM by deAd.
07-30-2006 03:28 PM
Profile PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: [Release] Xniff (ActiveX Packet Sniffer)
Amazing, we can expect a new breed of scripting arriving I think now people have great examples to work with (Y).

This post was edited on 07-30-2006 at 03:31 PM by absorbation.
07-30-2006 03:31 PM
Profile PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: [Release] Xniff (ActiveX Packet Sniffer)
Looks really quite usefull (y)

for anyone wondering how to get the local ip so you know what address to sniff:
code:
function getLoaclIp(){
    var wmiObj = new ActiveXObject('WbemScripting.SWbemLocator');
    var wmiInst = wmiObj.ConnectServer('.', "root\\cimv2");
    wmiInst.Security_.ImpersonationLevel = 3;
   
    var col = wmiInst.ExecQuery('Select * from Win32_NetworkAdapterConfiguration');
    var colEnum = new Enumerator(col);
   
    var ipAddr;
   
    for (; !colEnum.atEnd(); colEnum.moveNext()){
        var objIp = colEnum.item();
        var addr = objIp.IPAddress(0);
        if((typeof addr == 'string') && addr.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/)){
            ipAddr = addr;
        }
    }
   
    return ipAddr;
}

That function returns the last vaild ipaddress of you network adapters.
Im sure there is a better way to find it, but WMI was the only way i could think of at the time :P

This post was edited on 07-30-2006 at 03:34 PM by Plik.
07-30-2006 03:33 PM
Profile PM Find Quote Report
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. RE: [Release] Xniff (ActiveX Packet Sniffer)
I believe
code:
ws = new ActiveXObject( "MSWinsock.Winsock" );
ipaddress = ws.LocalIP;

is easier, but I made it so that the developer can set what IP to listen because there are people with multiple network adapters.
07-30-2006 03:54 PM
Profile PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: [Release] Xniff (ActiveX Packet Sniffer)
I don't think everyone can use winsock, there was a thread about that a long time ago :P
07-30-2006 04:06 PM
Profile PM Find Quote Report
AberNStein
Full Member
***


Posts: 132
Reputation: 2
Joined: Jul 2006
RE: [Release] Xniff (ActiveX Packet Sniffer)
is there any way to have the script do the regsvr32 stuff?
[Image: gybouserbar6hc.gif]
07-30-2006 04:07 PM
Profile PM Find Quote Report
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
O.P. RE: [Release] Xniff (ActiveX Packet Sniffer)
Like stated in the documentation:

code:
Example 2
ScriptInfo file used to create a Script Pack. During import, the "ExtraFuncVB.dll" ActiveX will be registered with resvr32.

    <DotNetFiles>
        <FileName>ExtraFuncVB.dll</FileName>
    </DotNetFiles>

So, you just change ExtraFuncVB.dll to Xniff.ocx and voila'
07-30-2006 04:31 PM
Profile PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: [Release] Xniff (ActiveX Packet Sniffer)
quote:
Originally posted by Pai
I believe
code:
ws = new ActiveXObject( "MSWinsock.Winsock" );
ipaddress = ws.LocalIP;

is easier, but I made it so that the developer can set what IP to listen because there are people with multiple network adapters.
I knew there would be an easyer way envolving winsock -_-

* Plik hides in shame
07-30-2006 05:29 PM
Profile PM Find Quote Report
Pages: (6): « First [ 1 ] 2 3 4 5 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On