![]() |
|
|||||||
| Register | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Registered Member
Join Date: Nov 2004
Posts: 9
|
Hi,
Obviously, some people want to display the ns1 files from netstumbler on the internet... (enhancing my webstumbler script (Link on netstumbler forums) ) So I'm trying to create a script to do this. I'm working on it but still have some problems. This is the script : PHP Code:
The problems are : - Some info are not correctly converted - I only display 1 AP (because of IELength) I you want to enhance this script... contact me to help me. It's GPL so do what you want with it... Cordially Jean CARTIER |
|
|
|
|
|
#2 (permalink) | |
|
PeaceDriver
Join Date: Apr 2002
Location: Dos Palabras, Mandoras
Posts: 2,920
|
Quote:
![]()
__________________
all good ends all ?u=273
|
|
|
|
|
|
|
#4 (permalink) |
|
Registered Member
Join Date: Nov 2004
Posts: 9
|
Hi,
I finally make my script work. you can test it if you want and tell me if it's cool. I would like to enhance it to convert data format, and to make it more readable. This is the script... PHP Code:
Jean CARTIER |
|
|
|
|
|
#5 (permalink) | |
|
Registered Member
Join Date: Feb 2005
Posts: 5
|
strange result
Quote:
I have tried your script. It's work unless that I can not understand the number that represent signal/noise. My php output file looks like this ...... AP Data number 6 Time :1.24295290856E+017 Signal :4244897216 Noise :4244897181 Location Source : 0 ......... How can I read this in dBm (as it show in .ns1 file)? Thanks |
|
|
|
|
|
|
#6 (permalink) |
|
Registered Member
Join Date: Nov 2004
Posts: 9
|
Readable output
Hi,
Thanx for testing the script. The problem is that I don't have enough time to transform output into DBm, or whatever. If you have the time, and a little programming skills, try to enhance it. I'll try to make a better script later. Cordially Jean CARTIER |
|
|
|
|
|
#7 (permalink) |
|
Free Public Wifi
Join Date: Aug 2003
Posts: 4,992
|
The number is already in dBm you're just translating it wrong. It's a 4 byte signed integer.
The time looks the way it does because it's stored in the file as a FILETIME structure which is two longs that need to be 'transmorgified'. I use the following function to handle 90% of the data types in the Ns1 file I'm not the author of this function Code:
Function BytesToNumEx(ByteArray() As Byte, StartRec As Long, _
EndRec As Long, UnSigned As Boolean) As Double
' ###################################################
' Author : Imran Zaheer
' Contact : imraanz@mail.com
' Date : January 2000
' Function BytesToNumEx : Convertes the specified byte array
' into the corresponding Integer or Long
' or any signed/unsigned
' ;(non-float) data type.
'
' * BYTES : LIKE NUMBERS(Integer/Long etc.) STORED IN A
' * BINARY FILE
' Parameters :
' (All parameters are reuuired: No Optional)
' ByteArray() : byte array containg a number in byte format
' StartRec : specify the starting array record within the
' array
' EndRec : specify the end array record within the array
' UnSigned : when False process bytes for both -ve and
' +ve values.
' when true only process the bytes for +ve
' values.
'
' Note: If both "StartRec" and "EndRec" Parameters are zero,
' then the complete array will be processed.
'
' Example Calls :
' dim myArray(1 To 4) as byte
' dim myVar1 as Integer
' dim myVar2 as Long
'
' myArray(1) = 255
' myArray(2) = 127
' myVar1 = BytesToNumEx(myArray(), 1, 2, False)
' after execution of above statement myVar1 will be 32767
'
' myArray(1) = 0
' myArray(2) = 0
' myArray(3) = 0
' myArray(4) = 128
' myVar2 = BytesToNumEx(myArray(), 1, 4, False)
' after execution of above statement myVar2 will be -2147483648
'
'
'####################################################
On Error GoTo ErrorHandler
Dim i As Integer
Dim lng256 As Double
Dim lngReturn As Double
lng256 = 1
lngReturn = 0
If EndRec < 1 Then
EndRec = UBound(ByteArray)
End If
If StartRec > EndRec Or StartRec < 0 Then
MsgBox _
"Start record can not be greater then End record...!", _
vbInformation
BytesToNumEx = -1
Exit Function
End If
lngReturn = lngReturn + (ByteArray(StartRec))
For i = (StartRec + 1) To EndRec
lng256 = lng256 * 256
If i < EndRec Then
lngReturn = lngReturn + (ByteArray(i) * lng256)
Else
' if -ve
If ByteArray(i) > 127 And UnSigned = False Then
lngReturn = (lngReturn + ((ByteArray(i) - 256) _
* lng256))
Else
lngReturn = lngReturn + (ByteArray(i) * lng256)
End If
End If
Next i
BytesToNumEx = lngReturn
ErrorHandler:
End Function
The FILETIME is a bit harder as it needs to be converted from a UTC FILETIME to a LOCAL FILETIME then to a SYSTEMTIME then to a standard date and time.
__________________
┌──────────────────────────────┐ ╞ NS Icons Explained|et hoc genus omne ╡ └──────────────────────────────┘ Creating yesterday's future, Today! |
|
|
|
|
|
#8 (permalink) | |
|
Registered Member
Join Date: Feb 2005
Posts: 5
|
Quote:
4 bytes signed integer? So if we have 10 dbm (1010) it will show as 0101 0000 0000 0000 0000 0000 0000 0000 (1342177280 in dec)? Your function is written in VB ? And its for conversting to ' normal' dbm? Cheer Widy |
|
|
|
|
|
|
#9 (permalink) |
|
Free Public Wifi
Join Date: Aug 2003
Posts: 4,992
|
It's written in vb. I read 4 bytes from the file into a byte array and pass it through the function and get a human readable number.
MaxSignal 4 bytes int32 Maximum signal level reported in dBm After reading 4 bytes from the file Bytes(0)=188 Bytes(1)=255 Bytes(2)=255 Bytes(3)=255 Pass byte array to function ns1.APINFO(Index).MaxSignal = BytesToNumEx(bytes, 0, 0, False) Result of Function -68
__________________
┌──────────────────────────────┐ ╞ NS Icons Explained|et hoc genus omne ╡ └──────────────────────────────┘ Creating yesterday's future, Today! Last edited by beakmyn : 02-17-2005 at 06:15 AM. |
|
|
|
|
|
#10 (permalink) |
|
Registered Member
Join Date: Jul 2005
Posts: 4
|
OK.
There is a little line to get this worked in PHP. $value holds the BINARY Data for the Noise and Signal Rate. i.e. $value is œ’’’ which is hex 0x9cffffff or decimal 2634022911 But that is not the real value. The Real one is -100 dBm. Because the bytes for this value in the file are reversed and we have to reverse it again. Now it is 0xffffff9c or decimal 4294967196 Then invert all the bytes (0x000063) and convert it to decimal (99) and add 1 (100). Give it the "-" sign and be happy ![]() We have -100. Thats the right value. The Code: PHP Code:
But don't forget: This workes only for negative Values. If you have a positive number such as MaxSNR you don't have to invert the bytes and don't add 1. PHP-Code looks like this: PHP Code:
Evil Last edited by Evil.2000 : 07-27-2005 at 11:59 AM. |
|
|
|
|
|
#11 (permalink) |
|
Registered Member
Join Date: Jul 2005
Posts: 4
|
OK guys, i've a problem and hopefully someone can help me.
I've wirtten a NS1-Parser in PHP. It works fine but i have trouble with 2 Variables. If you export the data as SUM-File there are the fields with its values like this: Code:
[ SNR Sig Noise ] [ 98 47 -51 ] If i parse the NS1-File there isn't a field containong the values 47 and -51. The fields [MaxSignal] => -102 and [MinNoise] => -200 are other values and the [MinSignal]and [MaxNoise] give values like 1235368 and 14549456. So can anyone tell me how Netstumbler calculates the Sig and Noise in it's SUM-Files? Thanx for Help. Evil.2000 |
|
|
|
|
|
#13 (permalink) | |
|
Registered Member
Join Date: Jul 2005
Posts: 4
|
Quote:
Can you explain to me how to get on 149? EDIT: OK. Please give me next time the hint to search for 149 on the forum not in my Values :PLast edited by Evil.2000 : 07-28-2005 at 04:56 PM. |
|
|
|
|
|
|
#14 (permalink) | |
|
Registered Member
Join Date: Apr 2007
Posts: 1
|
odd bug
got a parsing problem there chaps:
Quote:
|
|
|
|
|
|
|
#15 (permalink) | |
|
Heeere's your sign!
Join Date: May 2002
Location: Mexico Beach, FL
Posts: 1,169
|
Quote:
Or you can just Procreate Elsewhere for Zombie thread revival. MikeP
__________________
Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote. -- Benjamin Franklin, 1759 |
|
|
|
|