Ruby msn example conn


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. def connect(host = @ns_host, port = @ns_port)
  2. print "Connecting %s:%d\n" % [host, port]
  3. @socket = TCPSocket.new(host, port)
  4. # send("VER", "MSNP%d" % [@version])
  5. send("VER", "MSNP15 MSNP14 MSNP13 CVR0")
  6. send("CVR", "0x0409 winnt 5.1 i386 MSG80BETA 8.1.0168 msmsgs %s" % [@@user])
  7. send("USR", "SSO I %s" % [@@user]) do |c|
  8. case c.uid
  9. when "XFR"
  10. x_host, x_port = c.args[2].split(":")
  11. connect(x_host, x_port)
  12. return
  13. when "GCF"
  14. get_payload(c.args[1]) do |p|
  15. doc = REXML::Document.new p
  16. # doc.write($stdout, 1, true)
  17. doc.elements.each("//imtext") do |i|
  18. p Base64.decode64(i.attributes["value"])
  19. end
  20. end
  21. read do |c|
  22. policy = c.args[3]
  23. nonce = c.args[4]
  24. p nonce
  25. data = @@tokens[1].data
  26. key = @@tokens[1].proof
  27. r = mbi_encrypt(Base64.decode64(key), nonce)
  28. @@master_token = Base64.encode64(r).gsub("\n", "")
  29. send("USR", "SSO S %s %s" % [data, @@master_token]) do |r|
  30. p r
  31. end
  32. start()
  33. end
  34. end
  35. end
  36. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.