Jump to content



Photo

Binary to readable ASCII text format?


  • Please log in to reply
5 replies to this topic

#1 Decipher

Decipher

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 17 June 2012 - 06:16 PM

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.

Attached Files


Edited by Decipher, 17 June 2012 - 06:40 PM.

Posted Image





#2 jchd

jchd

    Whatever your capacity, resistance is futile.

  • MVPs
  • 3,251 posts

Posted 17 June 2012 - 08:54 PM

Lookup DllStructCreate in help. Read carefully and come back if you don't succeed.
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQL tutorial (covers generic SQL, but most of it apply to SQLite as well)An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious workPCRE v8.32 regexp pattern documentation. AutoIt uses a slightly older version so that more advanced features are not all available.RegExp tutorial: enough to get started

#3 Decipher

Decipher

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 17 June 2012 - 09:17 PM

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.
Posted Image

#4 AndyG

AndyG

    Prodigy

  • Active Members
  • PipPipPip
  • 187 posts

Posted 18 June 2012 - 05:35 AM

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....

#5 Decipher

Decipher

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 18 June 2012 - 03:10 PM

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, 18 June 2012 - 08:32 PM.

Posted Image

#6 Decipher

Decipher

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 337 posts

Posted 21 June 2012 - 02:48 AM

.
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users