Friday 30 April 2010

mitm.py updated

Coldfire over at the hak5 forums suggested a change to the targetting function in my ettercap/sslstrip man-in-the-middle script (see previous blog post) to overcome a problem with his version of nmap (or perhaps, actually, the LAN he was testing since we both use nmap v5.00)

The script has been updated and can be found in the same place, namely here. If it worked before, it'll work now and may now work on a wider variety of LANs.

Thursday 15 April 2010

Batch renaming script updated

I added some command line arguments so you can easily use it directly from the terminal. You can navigate to the directory where your files are and use the argument * to select all the files in the current working directory, or use the -c argument to add conditionals (boolean 'not', 'and', 'or') that'll apply a filter on the current working directory, eg:

renamer.py -c 'foo'
will select all files with 'foo' in their name

renamer.py -c 'foo' and not 'bar'
will select all files with 'foo' in their name, except for those with 'bar'.

Click here to get it

Tuesday 13 April 2010

Batch renamer using python string methods

I'll admit it: I'm crap at regex. I find python's string manipulation a lot more intuitive, and I'm finding this script a lot quicker to work with than any GUI renaming tools or the bash shell, too.

Add it to your nautilus or thunar action menu and work with the filenames like you've put them all in a python list and are writing the for loop expression


You have a few variables available to you: the filename, it's basename, it's extention and the element's index within the list. It lets you do most things to strings that python lets you do since it passes your command directly to python. The only limitation is that it need to be a one-liner, and it needs to return a string. Click here to familiarise yourself with python's string methods.

It'll let you confirm before applying changes, and reset if you tell it not to confirm.



Here are some examples from the help section if you're new to python:

n = b.replace('foo', 'bar')+e
Renames feefoobar.txt to feebarbar.txt
Replaces foo with bar in basename, and appends the extention

n = n.split('foo')[0]+'.log'
Renames feefoobar.txt to fee.log
Splits the filename at 'foo' and returns the part before the split, and appends a .log extention

n = b+str(i)+e
Renames feefoobar.txt to feefoobar0.txt
Adds the current element's index integer as a string to the end of the basename, then appends the extention


Click here to get it

Edit: This has been updated 

Thursday 8 April 2010

Man in the middle mischief with a simple automating script

I haven't published any of my security related scripts or talked about any penetration testing and security auditing here before, but it's probably something I'll start to do more of.

This is really just to make sslstrip setup more convenient. What's so interesting about sslstrip is how it shows that the average user completley ignores whether an apparently secure site is actually https:// or if its plain old http://. If you're unfamiliar with sslstrip then you should really be visiting Moxie's website.

This script automates the process of becoming the man in the middle and running sslstrip, a tool to present the target with an http page whenever they should be getting an https page. It uses ettercap to arp poison the target on the LAN, and also to display any caught login information. Ettercap on it's own is great for capturing http login info and can also manipulate SSL, although we're using it here because it partners so nicely with sslstrip so we can disregard SSL all together for any target on our LAN. The script uses nmap to create a target choice menu and finds your IP and the gateway IP, making everything except the choice of target automatic.

Click here to grab it.

Depends on:
iptables nat
nmap
sslstrip
ettercap (with the iptables uncommented from the ettercap config file, often located at /etc/etter.conf)