Mar 23, 2009

Let's get poking - (facebook poke with bash / perl)

facebook, bash, curl, poke..poking... that about covers it. This is neither elegant nor complete. Call it a "hack" if you will. Please keep in mind that facebook does not look favourably on browser side scripting so this is technically against their TOS. Having said that, unless you go all spammy on your friends, you should remain under the radar. As far as requests go, they'll think you're doing it manually..which is ok... (unless like I said you over do it..)

copy code below to new file
chmod it +x
the script take three args - email,password and UID of the person you wanna poke.
it will try to reuse any cookies left over from a previous session so if you have problems, delete the cookie file /tmp/email.fbcookie

have fun. don't spam!

This here is a new modified version running on Perl. working as of 26/03/2010
#---------------------------- #
# facebook poke script        #
# c2010 - KudaNai             #
# #
# --------------------------- #
# use with may    #
# get banned for violation    #
# of facebook ToS.            #
# good luck.                  #
# --------------------------- #
use strict;
use WWW::Mechanize;
use HTTP::Cookies;

my $username = 'yourusername'; #change these values.
my $password = 'yourpassowrd';

die "invalid number of arguments" unless (scalar @ARGV)==1;

my $mech = WWW::Mechanize->new();$mech->cookie_jar(HTTP::Cookies->new());
form_number => 1,
fields =>

$mech->content() =~ /post_form_id\"\svalue=\"(\w+)\"/;

foreach my $uid (@ARGV)
#print $mech->content();

and the old version for reference.




echo "logging in..."
curl -L --silent -A "MOZILLA/5.0" -b ${cookie} -c ${cookie} \
-d "email=${email}" -d "pass=${pass}" -d "login=Log+In" \ > /dev/null

gfid=`curl -L --silent -A "MOZILLA/5.0" -b ${cookie} -c ${cookie} \
"${uid}" | \
awk '{FS="gfid=";RS="\">";if (NR!=1 && $2!~/^$/) {print $2}}'`

curl --silent -G -A "MOZILLA/5.0" -b ${cookie} -c ${cookie} \
-d "id=${uid}" -d "gfid=${gfid}" -d "poke=${uid}" -d "refid=17" \
"" > /dev/null

if [ ! -e "${cookie}" ];then login;fi

Mar 6, 2009

Automatic Birthday Wishes on Facebook

EDIT: 29/06/2009 - a new, better and more elegant version has been released. I encourage users to switch over to that one.
Announcement is HERE

Well here we are again. Update time! :|

A few months ago I put together a little script that would automatically write on the walls of any of your friends of Facebook (limited to privacy settings of said individuals of course). The script was/is largely based on the Command line application by Dave Tompkins.

as of the most recent update, my script is no longer compatible with the new version. So a few changes were in order. So here it is.

unlike the previous version, you don't need to patch anything. Just a vanilla install of fbcmd + this script and that's it.

download script from HERE


1.Download and install fbcmd, follow instructions from HERE
2.Download my script, and put it anywhere you want.
3.Edit the email,password fields in the script: and locations of the fbcmd files
4.Run it manually, or setup a cron job for it.

the setup should be fairly straightforward. Please note that the wall post procedure is not officially supported by facebook, and may break from time to time (because facebook may change their page structure). Please report any bugs ASAP and I'll will try to have them fixed as soon as I can.

have fun!