A few changes…

Howdy folks, firstly, there has been a lot of 3rd party development going on in relation to the black ops RCON tool, but none of it was by me. In fact, I found the game so infuriatingly laggy that I canceled my server so I no longer have anything to test on, as a result I have lost interest in the project and have closed the github repo; however, I will post the code here so anyone who wants it can take it and use it, do what ever you like with it under the MIT license.

RCON Source Code available here.

I am also unemployed now :) IMHO it was a great move, as it will allow me to have a break from doing anything really for the first time since I started school when I was 4 or 5… it has also given me the push I needed to go back to college and train myself up .

I have been working on a few projects now too with my increase in available time, however I’m not going to say much about them at the moment in case I don’t finish em.

Updated Black Ops RCON

Hey folks, this is just a quick update to let you know I have still been working on this… as it stands I have implemented two functions which work, and one which doesn’t. Slowly but surely I will be adding more and more functionality… unfortunately I don’t have RCON access to an unranked server at the moment, would anyone like to oblige me on that? :)

I would also like to mention at this point, that I have not looked into causing errors on the RCON, ie invalid logins etc… so be warned, while most of this should work, I cannot and will not guarantee it. Also, it is written for Python 2.6, not 3.whatever… I will be getting a few more people on board to help with this soon and we will be cleaning it up, adding error handling etc…

Anyways, here is what you have all been waiting for….

#!/usr/bin/python
 
'''
_______               ________      .___
\   _  \__  _  ______ \_____  \   __| _/
/  /_\  \ \/ \/ /    \  _(__  <  / __ |
\  \_/   \     /   |  \/       \/ /_/ |
 \_____  /\/\_/|___|  /______  /\____ |
       \/           \/       \/      \/
                    http://hackdev.com
 
Author:
    Steven from hackdev.com
 
File History:
    09/11/10:
        [+] Initial Inception. Proof of concept written entirely inline that
            allows for a single hard coded command to be sent to the server.
 
    10/11/10:
        [+] Creation of functions to handle the sending and receiving of commands.
        [+] Added the ability for users to change passwords in the configuration
            section of the script.
        [+] Broke commands, preambles etc... into variables for easier use & modification.
        [+] Added comments, previous code did not contain comments. ** Important **
    14/11/10:
        [+] Added command boGetPlayerList
        [+] Added command boSayToServer
        [+] Added command boSayToPlayer
        [+] Figured out that not everything has to be done in \x68\x65\x78
 
'''
 
import socket       #Used for creating the UDP sockets
 
#-----------------------------------------------------------------------------------
#   User Configurable Options
#-----------------------------------------------------------------------------------
 
boHost          = ""      #The server IP
boPort          = 3074                  #The server Port
boPassword      = ""              #The RCON Password
 
#-----------------------------------------------------------------------------------
#   End User Configurable Options
#-----------------------------------------------------------------------------------
 
svrAddress = (boHost, boPort)           #Used to create a tuple of host & port
 
#-----------------------------------------------------------------------------------
#   Command Definitions, sorry about the variables :(
#-----------------------------------------------------------------------------------
global cmdPreamble
cmdPreamble  = "\xff\xff\xff\xff\x00"                       #Preamble used to prefix the packet
global cmdSeporator
cmdSeporator = "\x20"                                       #Seporator used between password & command
global cmdPostamble
cmdPostamble = "\00"                                        #Ending of the packet, end of command
 
#-----------------------------------------------------------------------------------
#   Socket Generation
#-----------------------------------------------------------------------------------
udpSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 
#-----------------------------------------------------------------------------------
#   Function used to send commands to the server, function returns the
#   data returned from the query, unformatted...
#-----------------------------------------------------------------------------------
 
def boSendCommand(boCommand, boArgument=0, recvBufferSize=4096):
    if not boArgument:
        commandBuffer = cmdPreamble + boPassword + cmdSeporator + boCommand + cmdPostamble
    else:
        commandBuffer = cmdPreamble + boPassword + cmdSeporator + boCommand + cmdSeporator + boArgument + cmdPostamble
    boSentBytes = udpSock.sendto(commandBuffer, svrAddress)     #Send the data to the server
    if (boSentBytes < len(commandBuffer)):                      #Check the num of bytes sent
        print("An error was encountered while sending the command %s", boCommand)
    boRecvBuffer = udpSock.recv(recvBufferSize)                 #Receive the data returned
 
    if len(boRecvBuffer) > 0:                                   #Check to ensure there is something
        return boRecvBuffer                                     #Return the buffer
    else:
        return 0                                                #If theres nothing, return 0
 
def boGetPlayerList():
    playerlist = boSendCommand("teamstatus")
    if not playerlist:
        return 0
    else:
        return playerlist
 
def boSayToServer(message):
    if not message:
        return 0
    else:
        servermessage = boSendCommand("say", '"' + message + '"')
        if not servermessage:
            return 0
        else:
            return servermessage
 
def boSayToPlayer(message, playerID):
    if not message or not playerID:
        return 0
    else:
        playermessage = boSendCommand("tell", playerID + "\x20" + '"' + message + '"')
        if not playermessage:
            return 0
        else:
            return playermessage
 
print("Playerlist")
myPlayerList = boGetPlayerList()
print(myPlayerList)
 
print("Server Message")
myServerMessage = boSayToServer("Testing!")
print(myServerMessage)
 
print("Player Message")
myPlayerMessage = boSayToPlayer("Testing 123", "1")
print(myPlayerMessage)

Call Of Duty : Black Ops RCON Hacked! Kinda…

