ACalcutt Posted August 24, 2006 Share Posted August 24, 2006 I have been trying to find out how to convert hex to binary. I see Hex -> Dec and BinaryString -> Hex. I thought i could do it with BinaryString( hex ) but that didn't seem to work Is their something simple that i am missing?...does anyone know how to do this? Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
ACalcutt Posted August 24, 2006 Author Share Posted August 24, 2006 (edited) anybody? What i am doing is converting the hex flag values in a netstumbler export. what i get is a combination of these hex values Hex- Binary 0001 0000000000000001 ESS ("Infrastructure") 0002 0000000000000010 IBSS ("Ad-Hoc") 0004 0000000000000100 CF-Pollable 0008 0000000000001000 CF-Poll Request 0010 0000000000010000 Privacy ("WEP") 0020 0000000000100000 Short Preamble 0040 0000000001000000 PBCC 0080 0000000010000000 Channel Agility It seems it would be easier to find out what the flag values stand for from the binary sting Edited August 24, 2006 by ACalcutt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
azeazezar Posted August 24, 2006 Share Posted August 24, 2006 (edited) is this wat yer looking for?http://www.autoitscript.com/autoit3/docs/functions/Dec.htm Edited August 24, 2006 by azeazezar Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 24, 2006 Moderators Share Posted August 24, 2006 http://www.autoitscript.com/forum/index.ph...st&p=211599 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 24, 2006 Share Posted August 24, 2006 anybody? What i am doing is converting the hex flag values in a netstumbler export. what i get is a combination of these hex values Hex- Binary 0001 0000000000000001 ESS ("Infrastructure") 0002 0000000000000010 IBSS ("Ad-Hoc") 0004 0000000000000100 CF-Pollable 0008 0000000000001000 CF-Poll Request 0010 0000000000010000 Privacy ("WEP") 0020 0000000000100000 Short Preamble 0040 0000000001000000 PBCC 0080 0000000010000000 Channel Agility It seems it would be easier to find out what the flag values stand for from the binary sting Much easier to just test the bits right from the hex number: $Input = "00A9" $HexIn = Number("0x" & $Input) Global $ESS = False, $IBSS = False, $CFPoll = False, $CFPollReq = False, $WEP = False, $ShortPreAm = False, $PBCC = False, $ChAgile = False If BitAnd($HexIn, 0x1) Then $ESS = True If BitAnd($HexIn, 0x2) Then $IBSS = True If BitAnd($HexIn, 0x4) Then $CFPoll = True If BitAnd($HexIn, 0x8) Then $CFPollReq = True If BitAnd($HexIn, 0x10) Then $WEP = True If BitAnd($HexIn, 0x20) Then $ShortPreAm = True If BitAnd($HexIn, 0x40) Then $PBCC = True If BitAnd($HexIn, 0x80) Then $ChAgile = True $Msg = "The following attributes are set: " & $Input If $HexIn Then If $ESS = True Then $Msg &= @CRLF & @Tab & "ESS (Infrastructure)" If $IBSS = True Then $Msg &= @CRLF & @Tab & "IBSS (Ad hoc)" If $CFPoll = True Then $Msg &= @CRLF & @Tab & "CF: Pollable" If $CFPollReq = True Then $Msg &= @CRLF & @Tab & "CF: Poll Request" If $WEP = True Then $Msg &= @CRLF & @Tab & "Privacy (WEP)" If $ShortPreAm = True Then $Msg &= @CRLF & @Tab & "Short Preamble" If $PBCC = True Then $Msg &= @CRLF & @Tab & "PBCC" If $ChAgile = True Then $Msg &= @CRLF & @Tab & "Channel Agility" Else $Msg &= @CRLF & @Tab & "None." EndIF MsgBox(64, "WiFi Modes", $Msg) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ACalcutt Posted August 24, 2006 Author Share Posted August 24, 2006 (edited) Thank you PsaltyDS that was exactly what i wanted :-) not that anyone cares...but this is what it was for. (btw...this is a very rough draft...I was just trying to get something to work) this converts a txt export from netstumbler(with gps info) to a google earth kml file expandcollapse popup#include <file.au3> #include <Array.au3> Dim $gpsfile="gps.txt" Dim $output="output.txt" Dim $kml="output.kml" Dim $array ;read netstubler txt into array If Not _FileReadToArray($gpsfile, $gpsarray) Then MsgBox(4096,"Error", $gpsfile & " Not Found") Exit EndIf FileDelete ($output) FileWrite ($output, '<?xml version="1.0" encoding="utf-8"?>' & @CRLF _ & '<kml xmlns="http://earth.google.com/kml/2.0">' & @CRLF _ & '<Document>' & @CRLF _ & '<Style id="secureStyle">' & @CRLF _ & '<IconStyle>' & @CRLF _ & '<scale>.5</scale>' & @CRLF _ & '<Icon>' & @CRLF _ & '<href>http://mboffin.com/earthstumbler/wap-secure.png</href>' & @CRLF _;image from EarthStubler & '</Icon>' & @CRLF _ & '</IconStyle>' & @CRLF _ & '</Style>' & @CRLF _ & '<Style id="openStyle">' & @CRLF _ & '<IconStyle>' & @CRLF _ & '<scale>.5</scale>' & @CRLF _ & '<Icon>' & @CRLF _ & '<href>http://mboffin.com/earthstumbler/wap-open.png</href>' & @CRLF _;image from EarthStubler & '</Icon>' & @CRLF _ & '</IconStyle>' & @CRLF _ & '</Style>' & @CRLF _ & '<Folder>' & @CRLF _ & '<description>Netstumbler Parser - By Andrew Calcutt</description>' & @CRLF _ & '<name>Access Points</name>' & @CRLF _ & '<Folder>' & @CRLF _ & '<name>TEST</name>' & @CRLF _ & '<description>Access points with security enabled.</description>' & @CRLF) For $i = 1 To $gpsarray[0] _String($gpsarray[$i]) Next Func _String($string) If StringLeft($string, 1) <> "#" Then $result = $string $array = StringSplit ( $result, " ") If $result <> "" And IsArray($array) Then If $array[1] <> "N 0.0000000" And $array[1] <> "N 360.0000000" Then ;Start - thanks to "PsaltyDS" from the autoit forum :-) $HexIn = Number("0x" & $array[9]) Global $ESS = False, $IBSS = False, $CFPoll = False, $CFPollReq = False, $WEP = False, $ShortPreAm = False, $PBCC = False, $ChAgile = False If BitAnd($HexIn, 0x1) Then $ESS = True If BitAnd($HexIn, 0x2) Then $IBSS = True If BitAnd($HexIn, 0x4) Then $CFPoll = True If BitAnd($HexIn, 0x8) Then $CFPollReq = True If BitAnd($HexIn, 0x10) Then $WEP = True If BitAnd($HexIn, 0x20) Then $ShortPreAm = True If BitAnd($HexIn, 0x40) Then $PBCC = True If BitAnd($HexIn, 0x80) Then $ChAgile = True $Msg = "<br /><b>Flags: " & $array[9] & "</b>" If $HexIn Then If $ESS = True Then $Msg &= "<br />ESS (Infrastructure)" If $IBSS = True Then $Msg &= "<br />IBSS (Ad hoc)" If $CFPoll = True Then $Msg &= "<br />CF: Pollable" If $CFPollReq = True Then $Msg &= "<br />CF: Poll Request" If $WEP = True Then $Msg &= "<br />Privacy (WEP)" If $ShortPreAm = True Then $Msg &= "<br />Short Preamble" If $PBCC = True Then $Msg &= "<br />PBCC" If $ChAgile = True Then $Msg &= "<br />Channel Agility" EndIf ;End - thanks to "PsaltyDS" from the autoit forum :-) FileWrite ($output, '<Placemark>' & @CRLF _ & '<name></name>' & @CRLF _ & '<description><![CDATA[<b>SSID:</b>' & $array[3] & '<br /><b>MAC:</b>' & $array[5] & '<br /><b>Time Found:</b>' & $array[6] & '<br /><b>Longitude:</b>' & $array[1] & '<br /><b>Latitude:</b>' & $array[2] & "<br />" & $Msg & '<br />]]></description>') If $WEP = True Then FileWrite ($output, ' <styleUrl>#secureStyle</styleUrl>' & @CRLF) Else FileWrite ($output, ' <styleUrl>#openStyle</styleUrl>' & @CRLF) EndIf FileWrite ($output, '<Point>' & @CRLF _ & '<coordinates>' & StringReplace(StringReplace(StringReplace( $array[2], 'W', '-'), 'E', ''), ' ', '') & ',' & StringReplace(StringReplace(StringReplace( $array[1], 'S', '-'), 'N', ''), ' ', '') & ',0</coordinates>' & @CRLF _ & '</Point>'& @CRLF _ & '</Placemark>' & @CRLF) EndIf EndIf EndIf EndFunc FileWrite ($output, '</Folder>' & @CRLF _ & '</Folder>' & @CRLF _ & '</Document>' & @CRLF _ & '</kml>' & @CRLF) FileMove ($output, $kml, 1) Edited August 24, 2006 by ACalcutt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now