PHP make you think of web app's right? ... well, did you know you can run it from the CLI to?

Recently I've been doing a lot of spreadsheet and sub-netting type stuff, whilst doing this mundane work I've realised that I can get scripts to work for me. I've started to post a few PHP network functions to github which I've been using.

Here's an example: I have a nokia firewall, the routing table in voyager is shown in the following format -

Network / CIDR Mask , Gateway / 8 ,

I need that same routing in a Cisco ASA format -

Network , Mask , Gateway,,

Now this is not a problem for a few routes but the firewall I'm looking at now has 177 static routes, which I don't want to convert manually.

Roll in PHP!
Save the original routing table as a .csv file. ColA = ip/mask , ColB = gateway.

Save this a route_conv.php

from your CLI run "php route_conv.php" and enjoy the output!



Nick Bettison ©