Hello everybody!

Updating to an Umbraco site, which is now primarly going to be a blog about useful and interesting software development related things.

Historic articles and software has been kept and more will be added in due course.

View the Archive...

Free DNS Report tool

I've always wanted to write a DNS Report type tool, and recently have had a number of requests for this type of app - So I have started working on this and you can check out the alpha version by clicking the link below

Currently is has a useful DNS Reporting function that checks various aspects of a domains DNS, MX/Mail and Web settings to make sure the name servers are optimally configured

There is also an IP Whois tool which simply provide some information and mapping details on the IP provided.

And a traceroute tool which shows you the path from our server to the a destination of your choice, this is also graphically represented on a global map

And the last tool currently available is an SMTP AUTH tool which verifies SMTP Authentication, which is useful for third party/remote testing.

Any feedback or feature requests would be appreciated!

H-Sphere XML API - Create Mailboxes

This is the first of a few simple perl script that I wrote to help with some admin tasks, it uses the H-Sphere XML API to create mailboxes for existing accounts, the other scripts will be posted shortly.

#!/usr/bin/perl

use DBI(); 
#use strict;
use SOAP::Lite;
use Data::Dumper;

$serviceuri = 'cp.your-server.com';
use Env;

addEmail ('Account#', 'AccountUserName', 'AccountPassword', 'MAILBOX', 'MAILBOXPASSWORD', 'domain.com');


sub addEmail {

        my $account = $_[0];
        my $login = $_[1];
        my $password = $_[2];
        my $email = $_[3];
        my $pass = $_[4];
        my $domain = $_[5];


        # generate authtoken
        my $authtoken = SOAP::Data->name('at' => 
                \SOAP::Data->value(
                        SOAP::Data->type('int')->name('accountId' => $account),
                        SOAP::Data->type('string')->name('login' => $login),
                        SOAP::Data->type('string')->name('password' => $password)
                        )
                );

        my $request = new SOAP::Lite;
        $request->proxy("http://$serviceuri:8180/psoft/servlet/MailServices.jws");
        $request->uri('MailServices');

        my $result = $request->addMailbox ($authtoken,  SOAP::Data->type('string' => $email),
                                                        SOAP::Data->type('string' => $domain),
                                                        SOAP::Data->type('string' => $pass),
                                                        SOAP::Data->type('string' => ""));
        if ($result->fault) {
                printf "2 - ($account) there was an error, %s %s\n", $result->faultcode, $result->faultstring;
        }

print "\n";
}

AJAX Domain Availability Checker

UK Postcode Format Validation in ASP

Here is a simple ASP based function that will check a UK postcode to make sure it is in a valid format - it is based on rules from the Government Data Standards Catalogue - The basic rules are...

  • The letters Q, V and X are not used in the first position.
  • The letters I, J and Z are not used in the second position.
  • The only letters to appear in the third position are A, B, C, D, E, F, G, H, J, K, S, T, U and W.
  • The only letters to appear in the fourth position are A, B, E, H, M, N, P, R, V, W, X and Y.
  • The second half of the Postcode is always consistent numeric, alpha, alpha format and the letters C, I, K, M, O and V are never used.

This does only check that the format is valid, it does not know if the actual data is valid, I would be happy to update this script if any public domain reference data could be provided.

Hopefully it will be helpful to somebody!

Network Support tool for hosting clients

Networktool1 SmallThis application will run on a clients PC, they will provide their domain name, and optionally provide an email address and password for email testing.

It will then give details they can feed back to you with connectivity information between them and their domain services.

Some highlights...

  • Ping result to their domain and mail.theirdomain
  • Traceroute details to their domain
  • NS Lookup for their domain and mail.theirdomain
  • First 100 chars for their HTTP response
  • SMTP test on ports 25 and 587
  • POP3 Test
  • Domain expiry from whois
  • Their internet facing IP address
  • Can purchase branded version

Requirements

  • User must have .NET V2 Framework installed

Windows FTP Hack Analyser

A friend asked if I had a tool to check IIS FTP logs to see if multiple IPs were accessing the same FTP Users account, I didn't so I quickly wrote one, incase it may be of use to others - the download link is below.

Features

  • List failed logins by IP,Count
  • List successfull logins by IP,User,Count
  • List successfull logins to same account from different IPs along with rDSN and ASN details

Requirements

MS LogParse 2.2 needs to be installed

ASP CAPTCHA

DccaptchaHere is a simple classic ASP CAPTCHA script, it is just an example on how to use ASPJpeg for a CAPTCHA basic function. (So obviously requires ASPJpeg to be installed on the server)

H-Sphere password checker

Hspwchk2 SmallThis application will check for weak passwords and can optionally email clients with relevant details.

A PHP script provides the relevant data to the Windows based application - the script has built in security so it will only respond to certain IPs, requires a password that you set and only runs over https, you can of course also add your own further security via firewalls etc.