Yes, thats right folks, following a bit of a hacking session with the CoD:BO RCON client and wireshark, I now have some Python code that is capable of logging into the RCON on a CoD:BO server!

AFAIK, I am the first person in the world outside of treyarch to have done this and I have elected to share this with all of you, it may not be clean, and it may not be fancy… but damn it it works! (Its late and I haven’t slept…) Please keep in mind that the hostname and login message have been removed from the script as they contain identifiable information for my server. Enjoy this, and happy hacking! – I would also like to point out I wouldn’t have done this, at least as quickly, if it wasn’t for Ajurna of the mighty IrishPirates!

#
 
import socket
import string
 
boHost = ""
boPort = 3074
boAddr = (boHost, boPort)
 
boLoginMsg = "\xff\xff\xff\xff\x00___OMITTED____\x20\x64\x76\x61\x72\x6c\x69\x73\x74\x00"
 
udpSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
boSentBytes = udpSock.sendto(boLoginMsg, boAddr)
 
if (boSentBytes < len(boLoginMsg)):
    print("Message not sent...")
else:
    print("Message sent...")
 
boRecv = udpSock.recv(4096)
 
if len(boRecv) > 0:
    print("Received ", boRecv)
else:
    print("Received Nothing...")
 
udpSock.close()
 
fileHandler = open("out.txt", "w")
print >> fileHandler, boRecv

Roll your Own: CS:S Server (Part 3)

Ok, so from Part 1 and Part 2, you should now have a working Counter-Strike:Source server up and running, with Mani-Admin for your administration. Here is how to get MetaMod Source installed… this is going to be a really simple quick one to go on…

# cd /<yourserver>/cstrike/addons
# wget http://sourcemod.steamfriends.com/files/mmsource-1.7.1.tar.gz
# tar -zxvf mmsource-1.7.1.tar.gz
# rm mmsource-1.7.1.tar.gz

Ok, now we have MetaMod downloaded and extracted into the correct directory, last thing we need to do is create a VDF file to load it, MetaMod have a great VDF generator here or you can do the following…

# touch metamod.vdf
# pico metamod.vdf

Once in pico, paste the following text in ([shift]+[insert]), save with [ctrl]+o and exit with [ctrl]+x

“Plugin”
{
“file” “../cstrike/addons/metamod/bin/server_i486.so”
}

You can now restart your server and double check that MetaMod is running by typing “meta version” into the console. All done!

Roll your Own: CS:S Server (Part 2)

Ok, so from the last section of this you should have a working Counter-Strike:Source server up and running, just to make this a little bit easier on the admins, now we’re going to install Mani Admin Plugin. The first thing your going to need is Mani Admin Plugin it’s self…

# wget http://www.mani-admin-plugin.com/mani_admin_plugin/v1_2_beta_s/mani_admin_plugin_v1_2_beta_s.zip
# unzip mani_admin_plugin_v1_2_beta_s.zip

Once that’s done, you can move the files from the newly extracted directory to your ./<server>/cstrike directory as follows

# mv -R addons /<yourserver>/cstrike
# mv -R cfg/<yourserver>/cstrike
# mv -R materials/<yourserver>/cstrike
# mv -R sound /<yourserver>/cstrike

The next step is to add “exec mani_server.cfg” into your own server.cfg

# echo “exec mani_server.cfg >> /yourserver/cstrike/cfg/server.cfg”

Finally, we need to get mani running as an addon each time your server starts, the best way to do this is to create a mani_admin_plugin.vdf in /yourserver/cstrike/addons and add the following text to it.

“Plugin”
{
“file” “../cstrike/addons/mani_admin_plugin”
}

Mani should now be installed and running, the final steps is to add yourself to the /yourserver/cstrike/cfg/mani_admin_plugin/clients.txt file, this however I will not cover. All of the information on how to do this, in various different ways is available here.

Just so you know, I am currently working on a script that will allow for the automatic installation of ANY of the linux based Steam game servers just by answering a few questions. I’ll keep you posted on my progress with this.

Roll your Own: CS:S Server

*** UPDATE: Fixed some typo’s in the commands ***

This is how to set up a CS:S server on Ubuntu Linux. This is not a definitive guide, it is simply how I have done it. I have omitted some security precautions here as my server will not be going live online, and is only used for testing things in-house.

NOTE: lines of text preceded with a # symbol should be entered into a terminal.

First of all, you are going to need the HLDS tool from Steam, this is what allows us to get all of the required game files and update the server etc…

# wget http://www.steampowered.com/download/hldsupdatetool.bin
# chmod +x hldsupdatetool.bin
# ./hldsupdatetool.bin
# ./steam

This will download the hlds tool, make it executable, extract the steam tool, and update the steam tool. We now have everything required to get ready to install. The next step is to create somewhere for the server to go, and get all of the required files.

# mkdir CSS1
# ./steam -command update -game “Counter-Strike Source” -dir ./CSS1

This will begin the download of your new CS:S server, this can take some time and varies greatly depending on your download speed. At this point, you can consider what addons and configuration you want to use on your server, a handy tool I came across for the configuration files is available here. Once your CS:S server has finished installing, you can launch it by doing the following…

# cd CSS1
# ./srcds_run -console -game cstrike +map cs_office +maxplayers 16 -tickrate 66 -autoupdate -ip 192.168.0.100

The above command assumes the following, you want to play cs_office with the possibility of hosting 16 players on a 66 tick server who’s IP is 192.168.0.100, adjust these values to suit your own requirements.

Congratulations, you should now have a working CS:S server, but its not much fun without some plugins, so we’re gonna grab and configure Mani Admin Plugin and Eventscripts to throw on there for some easy administration and fun games. This will be continued in part 2.