frostschutz / sourcelib Goto Github PK
View Code? Open in Web Editor NEWPython implementation of Valve Source Dedicated Server Query/RCON/Log protocols.
Python implementation of Valve Source Dedicated Server Query/RCON/Log protocols.
Hi, I was encountering an odd error where most of the log lines were not being properly parsed, when I discovered that my server (which is quite popular and doesn't crash much) had been logging UIDs higher than 999--with 4 characters. I discovered that the regex for player uids does not take this situation into account and the maximum UID one can have is 999.
Changing all the UIDs regex's, such as "<attacker_uid>[0-9]{1,3}" to "<attacker_uid>[0-9]{1,4}" fixed this issue.
test issue body...
Hey there, I'm trying out a simplified version of record.py to test out getting a log from my game server. I changed the IPs to reflect the game server:
rcon = SourceLib.SourceRcon.SourceRcon('66.221.253.125', 27017, 'rcongoeshere')
query = SourceLib.SourceQuery.SourceQuery('66.221.253.125', 27017)
...
and then below
...
server = SourceLib.SourceLog.SourceLogListener(('mylocalip', 7130), ('66.221.253.125', 27017), MyLogParser())
I modified the code to just print to the terminal to test the log (and then later modified SourceLog to test if anything was coming in, and don't seem to be getting any data from the gameserver. Rcon commands work, and the response works, and I'm able to run the command logaddress_add myip:7130 to add myself to the UDP list.
I'm also able to get the player list if I type status. Also, the gameserver is logging to UDP, as reported by the log command.
I'm running in Linux, and wondering if a port needs to be opened in order to get the stream, or if some other trick is necessary in order to get the log. HLSW works fine for me when I use Windows...
Thanks for the help. Your project looks very neat.
In SourceQuery.info() line 226 and 239:
result['version'] = packet.getByte()
…
result['version'] = packet.getString()
Maybe you name the first one "protocol_version" or the second "game_version".
Example: FuG's tf2 server: 72.9.144.108:27015
tag: �p
�?�@�ctf,increased_maxplayers
or another: \xFD\xAC\x08@\x01
My own servers work fine, but a vast majority of tf2 servers query this way.
I initially picked your lib because it worked a lot better than other libs for l4d, unfortunately it seems to have some bugs of its own on certain games.
import SourceQuery
server = SourceQuery.SourceQuery('81.93.240.69', 27105)
server_info = server.info()
File "xxxxxxxxxx/SourceQuery.py", line 237, in info
edf = packet.getByte()
File "xxxxxxxxxx/SourceQuery.py", line 70, in getByte
return struct.unpack('<B', self.read(1))[0]
struct.error: unpack requires a string argument of length 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.