Skip to content

Instantly share code, notes, and snippets.

@mattpascoe
mattpascoe / bindparse.awk
Created Aug 29, 2022
Parse bind zone files to produce dcm.pl output.
View bindparse.awk
#!/usr/bin/awk -f
#
# Author: Matt Pascoe - matt@opennetadmin.com
#
# This awk script is used to extract relevant information from a bind zone
# file and build the appropriate fields for passing into
# a dcm.pl module. This can be used to bootstrap a new database from existing
# site data.
#
# You can simply cat a file and pipe it to this script
@mattpascoe
mattpascoe / list.txt
Last active Feb 2, 2020
Starwars list in progress
View list.txt
- Rancor Monster: ($100)
- Loose in box, NO paperwork, original outer box
- Ewok Village: ($120)
- Complete parts, instruction sheet, loose NO BOX
- Micro Collection Bespin Freeze Chamber: ($80)
- Complete parts, instruction sheet, original outer box
- Patrol Dewback: ($110)
- Figure, Saddle, special eddition original outer box, harness is broken, no documentation
- AST-5 Vehicle: ($60)
- Vehicle, instruction and sticker sheet, original outer box
@mattpascoe
mattpascoe / ip2name.pl
Last active Sep 14, 2020
Simple perl script to do inline reverse DNS lookups of IPs. It processes stdin.. so just 'cat somefile | ./ip2name.pl'
View ip2name.pl
#!/usr/bin/perl
# TODO: make command line options possible use $endline as selector
###$endline=true;
# TODO: allow a comment character in the mode that prints at the end of a line. user passable comment character.
# TODO: make it work with ipv6.. for now its ipv4 only
use Socket;
my %dnscache;
@mattpascoe
mattpascoe / leasecheck.pl
Last active Sep 17, 2018
Perl script to parse ISC DHCP lease file and display basic info. I dont recall if I wrote this or if I found it on the interwebs somewhere!?!?.. a quick goog search did not find it but hey its useful so have at it.
View leasecheck.pl
#!/usr/bin/perl
#
# Update the path to your lease file below
use strict;
use File::Copy;
#use DateTime;
#always parse a copy not the live file
#my $leasefile = '/var/lib/dhcpd/dhcpd.leases';
my $leasefile = '/var/lib/dhcp/db/dhcpd.leases';
@mattpascoe
mattpascoe / dhcpparse.awk
Last active Nov 29, 2018
An AWK script to parse ISC dhcpd configuration files into dcm.pl output to load into OpenNetAdmin
View dhcpparse.awk
#!/usr/bin/awk -f
#
# Author: Matt Pascoe - matt@opennetadmin.com
#
# This awk script is used to extract relavant information from a dhcpd.conf
# config file and build dcm.pl output with appropriate fields. This can be
# used to bootstrap a new database from existing site data.
# As usual, inspect the output for accuracy.
# Also you will get three types of output, subnet,pool,host. You must
# add the subnet information first, then pool, then host.
@mattpascoe
mattpascoe / parseshowroute.sh
Created Nov 6, 2012
Generate DCM.PL commands from the output of a 'show ip route' to load into ONA
View parseshowroute.sh
#!/bin/bash
#
# Author: Matt Pascoe - matt@opennetadmin.com
#
# usage: ./parseshowroute.sh <filename>
#
# Takes the output of a "show ip route" command from an IOS device
# and processes it. Simply get the output and save it to a file
# and then run this script against that file.
#
@mattpascoe
mattpascoe / tinydnsparse.awk
Created Nov 6, 2012
An AWK script to parse a tinydns data file into a CSV for later use by a dcm.pl script to load into opennetadmin
View tinydnsparse.awk
#!/usr/bin/awk -f
#
# Author: Matt Pascoe - matt@opennetadmin.com
#
# This awk script is used to extract relevant information from a tinydns data
# config file and build a csv with appropriate fields for passing into
# a dcm.pl module. This can be used to bootstrap a new database from existing
# site data.
#
# This script assumes the data to be reasonably correct as it is expected that
@mattpascoe
mattpascoe / leasquery.php
Last active Sep 2, 2022
DHCP Leasequery via php -- initial attempts
View leasquery.php
<?php
/**
* Main class can be found here:
* https://www.phpclasses.org/package/6621-PHP-Send-queries-to-a-DHCP-server.html
*
* A simple test script to demonstrate how to use the dhcpLeaseQuery class.
* Please read the note below first then edit the variables below as appropriate.
* Then simply run: php LeaseQuery.php
*
@mattpascoe
mattpascoe / dcm.pp
Created Oct 12, 2012
OpenNetAdmin puppet module stuffs
View dcm.pp
class opennetadmin::dcm inherits opennetadmin {
case $operatingsystem {
Debian,Ubuntu: {
package {
'libio-socket-ssl-perl':
ensure => present,
before => File['dcm.pl'],
}
}