Skip to content

Instantly share code, notes, and snippets.

@jimbo8098
Last active January 11, 2022 02:07
Show Gist options
  • Save jimbo8098/7a95c826a642bd28d0606410e57e359b to your computer and use it in GitHub Desktop.
Save jimbo8098/7a95c826a642bd28d0606410e57e359b to your computer and use it in GitHub Desktop.
A quick rundown on getting the current game status for a running KF2 webadmin instance

The webadmin page displays the current game status in the top right of the screen which includes:

  • Map
  • Current player count
  • Max player amount
  • Current wave
  • Maximum waves

This is returned in HTML format so needs to be parsed if you intend on doing something smart with the output. However getting it is a little tricky due to it being behind the webadmin's login wall.

curl http://server:8080/ServerAdmin/current+gamesummary -b authcred="<authcred>" -b sessionid="<sessionid>" -X POST

The easiest way to do this is to just log into the webadmin using your normal credentials then wait on your browser pinging it for the first time. This is done once every few seconds. You can fish the two cookies out of the networking tab of your developer tools.

The authcred is generated using the following Javascript

var hashAlg = "";
$(document).ready(function(){
    if (hashAlg != "sha1") {
        return;
    }
    $('#loginform').submit(function(){
        var hashme = $('#password').val()+$('#username').val();
        $('#password_hash').val("$sha1$"+hex_sha1(hashme));
        $('#password').val("");
        return true;
    });
});

While the sessionid is sent back by the server when you browse to the login page. Once you're there, you can just return that sessionid which is verified on the webadmin portal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment