Perl Module

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

Postby dwakeman » Mon May 09, 2005 7:50 am

dwakeman wrote:I thought of something else to add to the module. I was reading about the problem some were having with corrupted NS1 files, and having to go through a manual trial and error process (http://members.netjunkies.net/streaker/repair_ns1.asp and http://www.frontiernet.net/~beakmyn/Ns1%20File%20Recovery/) to try and save as many AP's as possible from the file. I want to see if I can get the module to try and automatically repair the file, or at least get as many good AP's as possible out.

I was able to find someone's corrupted file here: http://www.netstumbler.org/showthread.php?t=12954&highlight=corrupt but I was hoping I could get a second one (doesn't have to be huge) so I could make sure I was doing this properly. If someone has one and wouldn't mind, please email it to me (my email is above).

Thanks,
Dave


Actually I ran that file through the module and I was able to export the ~950 AP's without changing anything. Attempting to open the file in NetStumbler produced an error: "Unexpected File Format". *shrug* Unless I get another corrupted ns1 file, I'll assume it will work. :rolleyes:

I'm just about finished the new interface and will be releasing a new version this week.
User avatar
dwakeman
 
Posts: 57
Joined: Mon Jul 05, 2004 12:42 pm
Location: canadia

Postby dwakeman » Tue May 10, 2005 8:14 am

I have released a new version of NetStumbler::NS1 today (http://www.perldev.org/project.cgi?pid=6). I have changed the interface to OO, added two new features for extra data to be returned (IP info, and all GPS entries), and created POD documentation in the NS1.pm file.

Here is some working code:

Code: Select all
use NetStumbler::NS1;
   
$ns1 = NetStumbler::NS1->new();
$ns1->set( ip_info => 1 );

@nsData = $ns1->parseNS1( "filename.ns1" );


This will return a nested data structure that you can view using Data::Dumper. Here is a sample template that would include ip_info and full_gps info:

Code: Select all
[
  'Latitude',
  'Longitude',
  'SSID',
  'Type',
  'BSSID',
  'First Seen',
  'Last Seen',
  'SNR',
  'Signal',
  'Noise',
  'Flags',
  'Name',
  'Channels',
  'Beacon',
  'Data Rate',
  'Last Channel',

(--- if ip_info   ---)
  'IP Address',
  'Subnet',
  'Subnet Mask',

(--- if full_gps ---) - APDATA, new array
  [
    [
      'Time',
      'Signal',
      'Noise',
      'Location Source',
(--- if full_gps ---) - GPSDATA, new array
      [
        'Latitude',
        'Longitude',
        'Altitude',
        'NumSats',
        'Speed',
        'Track',
        'MagVariation',
        'Hdop'
      ]
    ],
    [
     [
       Next APDATA/GPSDATA entry ...
     ]
    ],
    [
     [
       Next APDATA/GPSDATA entry ...
     ]
    ]
  ],
  [
    Next APINFO entry ...
  ]
]



There can be more than one array depending on how many APDATA/GPSDATA entries you have for a single AP (there could be LOTS). Without the GPSDATA you would have:

Code: Select all
[
  'Latitude',
  'Longitude',
  'SSID',
  'Type',
  'BSSID',
  'First Seen',
  'Last Seen',
  'SNR',
  'Signal',
  'Noise',
  'Flags',
  'Name',
  'Channels',
  'Beacon',
  'Data Rate',
  'Last Channel',

(--- if ip_info   ---)
  'IP Address',
  'Subnet',
  'Subnet Mask',
],
[
  Next entry ...
],
[
  Next entry ...
]


I know that this gets pretty confusing because of the nested data structure, but I think you can simplify this within your own code (perldoc -f map). I may attempt to simplify the returned structure at a later time, but for now I'll be leaving this as is.
User avatar
dwakeman
 
Posts: 57
Joined: Mon Jul 05, 2004 12:42 pm
Location: canadia

Previous

Return to Scripts

Who is online

Users browsing this forum: No registered users and 1 guest