Secondary menu

New Script: Are you dealing with a hacked drupal core?

aaron's picture

New Script: Are you dealing with a hacked drupal core?

Written by Aaron Stewart on

Whenever a group of us WorkHabit folks are sitting around the virtual watercooler reviewing upcoming projects, one of the first questions we need to answer is about the quality of the code we're starting with.

The big question we always want to know is this: Is core hacked? And how badly?

After doing this manually several times, I decided to cut to the chase and write a script for it.

The bash script to do this is at the bottom of this post. Just save it as iscorehacked.sh, mark it executable, and have at it. To invoke:

  ./iscorehacked.sh /path/to/questionable/site/docroot

The output:

$ ./iscorehacked.sh ~/develop/mysite
Checking core against version: 6.12
Fetching core...
Checking core against site at /Users/foo/develop/mysite
Files /tmp/DRUPAL-VERSIONS/drupal-6.12/includes/bootstrap.inc and /Users/foo/develop/mysite/includes/bootstrap.inc differ
CORE IS LIKELY HACKED!