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.
Friday, 30 April 2010
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:
Click here to get it
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
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)
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)
Tuesday, 16 March 2010
Limit Deluge based on time of day, command arguments or a toggle button
I live with my girlfriend and share the apartment with two others, so I can't use all of the bandwidth all of the time. I also work from home, and like to limit my torrent sharing if I'm doing something that requires more bandwidth, so I made this script.
It runs at startup and at 7.10pm on week days. If my computer is turned on in the evening, it limits the bandwidth deluge uses so others in the apartment can do what they like without me clogging things up. This works better than a normal cron job would since I may not have my computer turned on when the cron job is scheduled to run.
I also run this command via a menu entry, with the argument 'toggle', so i can cycle through the three bandwidth settings when i need to.
For deluge versions >= 1.2.0, the script is available here. For pre 1.2.0, the script is available here. See update post for details.
Change the config values at the top of the script to ones that are suitable for you. The script sends a notification via send-notify, and also logs actions to /var/log/messages.
Because it also accepts the arguments 'limit', 'partial' and 'unlimit', it can also be run from the command line, perhaps via ssh if you run deluge on your server or if you want to create buttons for every setting, rather than rely on the 'toggle' functionality.
It runs at startup and at 7.10pm on week days. If my computer is turned on in the evening, it limits the bandwidth deluge uses so others in the apartment can do what they like without me clogging things up. This works better than a normal cron job would since I may not have my computer turned on when the cron job is scheduled to run.
I also run this command via a menu entry, with the argument 'toggle', so i can cycle through the three bandwidth settings when i need to.
For deluge versions >= 1.2.0, the script is available here. For pre 1.2.0, the script is available here. See update post for details.
Change the config values at the top of the script to ones that are suitable for you. The script sends a notification via send-notify, and also logs actions to /var/log/messages.
Because it also accepts the arguments 'limit', 'partial' and 'unlimit', it can also be run from the command line, perhaps via ssh if you run deluge on your server or if you want to create buttons for every setting, rather than rely on the 'toggle' functionality.
Monday, 1 March 2010
Securely delete files using shred via nautilus-actions
"shred - overwrite a file to hide its contents, and optionally delete it"
I encrypt my sensitive information with PGP, but when unencrypting the files to view them I'm left with a plain text version. Using this script enables me to get rid of the plain text versions from within the right-click menu in a secure manner using shred. Shred will overwrite the file(s) 25 times with various patterns before deleting it from the filesystem, making recovery difficult without specialist equipment.
Simply download the script and create a nautilus-actions config. Just pass it the parameter %M, and use it on single or multiple file selections.
Tuesday, 10 February 2009
DVD authoring with one click
I have this set up with nautilus-actions so i can select 1, 2 or 3 video files and it will automatically make a dvd.iso for me. You select:
1 video file : A dvd is created with no menu.
2 video files (containing cd1 & cd1 in their filename) : Both files are joined and dvd is created with no menu.
2 video files (not containing cd1 & cd2) : The script assumes they are episodes or individual films and creates a dvd with a menu.
3 video files : The script creates a dvd with a menu for all 3 files.
Requirements:
ffmpeg, dvdauthor, tovid scripts, mkisofs
I've got my dvd3 script in my path so the target I use for nautilus-actions is: gnome-terminal -x dvd3
Here's the script, and here's the dvd menu background image I use. Be sure to specify it's path near the top of the script. You'll also want to change the ffmpeg option -target pal-dvd on line 82 to -target ntsc-dvd if you live in that part of the world.
1 video file : A dvd is created with no menu.
2 video files (containing cd1 & cd1 in their filename) : Both files are joined and dvd is created with no menu.
2 video files (not containing cd1 & cd2) : The script assumes they are episodes or individual films and creates a dvd with a menu.
3 video files : The script creates a dvd with a menu for all 3 files.
Requirements:
ffmpeg, dvdauthor, tovid scripts, mkisofs
I've got my dvd3 script in my path so the target I use for nautilus-actions is: gnome-terminal -x dvd3
Here's the script, and here's the dvd menu background image I use. Be sure to specify it's path near the top of the script. You'll also want to change the ffmpeg option -target pal-dvd on line 82 to -target ntsc-dvd if you live in that part of the world.
Labels:
dvd authoring,
ffmpeg,
mencoder,
nautilus-actions,
python
Subscribe to:
Posts (Atom)





