Closed

Create a PHP script that checks an IP address in different RBL lists

This project was awarded to nope0000 for $20.4 USD.

Get free quotes for a project like this
Employer working
Project Budget
$30 - $5000 USD
Total Bids
9
Project Description

Create a PHP script that checks an IP address in different RBL lists

The information is stored in a MySQL database. We want to run the script every hour with a cron job.

Must run on php 5.3

The lookup of an IP in the rbl list is done with an NSlookup and the reverse dns

example for IP [url removed, login to view]
nslookup [url removed, login to view]

see detailed information for full description and mySQL SQL dump.

## Deliverables

The lookup of an IP in the rbl list is done with an NSlookup and the reverse dns



example for IP [url removed, login to view]
nslookup [url removed, login to view]
result is ** server can't find [url removed, login to view]: NXDOMAIN

This means IP is not on blacklist

2nd example for IP [url removed, login to view]
nslookup [url removed, login to view]
Address: 127.0.0.2

This means IP is on blacklist, depending on the rbl list the result will be somethink like 127.0.0.*

The script
\---|\---|\---|-
The information is stored in a MySQL database. We want to run the script every hour with a cron job.

1/ first check the hour and take the hour (0 - 23)
2/ select clients from tbl_clients where runtime = hour
3/ for each of these clients:
select IP addresses from tbl_ipaddress for these client
4/ for each IP
find on which rbl list the were positive on last check from tbl_rblpositive (array)
do the rbl check on each rbl server from tbl_rblservers where use = true
update datetimelastchecked in tbl_ipaddress
5/ if a postive rbl is found:
update datetimelastfound in tbl_ipaddress
insert or update fields in tbl_rblpositive
6/ if an IP address is no longer positive remove it from tbl_rblpositive
7/ echo a list with new positives and list with removed positives
8/ make a status page where we place per client the list op IP addresses, Date and time last check, date time last blocked, number of blocks
(# IP is on a different rbl list) see attached image

RBL servers you can use to test
[url removed, login to view]
[url removed, login to view]
[url removed, login to view]

This is the MySQL DB (not final, you can change this if needed)

/*
MySQL
Source Server Version: [url removed, login to view]
Source Database: tsc_rblmon
*/

SET FOREIGN\_KEY\_CHECKS=0;

\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
-- Table structure for \`tbl_clients\`
\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
DROP TABLE IF EXISTS \`tbl_clients\`;
CREATE TABLE \`tbl_clients\` (
\`type\` enum('deleted','active') default NULL,
\`runtime\` enum('23','22','21','20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1','0') NOT NULL,
\`name\` text NOT NULL,
\`email\` text NOT NULL,
\`clientid\` int(11) NOT NULL,
PRIMARY KEY (\`clientid\`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
-- Table structure for \`tbl_ipaddress\`
\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
DROP TABLE IF EXISTS \`tbl_ipaddress\`;
CREATE TABLE \`tbl_ipaddress\` (
\`id\` int(10) NOT NULL,
\`clientid\` int(10) NOT NULL,
\`datetimelastfound\` datetime default NULL,
\`datetimelastchecked\` datetime default NULL,
\`IP\` char(15) NOT NULL,
PRIMARY KEY (\`id\`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
-- Table structure for \`tbl_log\`
\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
DROP TABLE IF EXISTS \`tbl_log\`;
CREATE TABLE \`tbl_log\` (
\`id\` int(10) NOT NULL,
\`datetimestartrun\` datetime NOT NULL,
\`datetimeendrun\` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
-- Table structure for \`tbl_rblpositive\`
\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
DROP TABLE IF EXISTS \`tbl_rblpositive\`;
CREATE TABLE \`tbl_rblpositive\` (
\`id\` int(10) NOT NULL,
\`ipid\` int(10) NOT NULL,
\`rblserverid\` int(10) NOT NULL,
\`dateimelastfound\` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
-- Table structure for \`tbl_rblservers\`
\-- -|\---|\---|\---|\---|\---|\---|\---|\---|\---|
DROP TABLE IF EXISTS \`tbl_rblservers\`;
CREATE TABLE \`tbl_rblservers\` (
\`rblid\` int(3) NOT NULL,
\`server\` text NOT NULL,
\`use\` enum('false','true') NOT NULL,
PRIMARY KEY (\`rblid\`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online