Valhalla Legends Forums Archive | /WHOAMI -- Introductions | `whoami`=> "bigmac\n"

AuthorMessageTime
i8igmac
i have been working with ruby for a little while now and its alot of fun... i have script a few proxys and other tools for automating task's...

i have been searching your forum for ruby document but i only see a few examples of pack and unpack...

my first question would be, is it possible to establish a connection to the battlenet servers with ruby? i have been trying and all my attempts fail...
September 15, 2011, 4:12 PM
MysT_DooM
Anything is possible.  Have you read up on Ruby Socket Programming?  I googled a bit and theres a lot of info out there for it. 

Also check out bnetdocs.org once you get a good foundation on ruby socket programming.
September 16, 2011, 12:14 AM
Alendar
Welcome to the forums! Looking forward to seeing any possible productions you may make. =)
September 16, 2011, 12:37 AM
i8igmac
i have made some clients and proxys, mosty http, some ftp and ssh but these are all simple...

i have never done anything with headers

[code]
require 'socket'
bnet_server=TCPSocket.open('useast.battle.net','6112')
bnet_server.puts("") # 01
bnet_server.recv
bnet_server.puts"�P:?????68XI3RAW???SUne��k�?? ?? ??USA?United States?"
bnet_server.recv
[/code]

this was my first attempt to establish a connection, i never receive a response, im sure once i get past this part things will start to make sense...

i will start reading more into tcp connections.
September 16, 2011, 2:26 AM
rabbit
I'm going to go out on a limb and assume that Ruby behaves like other languages and has a state change callback somewhere.
September 16, 2011, 5:31 AM
Myndfyr
@iBigmac: You'll be far, far better off not treating the connection data as a string.  I'm sure Ruby has a way to manipulate a byte stream; you'll be far happier using that.  (Most people here would call that a databuffer or packet buffer). 
September 16, 2011, 2:58 PM
i8igmac
thanks for your help guys I figured it out.

I've pulled the hex value from wireshark and used [hexdata].pack("H")

I have received response and things now makes sense !
September 19, 2011, 3:50 PM

Search