Well, you forgot a few things:
code:
var xniff = new ActiveXObject("w00t.Xniff");
xniff.IP = getLocalIp();
function xniff:nData(srcip, srcport, destip, destport, data, datalen)
{
if (srcport === "1863" && datalen > 0)
{
var data = data.split(" ");
if (data[0] == "MSG" && data[8] == "Content-Type:" && data[9] == "text/plain;" && data[10] == "charset=UTF-8")
{
var style = data[14];
var font_name = data[13];
var color = data[15];
Debug.Trace("Font Style: " + style);
Debug.Trace("Font Name: " + font_name);
Debug.Trace("Font Color: " + color);
}
}
}
function OnEvent_Initialize(MessengerStart)
{
xniff.Start();
}
function OnEvent_Uninitialize(MessengerExit)
{
xniff.Stop();
}
function getLocalIp()
{
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;
}