Owen Barnes

super hacker guru-man kami extraodinaire

© 2015, All rights reserved.

O365 & Proxy Pac

Am in the middle of an O365 migration from an on-premise Exchange 2010 environment. Whilst looking into bypassing the proxy for O365 addresses, I came across this useful article: Office 365 and Web Proxy – the Lost Documentation, which in turn put me onto Office 365 URLs and IP address ranges.

Which is great, as I now have a list of URLs/IPs I can use in our proxy.pac script, telling the browser to bypass the proxy when talking to O365. The only trouble is the mask, which is not accepted by a PAC script. Using Excel and this tool, I changed the values provided by Microsoft to the netmask expected by the PAC script.


Note, these IPs are subject to change, you’ll more than likely need to update them
function FindProxyForURL(url, host) {

PROXY = "PROXY proxy.domain.local:8080";
x =0; y=0; i=0; j = 0;
resolved_ip = "";
reip = "";

// All hosts and domains that we will bypass the proxy for.
bypass_domains = [".domainname.local", ".website.com"];
bypass_hosts = [""];

// All networks (and their subnet masks) that we don't need to use the proxy for. Will only match when the URL is an IP address. e.g. 
// Important info - the network and subnet mask need to be one after another.
bypass_networks = ["","","","","",""];

// All Office 365 domains that are referenced as being accessible for Office 365, Exchange Online, Lync Online, Sharepoint Online AND Azure Online. Refer to published data from Microsoft and configured firewall rules.
office365_domains = [".activedirectory.windowsazure.com", ".glbdns.microsoft.com", ".live.com", ".lync.com", ".microsoft.com", ".microsoftonline.com", ".microsoftonlineimages.com", ".microsoftonline-p.com", ".microsoftonline-p.net", ".microsoftonlinesupport.net", ".msecnd.net", ".msn.co.jp", ".msn.co.uk", ".msn.com", ".msocdn.com", ".office.net", ".office365.com", ".officeapps.live.com", ".onmicrosoft.com", ".outlook.com", ".phonefactor.net", ".sharepoint.com", ".sharepointonline.com", ".officecdn.microsoft.com", "activation.sls.microsoft.com", "crl.microsoft.com", "officecdn.microsoft.com", "ols.officeapps.live.com"];

// All Office 365 networks (and their corresponding subnet masks) that have firewall rules to allow direct connections.
// Important info - the network and subnet mask need to be one after another.
office365_networks = ["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];

// OFFICE 365 Rules
for (x = 0, y = office365_domains.length; x < y; x++) {
		if (host == office365_domains[x]) {
			return DIRECT;

// Hosts and domains to bypass the proxy for.
for (x = 0, y = bypass_hosts.length; x < y; x++) {
		if (host == bypass_hosts[x]) {
		return DIRECT;
for (x = 0, y = bypass_domains.length; x < y; x++) {
		if (dnsDomainIs(host, bypass_domains[x])) {
		return DIRECT;

// Test to see if the URL is an IP address and not a host name. e.g. - Does not do a DNS resolution on a host name.
reip = /^\d+\.\d+\.\d+\.\d+$/g;
if (reip.test(host)) {
   // Check for to see if the host-name (which is an IP address) is in the bypass list and go direct.
	for (x = 0, y = bypass_networks.length; x < y; x = x + 2) {
		if (isInNet(host, bypass_networks[x], bypass_networks[x + 1])) {
	    return DIRECT;
	 // Check for to see if the host-name (which is an IP address) is in the office365 bypass list and go direct.
	for (x = 0, y = office365_networks.length; x < y; x = x + 2) {
		if (isInNet(host, office365_networks[x], office365_networks[x + 1])) {
	    return DIRECT;
	// All others should default to the proxy (the last line of this PAC file).

// Default return condition is the proxy, since it's assumed that everything else is on the Internet or the proxy will be required to resolve and have firewall rules.
return PROXY;

} // End of function

Outlook Email Signatures

This is a script I wrote to handle creation of an HTML signature for Outlook.

It loads an HTML template, and replaces special tags/keywords with details loaded from the users AD account. As my company has a few variants of the banner image used, the script accepts a parameter/argument to specify which banner should be loaded (XYZ). We also restrict the mobile from being loaded in the signature to higher up staff. Setting the 2nd parameter to 0 turns it off, 1 turns it on.


  • Script expects the template to be saved as SignatureTemplate.html
  • The mobile section in this script does have a bit of HTML in it. This must be changed to suit your template file.


cscript OutlookSignature.vbs XYZ 0


'Author: Owen Barnes
'Website: https://ombarnes.net
'Purpose: Deploy company email signature, grabs template and 
' replaces the following values with user data from AD:
' %fullname%
' %jobtitle%
' %address%
' %mobile%
' %banner% 
' %bannerlink%
' Updates required registry settings to use Signature. 

 Dim strSigName
 Dim strFullName, strTitle, strAddress, BannerLink
 Dim boolUpdateStyle
 Dim SignatureArray()
 Const HKEY_CURRENT_USER = &H80000001 
 Const ForReading = 1
' Get script arguments - sets which Signature is used
 'Default to XYZ signature without mobile if script run manually (ie without parameters)
 if WScript.Arguments.Count = 0 then
 	strSigName = "XYZ Signature"
 	strSig = "XYZ"
 else 'Set signature to one specified in arguments
 	strSigName = WScript.Arguments(0) & " Signature"
 	strSig = WScript.Arguments(0)
 	'Enable mobile if specified
 	if WScript.Arguments.Count = 2 then
 		blMobile = WScript.Arguments(1)
 	end if
 end if
 wscript.echo "Generating " & strSigName & vbCrLf

'Setup banner and banner link

strBanner = "http://randomwebsiteurl.com/signature/banner_" & strSig & ".jpg"
strBannerLink = "http://www.google.com.au"

' Get Users AD information
 Dim objSysInfo, objUser

 Set objSysInfo = CreateObject("ADSystemInfo")
 Set objUser = GetObject("LDAP://" & objSysInfo.Username)

 strFullName = objUser.displayname
 strTitle = objUser.title
 strStreet = objUser.streetAddress
 strPOBox = objUser.postOfficeBox
 strCity = objUser.l
 strState = objUser.st
 strPostcode = objUser.postalCode
 if strPOBox = "" then 
 strAddress = strStreet & " " & strCity & " " & strState & " " & strPostcode
 strAddress = strPOBox & " " & strCity & " " & strState & " " & strPostcode
 end if
 strMobile = objUser.mobile
 Set objUser = Nothing
 Set objSysInfo = Nothing
wscript.echo "Gathered user AD information"
' Set Signature Folder
 Dim objShell
 Set objShell = CreateObject("WScript.Shell")
 strSigFolder = ObjShell.ExpandEnvironmentStrings("%appdata%") & "\Microsoft\XYZ_Signatures\"
 Set objShell = Nothing

' Define filenames and variables
 Dim objFSO, objFile
 Set objFSO = CreateObject("Scripting.FileSystemObject")

 'If folder does not exist (ie new profile), then create it

 If Not (objFSO.FolderExists(strSigFolder)) Then
 Call objFSO.CreateFolder(strSigFolder)
 End If

 'Define signature filename
 strSigFile = strSigFolder & strSigName & ".htm"
 strSigFileTxt = strSigFolder & strSigName & ".txt"
 ' If signature exists, overwrite (true) or leave alone (false)?
 boolUpdateStyle = true

' Load Signature templates and replace tags with AD values

 Set objFSO = CreateObject("Scripting.FileSystemObject") 
 Set objTextFile = objFSO.OpenTextFile("SignatureTemplate.html", ForReading) 

 'If user is part of the mobile group, add mobile number to phone number block
 if blMobile = 1 then
 strMobileHTML = "<span>M: </span><span class=""phoneaddressspan"">" & strMobile & "</span>"
 'If mobile is not specified, remove from html
 strMobileHTML = ""
 end if

 ReDim SignatureArray(1)

 'read template, replacing the special keywords with appropriate values and load into array
 Do Until objTextFile.AtEndOfStream 
 strNextLine = objTextFile.Readline 

 strNextLine = Replace(strNextLine,"%fullname%",strFullName)
 strNextLine = Replace(strNextLine,"%jobtitle%",strTitle)
 strNextLine = Replace(strNextLine,"%address%",strAddress)
 strNextLine = Replace(strNextLine,"%mobile%",strMobileHTML)
 strNextLine = Replace(strNextLine,"%banner%",strBanner)
 strNextLine = Replace(strNextLine,"%bannerlink%",strBannerLink)
 'Add to array
 ReDim Preserve SignatureArray(UBound(SignatureArray) + 1)
 SignatureArray(UBound(SignatureArray)) = strNextLine
 'wscript.echo strNextLine
wscript.echo "Processed HTML code"
' Save array to HTML file

Set objFile = objFSO.CreateTextFile(strSigFile, boolUpdateStyle, False)
If Err.Number = 0 Then
 For i = 1 to Ubound(SignatureArray)
 objFile.write SignatureArray(i) & vbCrLf
End If

wscript.echo "Saved HTML code to signature file"

' Update registry - this tells Outlook to use the signature

 'Update HKEY CURRENT USER to use new Sig. 
 Set objRegistry=GetObject("winmgmts:\\.\root\default:StdRegProv")
 Set WshShell = WScript.CreateObject("WScript.Shell")

 'Remove the First-Run value, otherwise Outlook ignores the NewSignature setting
 objRegistry.DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Outlook\Setup", "First-Run"
 objRegistry.DeleteValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Outlook\Setup", "First-Run"

 'Define the new signature - must match the filename without the extension
 'Configure new signature for Outlook 2007
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\General", "Signatures", "XYZ_Signatures"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\MailSettings", "NewSignature", strSig & " Signature"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\12.0\Common\MailSettings", "ReplySignature", strSig & " Signature"

 'Configure new signature for Outlook 2013
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\General", "Signatures", "XYZ_Signatures"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\MailSettings", "NewSignature", strSig & " Signature"
 objRegistry.SetStringValue HKEY_CURRENT_USER, "Software\Microsoft\Office\15.0\Common\MailSettings", "ReplySignature", strSig & " Signature"
 set WshShell = Nothing
 set objRegistry = Nothing

wscript.echo vbcrlf & "Deployed to Outlook"
'wscript.sleep 2000


Insurgency is a great tactical FPS, focusing a great deal on teamwork. Think of it Counterstrike, but with a bit more variance in objectives, fresh level design. It includes AI based CO OP, which if you can pull together a decent team that communicates well (and doesn’t run in front of those firing, then bitching) is a great deal of fun.

There is a tutorial which runs you through the basics, but is a bit buggy and comes across as unfinished. It doesn’t quite explains things well enough at times, leaving the user not knowing what to do.

Taking part of matches, taking control of control points/objectives and of course having a good kill/death ratio will increase the amount of points you can use to select differing weapons, attachments, equipment (smoke, grenades, etc).




Came across this fantastic little indie game on Steam a week or so ago. A puzzle game at heart, you build your contraptions to complete the objectives and progress through the levels.  You may think, ok, anyone can piece together small tank and cannon, whats the appeal?  Despite the limited parts, you can make some truly amazing machines, all but ignoring the objective (or just play in sandbox mode). There is more than one way to skin a cat, as they say. Just some examples of the creations people are coming up with:   A lot more levels are coming, and more than likely additional parts

B18C7 Build

I picked up a cheap B18C7, via a forum acquaintance whom got it from a wrecked Integra (an EK4 project he was planning from memory).   My acquaintance had already taken the head off, so I checked out the bores and threw on a new head gasket and bolted it back down. I am hoping the valve guides and stems are OK, otherwise back off with the head and get it rebuilt but I will not know until its started I have replaced the water pump, oil pan gasket – the pan itself has seen better days, valve cover gasket, water pipe o-rings, intake/exhaust gaskets, etc.   All of the water hoses will be replaced, the mix of damaged OEM piping and red silicon pipes. The hose clamps had been over tightened and damaged the ends of the tube.    The air intake had a bit of oil/muck in it, which usually happens with too much oil pressure. Hopefully thats all it was. I am missing the flywheel bolts and other bits and pieces. I have them on order and will hopefully get the gearbox on in a couple of weeks.   One intake stud needs to be drilled out and replaced, but otherwise everything else is looking ok. The plan is to get the engine assembled and dropped into the EH9 shell I have. The plans for the EG8 turbo car is still on, but the expense involved (and house owning) limits the amount I can spend and further delays things.

Rebuilt engine in

A fair bit has happened since my last post. I bought the red Civic up to road worthy standard which entailed the following:

  • Replacing the bonnet, as the old one had fatigue cracks
  • Repairing a hole near the join in the muffler to the exhaust pipe
  • Removing and replacing the master cylinder which was leaking
  • Replacing the steering wheel, which had deteriorated and broken away from the metal ring. It wasn’t worth repairing as the rubber was falling apart. Whilst I could re glue it to the metal ring it wouldn’t take long to come completely apart
  • Fixing an oil leak.  I had actually fixed this prior to taking it for the roadworthy, but as I hadn’t been able to fully clean all the oily muck off, they thought it was still leaking.

I didn’t have to spend very much getting it to standard thankfully, given I was taking the D15B7 out and putting my rebuilt motor in.

I spent yesterday and today removing the old motor and installing the B16A. Just have to reconnect everything, run wires for the vtec solenoid and oil pressure switch. I also need to move the accelerator cable and fuel rail from the old Civic to the new.

The next part is installing the intercooler, piping and turbo. This part is all new to me, the goal being to get it to a running state that will allow me to take it to a tuner. Fingers crossed all goes well.

Another Civic

Picked up this red Civic today as its in somewhat better shape than the blue one I currently have. The owner tried to get the Road Worthy (must have one to sell the car registered), but failed on a few things:

  • Bonnet (structural damage, the metal has fatigued and broken where the bonnet holder props it up)
  • Split CV boot
  • Worn front tyres

As I had all of the above, they brought the car over and fixed those up (thus the blue bonnet on a red car). When they took it back, they failed on more things:

  • Hole in exhaust
  • Alternator o-ring leaking
  • Master brake cylinder leaking
  • Handbrake needs adjusting
  • Front brake pads
  • Rear brake linings

So they are going to dereg this arvo for me. None of is an issue for me to fix as Im moving everything from my blue civic to this one; its just a shame they didnt service it prior to selling else they would have known. 

I wiped away some of the oily muck from the leak and found the gearbox is blue – the owner had it for 4 years and never knew  


First home and new wheels

Moved into my own first home over the weekend, nice 3 bedroom lowset home with a large double garage (with a thick enough concrete base to allow me to get a car lift installed, huge plus!). So glad to have my own place, have a garage (last place only had a carport that the owner used) and plenty of space. 

The new place puts me fairly close to some wreckers that have honda parts, whilst I was at one enquiring about a subframe, I had a look at their imported wheels and located a set I liked so grabbed them then and there, just managing to fit them in the car that was already carrying a house load of stuff. Fitted them yesterday:

I had a set of 16″ speedy wheels on there previously, but Im liking these 15s (Monza, unknown model, wrapped in Yokohama S.drive 195/50 tyres) . Eventually I’ll em onto my other civic once thats back up and running.

Engine rebuild completed

Adam at PEACH Performance completed the engine rebuild a couple of weeks ago. I have slowly been adding the various parts back on, and am almost ready to install back into the car.   I need to drop by Super Cheap to get some replacement exhaust studs, a tap & die set to fix another stud so I can remove it (looks like something has hit the thread, and ruined one nut already).   LSD for the gearbox is yet to turn up, so contemplating buying one locally (but dont really have 800 to spend at the moment, see below).


I have just purchased a home, so will be moving in the next few weeks, which means Im unlikely to get the engine in the car just yet (would be a great break in if I could).

Engine now being inspected

Engine is now at P.E.A.C.H Performance, being stripped down and inspected. Hoping to get a call this week re the condition (I know the oil rings have had it), then hopefully on with the rebuild.

Im also investigating my options for getting a diff installed and a new clutch. At the moment I’m looking at a Cusco helical diff and an Exedy Sports Organic clutch.

O M Barnes

Main menu