Browsing all articles tagged with php



Firebridge Overview

I’ve always been semi interested in botnets/trojans and targetted attacks and the way they get their data in and out and how the command and control centres work. One of the things i’d usually do is see if I can determine where the traffic is going from the bot (infected machine) and this would obviously point me to the c&c. I’d then fire up Maltego and start playing with that IP/hostname to see where else it appears, what other things are linked to it and so on. One of the concepts I was playing around with was how could you hide where your c&c and from this FireBridges as a concept where created.

Read more »

Hey guys,

I saw the pastebin guys put out a list of the IP addresses that have been attacking them for people to check if they were, I wrote a quick little script to test this at:

Secondly, i see pastelert broke with the new GUI change on pastebin, I’ve fixed it on mine and I will post an update sometime here, if its urgent just drop me a mail and i’ll send the patch :)



Sorry guys, I noticed that I haven’t been getting any pasteLert updates, and i just realised why (see above picture for my reaction).

Change line 4 in truncPastes.php from:

mysql_query(“truncate pastebin”);


mysql_query(“delete from pastebin”);



Truncate automatically resets the auto-incrementing IDs so that when the table was truncated pastes started from ID 0 again, which when checked against what the last ID sent to the user was obviously lower. Sorry for the headache, to fix it, apply the above then run:

update alerts set LastID = 0;


Mah bad,


Archive for pasteLert

So i finally got round to putting the source together and writing this out. We’ve been really busy with Blackhat training at work and so on and i’m generally just lazy. Also releasing now mostly because the mysql database on my linode keeps crashing, its just too small a box to keep *all* pastebin entries. The code is messy, so expect arb/no commenting but its pretty straight forward, feel free to shoot through any questions you have. Also i messaged pastebin to see if they’d implement something like this or let me do it, but i didnt get any responses to any of the messages :(

Anyway, here is the basic rundown:

  • Setup your mysql, create a database ‘pastebin’ – Google will give you this info :D
  • Drop the structure in, its in the archive as pastebinStructure.sql. mysql -u root -p pastebin < pastebinStructure.sql
  • Extract the archive to its own directory in your webroot, preferably ‘pasteLert’ :)
  • Change the setdb.php file to your mysql details. Edit alerts.php to include your email and location information rather than mine
  • Setup the crons as below


Basically there are 4 cron jobs that you need to add:

  • pullPastebin.php – this will go to and get the pasteIDs and add them to `pastebin`.`pastebin`, I generally run this every 2 minutes and my cron looks like this:
    • */2 * * * * php /var/www/html/
  • pullPastes.php – this script then goes and pulls each paste with a random delay between 0-5 seconds (see line 14 if you want to change that). I generally let this run every 10 minutes and looks as follows:
    • */10 * * * * php /var/www/html/
  • sendAlerts.php – this script sends out the alerts via email, this is really up to you, obviously as close to 10 minutes means its as close to when you have the data, mines at 15 mins:
    • */15 * * * * php /var/www/html/

Cron Part 2!
So the reason my box was falling over was that every day i’d push all the pastebin’s from that day into another table (pastebinOldData). Essentially i have now changed mine to stop doing this and rather truncated the daily log instead of saving the data.  You however hopefully have a bigger box and can store all the data, or you can always just truncate the data, so you need to pick one of the two files, either truncPastes.php or rotatePastes.php.

0 1 * * * php /var/www/html/

0 1 * * * php /var/www/html/

I think that pretty much covers it, feel free to mail in what you are looking for if you need any help.



Hey guys,

So here is my latest project, extending from the previous pasteScraper to do something a little different with the pastebins. Essentially i recreated google alerts but with a bit more searchiness (yes, i make up words now too).

How it Works

  • I enumerate all new pastes from every minute and add them to a ‘download’ queue.
  • New pastes are then downloaded to a local database
  • Alerts are periodically cron’d
  • Search functionality is via a fulltext search of pastes

What does it give me?

  • The ability to search for *anything* on
  • Semi-realtime searches
  • Email alerts when your term is hit!
  • RSS feeds for searches
  • The ability to search with AND keywords in pastebins

How it is all going to fall apart

I dont really see this as a long term project, merely something that shows a PoC for how much stuff is leaking out via and how cool it really is. Some issues i see that may happen with this:

  • People will switch to more secure pastebins that don’t allow indexing, don’t have archive pages and arent indexed by search engines
  • My small linode will fall to pieces because the fulltext like queries are painfull
  • will not be impressed with me doing this and start blocking it

Linkage, feel free to play/comment/etc :)



p.s. Thanks to Chris Hadnagy and Roelof Temmingh :D

So this is the only entry i have where i’ve built an app that wont work from day 1.

“Oh why andrew, why?” you might say, but as I shrug, this was not my fault. So a while back Samy Kamkar produced his geolocation proof of concept code which works awesomely at being able to take an AP MAC Address to GPS Co-ordinates. Sadly now however Google location services seem to be broken at the moment with both Samy’s and my code being horribly broken with the results either being the same GPS Co-ordinates or 0,0.

