ns1 fileformat not correct?

Take a script, leave a script - Like the penny tray only different

ns1 fileformat not correct?

Postby Cakkie » Tue Mar 01, 2005 3:46 pm

Since there doesn't appear to be a 'decent' php-based ns1-parser, I'm currently my own. For some reason, some files seem to work fine (read all data from all AP's), but others don't.

The problem seems to lie in the "location source" value of APDATA entries.
This is a 32bit int, and should normally only have the value 0 (no GPS data present) of 1 (GPS data present).
If a file fails, the value of location source is 80 ff 14 7c, giving a decimal value of 2081750912.

I've attached 2 ns1 files that show this behaviour. The funny thing is that both files open in netstumber without problems.

test1.ns1 -> first APDATA element of 7th AP in file (no SSID), position in file = 16737 to 16740
test2.ns1 -> first APDATA element of 4th AP in file (SSID = dorp), position in file = 6926 to 6929

Does anyone know why they have this value, and how I should treat this?

Greetings,

Tom
Attachments
ns1files.zip
(8.63 KiB) Downloaded 665 times
Cakkie
Mini Stumbler
 
Posts: 12
Joined: Tue Mar 01, 2005 3:12 pm

Postby beakmyn » Tue Mar 01, 2005 4:16 pm

You're right however I don't think Marius intention was to have a binary value. It is related to the data contained in the GPSData structure, I think

I've requested information on this but he has yet to respond. If you treat the data as 0 being no GPS and any other number as GPS being present and you interpret that value as a signed 32bit integer you'll be fine.

I ran into the same issue with the programs developed in my signature.
beakmyn
 
Posts: 4858
Joined: Sun Aug 03, 2003 1:53 pm

Postby Cakkie » Tue Mar 01, 2005 11:22 pm

Thanks, I'll give that a try when I get back home and I'll keep you posted :)
Cakkie
Mini Stumbler
 
Posts: 12
Joined: Tue Mar 01, 2005 3:12 pm

Postby Cakkie » Wed Mar 02, 2005 3:05 pm

Ok, that worked just fine.

I worked out my script so that it is now able to read a ns1 file, and put it into an object for easy access in a php script.

Since I can assume other people would be interested in this, I'll soon make it public so everyone can use it.

There's only one main problem I'm having, and that are the FILETIME fields. Those are 64bit values, and appearantly PHP doesn't quite convert them as well as I would have hoped (lack of 64bit int). If anyone knows a good way to convert such value to a more usable format, do speak up :) I currently split it up in 2 uint(32), giving me the low part and high part of the value.


Tom
Cakkie
Mini Stumbler
 
Posts: 12
Joined: Tue Mar 01, 2005 3:12 pm

Postby beakmyn » Wed Mar 02, 2005 4:35 pm

You'll want to split it into two longs to be Microsoft compatible as the FILETIME structure is as follows:

Code: Select all

[B]VB[/B]   
Private Type FILETIME
    dwLowDateTime As Long   
    dwHighDateTime As Long 
End Type
[B]C[/B]
typedef struct _FILETIME {
   DWORD dwLowDateTime;   /* low 32 bits  */
   DWORD dwHighDateTime;  /* high 32 bits */
} FILETIME, *PFILETIME, *LPFILETIME;


This is the standard format which PHP may be able to handle (don't know, don't use PHP) The filetime is stored in UTC time so you'll then also need to convert it to "local" time. I.E. Eastern Standard, Moutain, etc if you system clock is not set to GMT time. Otherwise there will be xx hours discrepency in the time.

<edit>
How did you handle the channel bit field?
Are you handling just version 12 of the Ns1 format or the 3 other public versions (not counting version 1)?
beakmyn
 
Posts: 4858
Joined: Sun Aug 03, 2003 1:53 pm

Postby Cakkie » Thu Mar 03, 2005 12:35 am

Well, the problem with the FILETIME is that as far as I know, PHP does not have a easy way to handle it, like in VB or C. PHP uses the unix time epoch to handle date/times (number of seconds since 1/1/1970).

As for the channel bits, those should be looked at through binary goggles :) .

Say you have a value of 2240, it means that channels 11, 7 and 6 were used:
2240 in binary: 00000000 00000000 00001000 11000000

giving:
bit 0 = 0 -> chan 0? not used
bit 1 = 0 -> chan 1 not used
bit 2 = 0 -> chan 2 not used
...
bit 6 = 1 -> chan 6 was used
bit 7 = 1 -> chan 7 was used
bit 8 = 0 -> chan 8 not used
...
bit 11 = 1 -> chan 11 was used
...
Cakkie
Mini Stumbler
 
Posts: 12
Joined: Tue Mar 01, 2005 3:12 pm

Postby beakmyn » Thu Mar 03, 2005 3:00 am

Just checking. A quick google did find some tools to do filetimes in PHP one was $9.95
beakmyn
 
Posts: 4858
Joined: Sun Aug 03, 2003 1:53 pm

Postby icefreez » Thu Mar 03, 2005 9:25 am

You definantly have to post the source once your done :)

I am intested to see how this works. I am far from having enough coding experiance to code something like this so we will see how much of it i can actually understand :P

BTW when your script is done parsing the ns1 file how will you store the information? An array, a database, a file?
icefreez
Mini Stumbler
 
Posts: 32
Joined: Mon Dec 27, 2004 4:01 pm
Location: South Dakota

Postby syst0lic » Mon Mar 28, 2005 8:42 am

Any updates on this project?
syst0lic
Mini Stumbler
 
Posts: 18
Joined: Fri Jan 28, 2005 7:48 pm


Return to Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron