CS Server Info

By armagidon on Dec 14, 2008

A very simple Counter-Strike server info

import socket

def parsing(txt):
    txt=txt.replace('\377', '')
    if txt.find('m') == 0:
        serv_name=txt.split('\0') [1]
        serv_map=txt.split('\0') [2]
        serv_engine=txt.split('\0') [3]
        serv_game=txt.split('\0') [4]
    print 'Server name:', serv_name
    print 'Game:', serv_game, '('+serv_engine+')'
    print 'Map:', serv_map

ip='' #write server ip

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((ip, 27015))

sock.send('\377\377\377\377TSource Engine Query\0')

while 1:
    text=sock.recv(1024)
    text=parsing(text)
    if not text:
        break
    print '[GET]', text

sock.close()

Comments

Sign in to comment.
FFenix   -  Nov 02, 2011

But good idea!

 Respond  
FFenix   -  Nov 02, 2011

Not working for me...

 Respond  
PATX   -  Jun 25, 2009

copy it into a file called script.py then go to the terminal and do "python script.py".

 Respond  
envious1   -  Mar 06, 2009

how do you work it?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.