ruby pastebin

Posted by coyo on Sun 5th Jun 17:28 (modification of post by view diff)
download | new post

  1. #!/env/ruby
  2.  
  3. #@filename rpsyc.rb
  4. #@author Alex "coyo tama" Maurin
  5. #Description A simple PSYC connection handler in ruby.
  6.  
  7. require 'socket'
  8. puts 'connecting to:' + IPSocket::getaddress('psyced.org') + "\n"
  9. #    snag ip address
  10.  
  11.  
  12. puts 'connecting...'
  13. host = 'psyced.org'
  14.     #address
  15. port = 4404
  16.     #port number
  17. source = 'psyc://coyotama.pwnz.org/~coyotama'
  18.     #where i'm coming from
  19. context = 'psyc://psyced.org/@welcome'
  20.     #chatroom i wish to connect to
  21. nick = 'coyotama'
  22.     #nickname to use
  23. tag = rand(24)
  24.  
  25. s = TCPSocket.open(host, port)
  26.     #opening outgoing tcp connection
  27.  
  28. s.puts(".\n")
  29. s.puts(".\n")
  30.     #initializing
  31.  
  32. s.puts(":_tag " + (tag += 1).to_s() + "\n")
  33. s.puts(":_source " + source + "\n")
  34. s.puts(":_nick " + nick + "\n")
  35. s.puts(":_target psyc://psyced.org/@welcome\n")
  36. s.puts("_request_context_enter\n")
  37. s.puts(".\n")
  38.     #join chatroom
  39. sleep(5)
  40.     #wait 5 seconds
  41.  
  42.  
  43. s.puts(":_target " + context + "\n")
  44. s.puts(":_tag " + (tag += 1).to_s() + "\n")
  45. s.puts(":_source " + source + "\n")
  46. s.puts(":_nick " + nick + "\n")
  47. s.puts(":_focus " + context + "\n")
  48. s.puts("_message_public\n")
  49. s.puts("sup, mah homies!\n")
  50. s.puts(".\n")
  51.     #post "sup, mah homies"
  52.  
  53. puts 'it seemingly worked...'
  54.     #print dubious confirmation that the script worked..
  55.  
  56. while true
  57.   sleep(5)
  58.   s.puts(".\n")
  59. end
  60.     #post keepalives until CNTL-C

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


I'm Human
Remember me



Captcha required for posting