Posted by coyo on Sun 5th Jun 17:28 (modification of post by view diff)
download | new post
- #!/env/ruby
- #@filename rpsyc.rb
- #@author Alex "coyo tama" Maurin
- #Description A simple PSYC connection handler in ruby.
- require 'socket'
- puts 'connecting to:' + IPSocket::getaddress('psyced.org') + "\n"
- # snag ip address
- puts 'connecting...'
- host = 'psyced.org'
- #address
- port = 4404
- #port number
- source = 'psyc://coyotama.pwnz.org/~coyotama'
- #where i'm coming from
- context = 'psyc://psyced.org/@welcome'
- #chatroom i wish to connect to
- nick = 'coyotama'
- #nickname to use
- tag = rand(24)
- s = TCPSocket.open(host, port)
- #opening outgoing tcp connection
- s.puts(".\n")
- s.puts(".\n")
- #initializing
- s.puts(":_tag " + (tag += 1).to_s() + "\n")
- s.puts(":_source " + source + "\n")
- s.puts(":_nick " + nick + "\n")
- s.puts(":_target psyc://psyced.org/@welcome\n")
- s.puts("_request_context_enter\n")
- s.puts(".\n")
- #join chatroom
- sleep(5)
- #wait 5 seconds
- s.puts(":_target " + context + "\n")
- s.puts(":_tag " + (tag += 1).to_s() + "\n")
- s.puts(":_source " + source + "\n")
- s.puts(":_nick " + nick + "\n")
- s.puts(":_focus " + context + "\n")
- s.puts("_message_public\n")
- s.puts("sup, mah homies!\n")
- s.puts(".\n")
- #post "sup, mah homies"
- puts 'it seemingly worked...'
- #print dubious confirmation that the script worked..
- while true
- sleep(5)
- s.puts(".\n")
- end
- #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.