So the following request:
torrent.ubuntu.com:6969/announce?info_hash=%02%21%CA%F9j%A3%CB%94%F0%F5%8DE%8Ex%B0%FC4J%D8%BF&peer_id=ABCDEFGHIJKLMNOPQRST&port=6881&uploaded=0&downloaded=0&left=3353370624&compact=0
results in an Announce file being served up. After that file is bendecoded you get:
{'peers': '\xb9\x15\xd9\x08\xd8\x05[\xbd_\x15\x1b!', 'interval': 1800, 'complete': 5, 'incomplete': 1}
I am pretty much stuck about the
'\xb9\x15\xd9\x08\xd8\x05[\xbd_\x15\x1b!'
with compact=1 you get:
'\xbd_\x15\x1b\n\xb9\x15\xd9\x08\xd8\x05'
If this is network order (little endian)?
From here I read:
Note if you get the peers in the binary model that the last two bytes together encode the port number (i.e. ‘\x1a\xe1′ = 26 * 256 + 225 = 6881).
So maybe '\xd8\x05' make up the port: 216 * 256 + 5 = 55301 or maybe not.
Can someone explain to me how to parse these hex numbers into ip:port addresses?
Been googling this for a while not found much so any help would be appreciated.
You should read the bittorrent specification and compact announce extension
network order (little endian)?
"Network order" without further qualification generally is big endian.
Can someone explain to me how to parse these hex numbers into ip:port addresses?
They're not hex numbers. bencoded data is raw binary without any specific charset. Whatever you're using to display it creates the hex output.