Adsense Code Checker

Make sure your Adsense advertisements were not hacked - Mozilla 1.1 license

A security vulnerability in your hosting and an hacker can access your files, store spamming scripts, and change the Adsense code in ads to put the one of his account and be credited to his account with... your incomes!

Hacking is not always easy to detect. If a clumsy hacker changes the codes on most of your pages and is waiting for the revenues, when noting the drop in earnings on your site, or even full extinction, you look at what is happening and find the cause... But if it is more clever, it will change the code at certain times of the day and then restore your code, so could be unnoticed by reducing your income only.

The Adsense Checker script is designed to automatically detect such fraud. You have to run it from time to time at different times of day. This script requires that PHP 4 or 5 is installed locally on your computer.

How Adsense Checker works

The program scans the content of your website in FTP mode, so without running the scripts on the site, it loads Web pages, identifies the JavaScript Adsense code, extract the client code, and provides at the end of operations the list of codes found.
You can so verify if besides your code, was introduced a foreign code by the hacker.
A file, acheck.log is created to show details of the operations, pages found and where codes were inserted.

Using the script

It runs from the command line, in a so-called "DOS" window.

php acheck.php [options] -llogin -ppassword ftpaddress

Required arguments:

If these arguments are omitted you will be prompted by the program to enter them:

-l your ftp login.

-p your ftp password.

ftpaddress: ftp address of your site in the form:

Optional parameters

If these arguments are omitted, default values will be used:

-v verbose mode, more details displayed, default is false.

-q quiet mode, default is false.

-d followed by a directory name. Subdirectory that is the root of the hosting. Often "www". Default none.

-f followed by the ftp address if it is not in the ftp.domain.tld format.

-n displaying the number of ads found on each page. Default displays "."

-s displaying subdirectories.

It is recommended that you create a batch file. This is a text file containing the command with a BAT extension. It will be executed as a program.

What the script displays

Firstly the options you have selected, and then for each page on the site, a dot or the number of ads found. When a new client code is encountered, the + symbol is displayed, so you know already when several codes exist.

At the end of the processing, the script displays all Adsense codes he found.

What if a hacking is found?

Check all PHP scripts on your site, they could change the content of your pages or replace them. Change your password for the FTP connection.


The script does not take into account the possible pages generated by PHP scripts on your hosting. You must review the scripts on your site, and if they have not been changed. One can also consider the worst, an employee of the hosting company, which has thus access to all hosted sites and make revenue to their detriment. Having a local image of the site that can be compared with the online contents can be useful.


The archive contains the PHP executable script acheck.php, the required libraries, and the source code in Scriptol programming language.