This happened of course only *after* i had completed my app (had to do multithreading and slap a design on it) .

But anyway, here is the basic idea of it:

  • Recieve in a NON GPSd airodump-ng csv file
  • Parse out all of the AP MAC Addresses
  • Take these to GPS co-ordinates to street addresses via opennominatim
  • Return this response either as a KML file (plotted on google earth)
  • OR as a text file to simply display the results

So anyway, you can have a look at the application over at . Currently still in my shite naming ‘convention’ this one is called “AirodumpvsGEO”.


So i was chatting to Chris Hadnagy and he was having a bit of an issue getting an API key for yahoo BOSS and it seemed troublesome.

So i popped off a mail to yahoo to ask how i could get a key to share and they basically said i can just use mine. So i quickly repackaged the pasteScraper with my key so now its as simple as extracting the zip in your webroot directory and browsing to it :)

Get the new one here

Of course you can still use the one on my site over at


Click here to search the VMWare user database!

So last week some time Chris Hadnagy linked me to the following URL: which was pretty interesting last week. Basically it allowed someone to full in their email address to manage their VMWare subscriptions, i noticed a couple of things from the next pages:

  • The fields auto populated with details like Name, Phone Number etc (i know, without auth and only an email address – worriedface)
  • Another tab became available that allowed you to update your details – again, no auth, scary

So i whipped out the good old firebug and started looking through the ajax calls till i came across this little gem:;siteid=524&amp;DLKey=<strong>&lt;sessionkey&gt;</strong>&amp;DLLookup=%3CC_EmailAddress%3E<strong>&lt;email_address&gt;</strong>%3C/C_EmailAddress%3E&amp;ms=59

and the resulting page looked something like:

function GetElqContentPersonalizationValue(strDataField)
var strTemp = '';
//alert('Data Field: ' + strDataField);
if(strDataField == 'C_EmailAddress' || strDataField == 'EmailAddress')
{strTemp = 'andrewmohawk\';}
if(strDataField == 'C_FirstName' || strDataField == 'FirstName')
{strTemp = 'Andrew';}
if(strDataField == 'C_LastName' || strDataField == 'LastName')
{strTemp = 'MacPherson';}

Yeah, great info straight in that.. EEEK! So being the script kiddie (seriously, scripting languages FTW) i wrote a tiny PHP application to pull this info and display.

However the issue was that if you could update someones account, then you could simply change their email address, do a password reset and gain access to a commercial account giving people access to software that someone else paid loads for — this isnt cool so i didnt put the link out. However this week VMWare have removed the update page and the auto-populating fields — yet my scraper still works so i figured i’d put it out.

I’ve specifically left out the sessionkey to make it at least not a trivial cut and paste to get info yourself since it may still be possible to update from that code.

Just another leak i guess. But if anyone has any other links/ideas/stuff for me to play with, contact form’s on the left :)


Click here to search the VMWare user database!


So its been a long weekend, but i had a lot of time to myself this weekend, and decided to play a bit with some of the side projects i’ve been interested in.

With regards to the previous posts, the code has been updated and fixed, ill update the post a little later — but hopefully we (@Paterva) will be releasing the transforms to the public this week so everyone can play!

One of the first ones i wanted to tackle was faceFall — essentially twitterfall for the facebook graphAPI, so you can quickly search for a topic and watch the status messages / links fall down as they arrive :)

So check it out: ( yes i realise the UI looks like ass, but i cant get a nice design to work.. if you have one or want to build one, PLEASE let me know!)

Some stuff id need to fix:

  • Removing doesn’t work well ( probably my lame ass jscript )
  • Doesnt do any correlation (like same person featured on x Topics)
  • Needs more info — only does status/links atm

If anyone wants this and wants to help, feel free to comment msg me!

I also cleaned the whiteboard:

Technical Info after the break!
Read more »

So recently we have really been struggling at work with NLP/tags/phrases relating to a specific person/phrase. For example, you put down something like “Maltego” and you would like it to return things like the company (Paterva),  Information mining, Open source forensics, etc etc

So i started looking around for NER/NLP API’s online and i found a great writeup by Michael Fagan , anyway after looking at it i figured i’d take a few hours and build something around it. I decided to look at AlchemyAPI , registered an account got an API key and was well on my way.

Initially i started doing all the CURL+POST stuff myself (some of the API calls can be done with GET’s as well, check the bottom of each documentation page), but then i found they had already got libs for most languages (c++,php,c#,etc) that i could use – yeah.. fucking fail andrew.. next time read the site :)

So far the results aren’t amazing (get say Maltego or Paterva) as a person, but they are pretty decent, it definitely works a lot better on news sources (,, and so on), heres a little demo of it for those that are interested, can’t guarantee it will be around for ever, but feel free to give it a go:

Recent Posts


Not the quickest of cats
on the best of days.

Tag cloud


For electronics/other to play with:


Created by Site5 WordPress Themes.
Experts in WordPress Hosting.