Github Account


Check out my github account at https://github.com/bahamas10.  Right now I don’t have much code on there, only a single repository for my various dot files.  As I write more code I’ll be pushing it up to github, in the works right now is a script to automatically rename mp3/flac files based on their artist/album/song tags.


Tags:

GeekTool Desktop v2.0

I updated my desktop with GeekTool and some other enhancements, check it out. Soon I will be posting this to my projects section with all the scripts that i used! check it out.


Twitter API

I don’t use twitter that often, but i have a couple accounts that i like to use. Mike (check out http://lightsandshapes.com) has been writing some scripts in python to access the twitter API, so I am using some of those to automate my twitter accounts.

@daveeddydotcom is an account that is semi-unmanned. It automatically updates whenever there is a new post on daveeddy.com. This allows for people to follow twitter instead of RSS if they want to see my updates. Also, every 4 hours i have script that runs to check for new followers, follow them back, and send them a message telling them to check out my site.

@_datadyne is an account that i created to test out the twitter api scripts. Right now, it will do a search every 4 hours for ‘drupal’ and add the first 50 users that it finds. It will also check to see if it has any new followers every 4 hours and automatically follow them back and send them a message (just like @daveeddydotcom).


How to Detect Arp Poison

Arp Poison Detection

I wrote this script to detect a simple arp poison, and I put it in cron to have it run every minute. The script uses the output of “netstat -r” to find the mac address and the IP address of the default gateway. From there it checks to see if the routers mac address appears more than once in the arp tables of the host machine, which is the output from “arp -a“.

If the routers mac address is the same as a client on the network, then that means your computer has been arp poisoned, and the computer will alert you. This script will alert you over std out, and will also give an alert using Mac’s System Events.

This script should theoretically work on Linux too, just comment out the section with System Events which looks like:

/usr/bin/osascript <<-EOF
tell application "System Events"
	activate
	display dialog "Arp Poison Detected From $line"
end tell
EOF

The Code

#!/bin/bash
#
# arppoison.sh
# by Dave Eddy
# dave@daveeddy.com
# http://www.daveeddy.com
#

routerIP=`/usr/sbin/netstat -nr | grep "default" | tr -s \  | cut "-d " -f 2`
routermac=`/usr/sbin/arp -a | grep "$routerIP)" | cut "-d " -f 4`
/usr/sbin/arp -a | grep -v "$routerIP)" > /tmp/arp_tables.tmp

while read line; do
	var=`echo $line | cut "-d " -f 4`
	if [ "$routermac" = "$var" ]; then
		# alert system events
		/usr/bin/osascript <<-EOF
			tell application "System Events"
			activate
			display dialog "Arp Poison Detected From $line"
		end tell
		EOF
		# END alert to system events, now write to std out.
		echo "ARP poison detected from $line"
	fi
done < /tmp/arp_tables.tmp
rm /tmp/arp_tables.tmp

Download


© Copyright 2012 Dave Eddy
Design by: styleshout | Colourise by: Theme Lab and Best Linux Web Hosting
Heavily modified by Dave Eddy

Powered by WordPress | Valid CSS | XHTML