Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'socket'
- def getit(ip,port)
- s = TCPSocket.open(ip,port)
- s.send(254.chr,0)
- d = s.read(256)
- s.close()
- if d.getbyte(0) == 255
- mystring = d[3,d.length - 3]
- mysplit = mystring.split(167.chr.to_s,4)
- motd = mysplit[0]
- motd = motd.encode("us-ascii")
- online = mysplit[1]
- online = online.encode("us-ascii")
- max = mysplit[2]
- max = max.encode("us-ascii")
- return "#{motd} - #{online}/#{max}".gsub(0.chr,"")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement