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

Just a general update…

It’s been quite a while since I’ve posted  anything, I’ve been very busy lately but since I’m out sick now for a few days, I have a bit of time to update…

If you have tried to play Fallout 3 using an Asus branded NVidia card, and it crashes stating “Fallout 3 has stopped working” every time you try to load a new game, check and see if you have Asus Gamer OSD installed, if you do, get rid of it. Something the overlay does interferes with the game  and causes this to happen…

I have been doing some more work on the lighting for the man cave so I have some Python code that will pull the Average color (not the most predominant, yet, wont be hard, but I am lazy) so here it is, please keep in mind its not nice, fast or clean… for high res images it takes a few seconds to do its thing…

#!/usr/bin/env python
 
#
# PIL Image Module Handbook - http://www.pythonware.com/library/pil/handbook/image.htm
#
 
from PIL import Image
from optparse import OptionParser
 
def processImageAverage(imageFile):
    image = Image.open(imageFile)     #open the image for processing
    pixels = list(image.getdata())    #break the image down into a list of pixels, each pixel contains a list of red,green,blue
 
    totalpx = 0 #set some default values to start counting...
    redpx = 0
    greenpx = 0
    bluepx = 0
 
    for pixel in pixels:    #loop through the lists and build the values.
        totalpx += 1
        redpx += pixel[0]
        greenpx += pixel[1]
        bluepx += pixel[2]
 
    redavg = redpx / totalpx   #generate the averages
    greenavg = greenpx / totalpx
    blueavg = bluepx / totalpx
 
    print "\nTotal Pixels:\t", totalpx     #and write them out.
    print "Red Average:\t", redavg
    print "Green Average:\t", greenavg
    print "Blue Average:\t", blueavg
    print "HEX Color:\t#%x%x%x" % (redavg, greenavg, blueavg)
 
def main():
    parser = OptionParser("Usage: %prog source")
 
    (options, arguments) = parser.parse_args()
    if len(arguments) != 1:
        parser.error("Please specify a single input file.")
 
    processImageAverage(arguments[0])
 
if __name__ == "__main__":
    main()

I have a new job now, I’m no longer a software validation engineer (tester), I’m now an IT Support Engineer (IT Techie…) which is kinda nice….

Well… that is for now…

Teamspeak 3 server on Ubuntu

Well, Teamspeak have finally released their new server platform for a public BETA test, although supposedly in this state the code is not meant to be stable, it appears to be working quite well on my Ubuntu server here at home. This is what I done to get it up and running – as a service from init.d no less. Before doing any of the following steps, please be aware that this IS BETA code and WILL contain bugs that may introduce security issues. The first step is to create a user that the Teamspeak executable can run as, this user should have a complex password for security reasons. This user will also not require a shell account.

sudo adduser teamspeak

Fill in the questions presented by the adduser application.

sudo usermod -s /bin/false teamspeak

The above command will change the users shell to be /bin/false ie. no shell. Now it is time to go and get Teamspeak… visit http://www.goteamspeak.com and find the correct package for the architecture you wish to use ie. Teamspeak_3.0.0-Beta5-32bit…

wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-5/teamspeak3-server_linux-x86-3.0.0-beta5.tar.gz tar -zxvf teamspeak3-server_linux-x86-3.0.0-beta5.tar.gz

Now its time to move the new TS3 directory to its new home…

sudo mv ./teamspeak3-server_linux-x86-3.0.0-beta5 /opt/TS3 sudo chown -R teamspeak /opt/TS3

The above will place TS3 in /opt/TS3 and give ownership of the contents to the user teamspeak. It is now possible to run Teamspeak, however as veteran Teamspeak users will know, the first time you run the Teamspeak server you are presented with a username/password combo that cannot be recovered without resetting the server. In TS3 you will also be presented with a `token` (all of this is described in the Teamspeak documentation). So for the first run, the following command will allow you to gather these details, they should be noted carefully for future reference.

sudo start-stop-daemon –chuid teamspeak –chdir /opt/TS3 –start –exec /opt/TS3/ts3server_linux_x86

From this, you should see the serveradmin user and password. You can now ^C that and be returned to the normal shell, if you cat /opt/TS3/logs/* you will be presented with the token you require to obtain server-admin status on the new server. The last part is to create a script for /etc/init.d/ to launch Teamspeak each time the system is booted to the correct runlevel. /etc/init.d/skeleton provides a suitable framework for this, here is the script I am using, just about… NOTE: WordPress does not want to format this correctly for me, as such, here is a link to the file in a tar archive. If you follow these instructions and are running a 32bit server, the following file will work out of the box. /etc/init.d/teamspeak This file must then be made executable with

sudo chmod +x /etc/init.d/teamspeak

And finally, the init file must be symlinked to each of the runlevel start dirs using the following…

sudo ln -s ../init.d/teamspeak /etc/rc0.d/K21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc1.d/K21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc2.d/S21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc3.d/S21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc4.d/S21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc5.d/S21teamspeak sudo ln -s ../init.d/teamspeak /etc/rc6.d/K21teamspeak

Viola, you should now have a working Teamspeak 3 server.

BOOTNOTE:

For my initial install, and for the basis of the majority of this, I used this as a reference. Items listed in bold with ** are most likely not the correct file names for the command, I am not close to my server or an available shell to pull the correct parameters at present, but I will update ASAP. As an additional side note, my first impressions of TS3 are very good… It has tons of new features, looks good and the voice quality is very good indeed. My only concern is however the permissions system is very bulky, difficult to understand, and unless you are reasonably familiar with administering a Teamspeak server already, the documentation is not as straight forward as people believe. Still, however, a great job. Well done Teamspeak 3 development team!

UPDATE: Fixed formatting issue, kinda… provided link to pastebin.

UPDATE: Fixed information regarding server executable. Added /etc/init.d/teamspeak file, available for download here, removed pastebin link.

#! /bin/sh
### BEGIN INIT INFO
# Provides:          teamspeak
# Required-Start:    networking
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: TeamSpeak Server Daemon
# Description:       Starts/Stops/Restarts the TeamSpeak Server Daemon
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="TeamSpeak Server"
NAME=teamspeak
USER=teamspeak
DIR=/opt/tss2_rc2
DAEMON=$DIR/server_linux
#PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

d_start() {
        start-stop-daemon --start --quiet \
                --chuid $USER \
                --chdir $DIR \
                --exec $DAEMON \
                > /dev/null \
                || echo -n " already running"
}

d_stop() {
        start-stop-daemon --stop --quiet \
                --chuid $USER \
                --chdir $DIR \
                --exec $DAEMON \
                || echo -n " not running"
}

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        d_start
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        d_stop
        echo "."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: $NAME"
        d_stop
        sleep 15
        d_start
        echo "."
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

exit 0

Getting Manhunt to run in Windows Vista

RockStar Manhunt

Many people have tried to run Manhunt on Windows Vista but without any luck, through a fair ammount of Googling in the past, I came across this fix…

Step 1:
Download XVI32 from http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm

Step 2:
Back up your manhunt.exe file

Step 3:
Open manhunt.exe in XVI32

Step 4:
From the addreess tab at the top, select “Goto”
Select the hexedecimal option and set the go mode to “Absolute”

Step 5:
In the Goto box, enter in 08DE

Step 6:
If all above went well, you should see a box highlighted containing 6A,
modify this so that it says 2A.

Step 7:
Save the file and exit the editor.

Step 8:
Play.

Thanks to Sonnilivo for the great information relating to this!

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.