cphulkd locked you out of cPanel/WHM?

Here’s a handy set of instructions that you can use if you accidentally got yourself banned or locked out of the cPanel/WHM login interface due to repeated failed login attempts. This assumes that you have access to the server’s command line and root access to the MySQL server, and will clear the IP address blacklist and the locked user accounts list.

First log into your server, and select the cphulkd database:

mysql cphulkd;

Now you want to clear the IP address blacklist:

DELETE FROM `brutes`;

After clearing the IP address blacklist, you might want to also clear the account locks so you can log back in:

DELETE FROM `logins`;

An alternate way of gaining access back to the server is to add YOUR IP address into the whitelist:

INSERT into `whitelist` values (;

Now you can exit the MySQL command line, and it should all be back to normal!


Continue Reading

Root Login Notification

When administering a Linux server, especially when several people share root access (with sudo, don’t give out that root password!) – it’s important to know when other root users are logged in. This is also a simple form of intrusion detection, since as soon as someone logs into the root shell an email will be dispatched out.

This only happens when the .bashrc file is executed; just using the “sudo” command will not trigger this, but “sudo su – ” will. I also used “chattr +i” to the .bashrc file to set the immutable bit, so the file cannot be modified or changed, not even by the root user. On my server, it also sends a text message to my phone as soon as someone logs in as root. The message will show the username that executed the sudo command, and the IP address that the user is remotely logged in from.

echo -e “`date`\n`who -m –ips|awk ‘{print $1” “$5}’|sed -e ‘s|(||g’ -e ‘s|)||g’ -e ‘s|-|.|g’|cut -d: -f1`” | mail -s “root login alert” email@yourdomain.com

Here’s what the script outputs in the message that it emails:

Tue May 18 15:22:23 CDT 2010


Continue Reading

Automatic Ksplice updates

Here is a little bit of shell script as a crontab that you can use to automate the checking of Ksplice kernel updates.  This particular one does the following:

  1. Activates at midnight every day, server time
  2. Checks if there are updates
  3. If there are updates available to the kernel, to automatically apply the update
  4. Once the update is applied, email the updates applied to the specified email address “youremail@address.com”

This script does not output anything if there are no updates to apply. Happy scripting!

0 0 * * * uptrack=`/usr/sbin/uptrack-upgrade -y`; uptrackCheck=`echo $uptrack | grep -o "Nothing to be done."`; if [[ $uptrackCheck != "Nothing to be done." ]]; then echo "$uptrack" | mail -s "Ksplice kernel upgraded" youremail@address.com; fi;

Some things that you can do to make it more interesting:

  • Also have it send you a text message on your phone, by emailing the SMS gateway of your service provider
  • Check more often, by modifying the crontab entry (don’t make it too often that you get blacklisted for abuse!)
Continue Reading

Going from hex to binary in Linux

If you find yourself with a block of \x encoded hex that you need converted back to it’s binary¬†equivalent – in my particular case, an image encoded as a hex block back to it’s native JPEG file, you can use this short code snippit:

cat <input file> | sed -e ‘s/\\x//g’ -e ‘s/”//g’ -e ‘s/^[ \t]*//’ | xxd -p -r – <output file>

Adjust the sed arguments as needed to produce the trimming that you need to feed into xxd – when you pass -p to xxd you instruct it to take input as hexadecimal plaintext, and -r tells xxd to go from the hexadecimal string back it’s binary equivalent.

In this case, I used this to extract the images from the icons.c file for Minidlna.

Thanks to this LinuxJournal article for how to do a reverse hex dump.

Continue Reading

Installing miniDLNA on Ubuntu PowerPC

I don’t think I’ve seen anyone maintaining packages for the excellent MiniDLNA media server for Debian or Ubuntu. The instructions provided here should work for both Intel and PPC builds (maybe others?) of Ubuntu and Debian Linux.

  1. Run this command to get the pre-req packages needed to build MiniDLNA:
    • sudo apt-get install libexif-dev libjpeg62-dev libid3tag0-dev libflac-dev libvorbis-dev libsqlite3-dev libavformat-dev cvs make
  2. Log in and check out (download) the source code for MiniDLNA from SourceForge:
    • cvs -z3 -d:pserver:anonymous@minidlna.cvs.sourceforge.net:/cvsroot/minidlna co -P minidlna
  3. Change into the directory and build, then install it!
    • make
    • sudo make install
  4. That’s it!
Continue Reading

MixRiot.com Music Ripper

Here’s a lazy liner that I cooked up to rip music from MixRiot.com – simply replace the URL variable with the page that contains the music and it will dump the music using wget with an MP3 extension!

url=”http://www.mixriot.com/category/essential-mix/browse-show/broadcasts/bbc/radio-1/2009″; IFS=$’\n’;title=();id=();for i in `GET $url | grep FlashVars | egrep -o “mixriot.com%2Faudio%2Fplay%2F[0-9]{4}” | cut -b 30-`; do id=( “${id[@]}” “$i” ); done; for j in `GET $url | egrep -o “<h2><a href=[[:print:]]{1,} title=[[:print:] ]{1,}>[[:print:] ]{1,}</a></h2>” | cut -d\” -f4`; do title=( “${title[@]}” “$j”); done; for (( k = 0 ; k < “${#id[@]}” ; k++ )); do wget -O”${title[$k]}.mp3″ http://www.mixriot.com/audio/play/${id[$k]}; done;

Continue Reading

Changing the default resolution of a Logitech webcam

I found myself needing to take some photos with my webcam because it was a simple setup and had excellent image quality when given enough light. However, when using the default webcam application in Windows XP/Vista/7, it will only capture images in 320×240; hugely disappointing when the webcam will do up to 2MP. Enter the DefResCh tool – which I found in this thread on the Logitech developer forums. Of note, you will need to install the Logitech webcam drivers to make this tool work; the default drivers that Windows installs does not work with this tool.

Continue Reading


Modeled after falling maple seeds, this tiny autonomous monocopter has one asymmetric wing and rotates along it’s center of mass to produce lift. On-board camera at about 5:40 into the video, Hack A Day suggested using the microcontroller to take a snapshop at the same position of rotation to make one stable video.

Continue Reading