I regularly find myself in need of regular expressions. Google is of course helpful for these but since Slashdot has a nice article throwing them out there for me, I figure I’ll grab some here for quick access:
IP Address:
/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/
Mac Address:
/^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/
(more…)
I’m always forgetting which options get me the output I like from tcpdump so I’m posting it here for all to see. This line gets close to the output of EetherPeek that I always liked but costs about $500 less. Here it is:
tcpdump -vvv -i en0 -X -s 0
Here’s a breakdown for what it does:
- “-vvv” Turns on uber-verbose mode giving the most information
- “-i en0″ sets the device to listen on (in this case the first ethernet card)
- “-X” prints hex and any ascii text (human readable)
- “-s 0″ grabs the entire packet (or n bytes if not 0)
What is scp?
Scp (secure copy) is a program that is part of the ssh (secure shell) package and is used to securely copy data from, to or between remote computers. All data transferred via scp is encrypted, including your user name and password. If you run OS X, you already have it on your machine, just fire up terminal and go. If you are on another Unix or Linux, you may need to install it.
Why should I be using scp?
The only people who ask this question are those who don’t realize just how easy it is to “eavesdrop” on other people’s computer connections. Suffice to say, it is extremely easy to do and you should be worried. If you are set on using ftp to transfer your files you can use sftp which is also part of the ssh package. Scp isn’t necicarily a replacement for ftp (although it certainly can be) but it can be less cumbersome in many applications (such as quickly uploading a file).
(more…)