So I'm working on a Teamspeak 3 serverquery client
What I want it to do is login as the server on the provided port and then skip to the last line of
To see the servers response to login.
The code I have so far is
Which returns
Which just idles until i CTRL+C.
If anyone could help it would be much appreciated.
I'm a perl coder mainly but I'm moving over to ruby as it seems more powerful and the syntax is just a lot nicer to look at.
😉
What I want it to do is login as the server on the provided port and then skip to the last line of
Code
server.getsThe code I have so far is
Code
#!/usr/bin/ruby
require 'socket'
host = ARGV.shift
port = ARGV.shift
id = ARGV.shift
queryport = ARGV.shift || 10011
if !id
abort "Usage: #{$0} [host] [port] [id] [queryport]\n"
end
server = TCPSocket.open(host,queryport)
if !server
abort("Cant connect to server on queryport #{queryport}\n")
end
puts "Enter Nickname to use"
nick = gets
nick = nick.chop
if nick =~ /\s/
nick.sub!(/\s/, '\s')
end
if nick.length < 3 || nick.length > 30
abort("Nickname must be 3 or more characters and less than 30 characters.")
end
puts "Connected to Server\n\n"
server.puts "use port=#{port}"
server.puts "clientupdate client_nickname=#{nick}"
server.puts "clientlist"
while bot = server.gets
while bot !~ /clid/i
next
end
puts bot
end
server.closeWhich returns
Code
$ ruby sp2.rb 1.1.1.1 9193 143
Enter Nickname to use
Nerv
Connected to ServerWhich just idles until i CTRL+C.
If anyone could help it would be much appreciated.
I'm a perl coder mainly but I'm moving over to ruby as it seems more powerful and the syntax is just a lot nicer to look at.
😉
