Fork this blog on GitHub Fork this blog on GitHub

Customizing Vim to Easily Add Python Breakpoints

I added a few lines to my .vimrc today in my ongoing effort to be more productive and type fewer key strokes.

First I changed the <leader> variable from a backslash to a comma which is easier to type.  The leader variable is useful for creating custom commands.

"Easier mapleader than the default "\"
let mapleader = ","


Instead of manually typing "import ipdb; ipdb.set_trace()", the following vim configuration will insert a python breakpoint in the next line by typing ,p in normal mode.  As the comment explains, ctrl v and then escape must be typed in order to create the characters ...

Continue reading

Python Argparse - Parsing Command Line Scipt Arguments

The python argparse module is quite nifty.  In the past I have used code like this to parse arguments to command line scripts:

import sys

prog_name        = sys.argv[0]

def printUsage():
  print 'Usage: ' + prog_name + ' USEFUL_ARGUMENT'
  print 'This script does something useful with an argument.\n'
  print 'Examples:'
  print '  '+ prog_name + ' USEFUL_ARGUMENT\n'
  exit()


sys.argv.remove(prog_name)
if '-h' in sys.argv or '--help' in sys.argv or len(sys.argv) != 1:
  printUsage()

useful_arg = sys.argv[0]

The argparse module helps to eliminate boilerplate code, provides nice formatting for free, and provides useful features. Here is the same code using the ...

Continue reading

Preparing for Defcon by Voiding a Warranty (or how to replace an Asus B121 hard drive)

Preparing for Defcon by Voiding a Warranty (or how to replace an Asus B121 hard drive)

So I thought to myself... Self?  How about we replace the hard drive in this handy tablet, install linux, and bring it to Defcon?  I typically prepare for a security conference by wiping a hard drive before and after so I can experiment and enjoy the con.  Instead of wiping and reinstalling, I have always just popped drives in and out.  I love this device because it weighs 2.5 pounds and has a large 12" x 8" screen which makes a perfect travel companion.

How to open the Asus B121

Tools required:  Something thin like a credit card or ...

Continue reading

Splunk – Customize the “Results per page” Dropdown

Splunk – Customize the “Results per page” Dropdown

Do you want to customize Splunk by:

  • Extending the default choices of 10, 20 and 50 results per page?
  • Changing the default number of search results?

This quick how to describes how to implement both of these changes.

Start by making a custom local copy of configuration file that we are about to change:


cp –p $SPLUNK_HOME/etc/apps/$APPNAME/default/data/ui/views/flashtimeline.xml \ 
$SPLUNK_HOME/etc/apps/$APPNAME/local/data/ui/views/flashtimeline.xml

$APPNAME is your app or search for the default search app

Extend the XML Count options with some extra XML like so:


<module name ...

Continue reading

Aerohive How To: Create a Firewalled and NATed Separate Network

Suppose you want to create a separate wireless network for guests or so that employees may access the Internet with their personal devices. Devices on this separate network should only be able to access the Internet and not be able to access any internal resources. I have not seen this documented anywhere, so I am going to share. There are several steps, but the process is relatively painless.

Start by creating a New VLAN under Configuration > Advanced > Network Objects > VLANs. Choose a VLAN numeral that is not being used. I chose 42.

Now let’s create a New DHCP server ...

Continue reading