All pastes #2074757 Raw Edit

Stuff

public text v1 · immutable
#2074757 ·published 2011-06-04 22:06 UTC
rendered paste body
#!/env/ruby

#@filename rpsyc.rb
#@author Alex Maurin
#Description A simple PSYC connection handler in ruby.

require 'socket'
puts 'connecting to:' + IPSocket::getaddress('psyced.org') + "\n"

puts 'connecting...'
host = 'psyced.org'
port = 4404
source = 'psyc://coyotama.pwnz.org/~coyotama'
context = 'psyc://psyced.org/@welcome'
nick = 'coyotama'
tag = rand(24)
tag++

s = TCPSocket.open host, port
s.puts(".\n")
s.puts(".\n")
s.puts(":_tag " + tag.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")
tag++

s.puts(":_target " + context + "\n")
s.puts(":_tag " + tag.to_s() + "\n")
s.puts(":_source " + source + "\n")
s.puts(":_nick " + nick + "\n")
s.puts("_request_input\n")
s.puts("Hello World!\n")
s.puts(".\n")
tag++

puts 'it seemingly worked...'