Jump to content

Binary to readable ASCII text format?


Recommended Posts

Peers: (binary model), the peers value may be a string consisting of multiples of 6 bytes. First 4 bytes are the IP address and last 2 bytes are the port number. All in network (big endian) notation. The list of peers is length 50 by default. How can I convert the attached?

http://en.wikipedia.org/wiki/Endianness#Big-endian

I've tried BinaryToString with no luck. Thanks in advance.

Peers.txt

Edited by Decipher
Spoiler

censored.jpg

 

Link to comment
Share on other sites

Lookup DllStructCreate in help. Read carefully and come back if you don't succeed.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Would you please give me an example. I read the documentation for the DllStructCreate function but its confusing to me on how I can use it to change this: uïiƒ¡ã into 127.0.0.1:80

What type would I be using, etc.

Spoiler

censored.jpg

 

Link to comment
Share on other sites

you could create a struct with "char"´s with the lenght of your "text" and fill the struct with the text

create a struct with "bytes" at the same position

then read these "bytes" one by one and you get the conversion....

Link to comment
Share on other sites

What type would I specify because I don't think its integers?

So I read the bytes one by one and the read information is ASCII?

I'm still completely lost as to how this actually works.

I've tried:

$a = DllStructCreate(FileRead(@DesktopDir & "Peers.txt"))
For $i = 1 To 10
MsgBox(0,"",DllStructGetData($a, $i))
Next

Dosen't work. Is it possible that the character's ASCII code is what I'm after? I could code that but I wouldn't have a way to verify that it is correct.

Edited by Decipher
Spoiler

censored.jpg

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...