Some highlights...

  • Check for only alpha/numeric/alphanumeric
  • Check for similar username and password
  • Check against your own dictionary
  • Check against any combination of FTP, Mailbox, CP, MySQL, PgSQL, MSSQL passwords
  • Email clients who's password weakness score is too high with your own templated mail

Requirements...Hspwchk1 Small

  • Windows Application
    • .NET v2 Framework
  • Webserver
    • PHP with IonCube
    • SSL (The script will only run over https)
    • Access to the control panel database (recommended via a restricted user id)
  • Mailserver
  • (if sending emails to clients)
    • SMTP AUTH

APC PDU Power control via SNMP

Below are a couple of simple examples on how you can use PHP/SNMP to control the power outlets on APC PDU devices , AP7951 or the lower priced model here

Note : in the example below you need to replace "readcommunity" and "writecommunity" with your SNMP community strings that you set on the APC

function apcGetStatus($APCip, $APCport) {  
  $APCresponse = snmpget($APCip, "readcommunity", ".1.3.6.1.4.1.318.1.1.4.4.2.1.3.$APCport");
  $APCresponse = str_replace('INTEGER: ', '', $APCresponse);
  switch ($APCresponse) {
    case '1':
      $returnVal = 'On';
      break;
    case '2':
      $returnVal = 'Off';
      break;
    case '3':
      $returnVal = 'Reboot';
      break;
    case '4':
      $returnVal = 'Unknown';
      break;
    case '5':
      $returnVal = 'On with delay';
      break;
    case '6':
      $returnVal = 'Off with delay';
      break;
    case '7':
      $returnVal = 'Reboot with delay';
      break;
    default:
      $returnVal = $APCresponse;
  }
  return $returnVal;
}
function apcSetStatus($APCip, $APCport, $rebootOption) {

  switch ($rebootOption) {
    case '1':
      $actionTo = 'On';
      break;
    case '2':
      $actionTo = 'Off';
      break;
    case '3':
      $actionTo = 'Reboot';
      break;
    case '5':
      $actionTo = 'On with delay';
      break;
    case '6':
      $actionTo = 'Off with delay';
      break;
    case '7':
      $actionTo = 'Reboot with delay';
      break;
    default:
      return 'Invalid reboot option passed';
  }
  
  $actionFrom = apcGetStatus($APCip, $APCport);

  if ( snmpset ( $APCip, "writecommunity", ".1.3.6.1.4.1.318.1.1.4.4.2.1.3.$APCport", 'i', $rebootOption) )
  {
    $returnVal = "Actioned:$actionFrom to $actionTo";
  }
  else
  {
    $returnVal = "Failed to Action:$actionFrom to $actionTo";
  }
  return $returnVal;
}

Kayako Login Share for H-Sphere

Here is how you can setup Kayako Login Share to work with your H-Sphere user accounts.

First log in to your H-Sphere database and run the following SQL - this is just to be more secure as you really don't want the loginshare php script accessing your hsphere DB with a high privilege user account. So we create a view that only feeds back username and md5hash of password - and setup a new user to access this view.

CREATE VIEW public.kayakologinshare (username, pass, email, name, lastname )
AS
select distinct users.username,
md5(users.password) as pass,
email,
name,
last_name as lastname
from contact_info,
accounts,
user_account,
users
where contact_info.id = accounts.ci_id
and accounts.id = user_account.account_id
and user_account.user_id = users.id
and users.reseller_id = 1;

CREATE USER "kayakologinshare" PASSWORD 'STRONGPASSWORDHERE';

GRANT SELECT ON "public"."kayakologinshare" TO "kayakologinshare";

If you have the full version with source code

I personaly know this way works as I have implemented it - Next you need to edit your /includes/LoginShare/loginshare.config.php and add the following lines...

define("LOGINAPI_HS",108);
$_LOGINAPI[LOGINAPI_HS] = array("title" => "H-Sphere login", "include" =>"hs.login.php");

NOTE : where 108 is in the first line above, this needs to be an usused number in the loginshare.config.php file, so make sure 108 is not already used otherwise change it.

Now download the zip file below and place the unzipped hs.login.php file in the /includes/LoginShare/ folder.

If you have the leased version without access to source code

This way will work as well, but I have not personally tried it, although I know others have with success. Unzip the file below and rename the file to hsphere.login.php and upload it to your /includes/LoginShare/ folder overwriting the existing file that is already there.

Finally...

When you have done this you can login to your Kayako admin screen and enter the DB details for kayakologinshare as above and then assign that login share to your template group.

You do also need to make sure that your the CP Postgre Server will accept connections from the server running Kayako
NOTE:Replace 10.11.12.13 with your server IP that is running Kayako

echo 'host all all 10.11.12.13 255.255.255.255 password' >> /var/lib/pgsql/data/pg_hba.conf

You also need to make sure that your firewall will allow access, eg if you are running iptables this should work.
NOTE:Replace 10.11.12.13 with your server IP that is running Kayako

iptables -I INPUT -s 10.11.12.13 -p tcp --dport 5432 -j ACCEPT