Skip to content

Commit

Permalink
Updated the README file etc
Browse files Browse the repository at this point in the history
  • Loading branch information
tactmaster committed May 29, 2011
1 parent ea1cb6b commit 7c9e6a5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/setting.josn
/ip.csv
/login.txt
9 changes: 5 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ It also runs on Slug OS 5.3 but some of the command maybe been to be recompiled

place where you want it.

edit the top of

he.php
edit the setting.php file with your username, password and directory where you want the working files to go.

you can run it manally

# php he.php
#php he.php

again and it will perform all the tests


and/or add cron task like this

# crontab -e
Expand Down
6 changes: 3 additions & 3 deletions commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
require_once 'setting.php';
function loadSettings() {
if (file_exists("setting.josn"))
if (file_exists("setting.json"))
{
$filedata = file_get_contents("setting.josn");
$filedata = file_get_contents("setting.json");
$json = json_decode($filedata, true);

//var_dump($json);
Expand Down Expand Up @@ -50,7 +50,7 @@ function loadSettings() {
}

function saveSettings($setting) {
$fh = fopen("setting.josn", 'w');
$fh = fopen("setting.json", 'w');


//var_dump($setting);
Expand Down
22 changes: 13 additions & 9 deletions he.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<?php

print "Start";
require_once "getips.php";
print ".";
require_once 'commands.php';
print ".";
require_once 'setting.php';
print ".";
$settings = loadSettings();
print ".\n";
$settings = he($settings);
//saveSettings($settings);

Expand Down Expand Up @@ -37,18 +32,15 @@ function he($settings) {
if (!file_exists($settings->directory)) {
mkdir($settings->directory, 0700, TRUE);
}
print "Next\n";

if ($settings->debug) {

$time = new DateTime("now");

print "Start:" . $time->format(DATE_RFC822) . "\n";
}
print "Next\n";

getIPs($settings);
print "Get Address\n";
$address = getAddress($settings);

if ($settings->debug)
Expand Down Expand Up @@ -258,8 +250,12 @@ function performRepeat($test, $ch, $address, $settings) {

$pageHtml = performTest($test, $settings, $ch, $address);
if (preg_match("/Result\: Pass/i", $pageHtml, $match)) {
print "Pass\n";
if ($settings->debug) print "Pass\n";
recordSuccess($test, "Pass", $address, $settings);
$time = new DateTime("now");
$date = $time->format("c");
$test->lastdone = $date;
saveSettings($setting);
return TRUE;
break;
} else {
Expand Down Expand Up @@ -311,6 +307,14 @@ function proccessFails($pageHtml, $settings) {
if ($settings->debug)
print "Fail - same address dig\n";
return "same address";
}


elseif (preg_match("/like you submitted an invalid/i", $pageHtml, $match)) {
if ($settings->debug)
print "Fail - invalid submission\n";
return "invalid submission";

} elseif (preg_match("/Result\: Fail/i", $pageHtml, $match)) {
if ($settings->debug)
print "Fail - error in submission\n";
Expand Down

0 comments on commit 7c9e6a5

Please sign in to comment.