Friday, July 27, 2012

Free DynDns (Sort Of)

So I wanted to access my home network from outside. My ISP doesn't hand out static IPs and DynDns doesn't work on my router / also i don't want to pay for it anyhow.

Solution:

All I really want is my IP address. This can be displayed from sites like whatismyip.com very easily. We'll do it like they do and store the result somewhere on the web. There are plenty of free webhosts that support PHP. I set up a tiny website to set and get the IP address of my home gateway.

The website basically contains 2 webpages and 1 file. One webpage is called by my home server every hour, this page collects the IP address from the calling home server and writes it to a file on the webserver.

set.php :=


#get caller's ip address, we will have to pwd protect access to this file yes? $ip_address = $_SERVER['REMOTE_ADDR']; 
$file = fopen("ipfile", "w+"); 
if( $file==false) 

   echo("error opening file\n");
   exit(); 

fwrite($file, $ip_address); 
fclose($file); 
?>

The powershell script to call it was a bit of a pain to write as powershell is very fussy when it comes to authentication and signing scripts. Probably should have just used wget for windows, but I wanted to try something new.

PowershellScript.ps1 := 

$client = New-Object System.Net.WebClient; 

$client.Credentials = New-Object System.Net.NetworkCredential("usernamehere","passwordhere"); 

$client.DownloadData('http://mywebsite.domain.com/set.php'); 

I just used basic http authentication. Don't want anyone becoming curious as to what the IP address is for if they stumble accross it, and more importantly I don't want them running my set.php page and overwriting my IP with their own!

For getting the IP address I use the get.php page :=


$file = fopen("ipfile", "r"); 
if( $file==false) 

   echo("error opening file\n");
   exit(); 

$filetext = fgets($file, 100);
fclose($file);

then in the body display IP address:


(Very difficult to put all this php code into blogger blogpost, stuff keeps disappearing!)
I give up trying to write code here now.
Gonna set up my server for incoming connections now. Just wanna access my music and videos from my android.

Sunday, July 22, 2012

Regedit Under Windows x64

So apparently under 64bit windows there's a "hidden" 32bit registry. This explains how programs were autostarting on me without me knowing exactly how. The relevent path under regedit64 is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
Well fuckiddy-doo, someone could a told me eh? Well actually they did http://support.microsoft.com/kb/305097 Don't go editing those keys with the 64bit version of regedit though! Use %systemroot%\syswow64\regedit and note that any 64bit copy of regedit must be closed or that just opens another 64bit copy.

Saturday, July 7, 2012

I'm back with UPC!

O joy of joys! In the last 10.5 months I've had to suffer with a data connection ranging from 40k thru my nokia phone with bad drivers, to ADSL on a 2Mb connection that at best connected at 1800kbps and was completely intermittant.
But finally I'm back with UPC!!! check it:

Prepare urself UPC, acceptable usage policies are about to be fully tested!