Security Basics mailing list archives

Re: [TOOL]TMAC for Linux-beta


From: Sagar Belure <sagar.belure () gmail com>
Date: Wed, 9 Jun 2010 13:15:08 -0700

On Tue, Jun 8, 2010 at 3:05 PM, Ansgar Wiechers
<bugtraq () planetcobalt net> wrote:
On 2010-06-08 Sagar Belure wrote:
TMAC for Linux, is a bash program written for the purpose of changing
the MAC address of network interface cards in Linux OS, provided it
has Bash shell environment.
Please check the details and some sort of, funny description about it.

http://sagar.belure.com/#tmac

This has been successfully tested with Ubuntu system.
Suggestions are welcome.

For one, I fail to see why anyone in his right mind would want to change
the MAC address on every login,

I don't know about others, but it's more like "I PREFER TO DO SO". So,
all I did is, added the option in it.


Second, how does your script account for address collisions?

I appreciate that...I didn't thought of the scenario, where user can
use more than one NIC at same time.
Point added in my TODO list.


Not to mention that your code is way too complex and also assumes that
the number of OUIs in oui.txt will never change.

Second one noted for the update feature.

The whole random address generation can easily be reduced to this (and I suppose an awk
guru will be able to reduce it even more):

----8<----
function octet() {
 printf "%02X" $(($RANDOM % 256))
}

cnt=$(grep "(hex)" oui.txt | wc -l)
oui=$(grep "(hex)" oui.txt | awk -v n=$(($RANDOM % $cnt + 1)) 'NR==n {print $1}')
mac="${oui}-$(octet)-$(octet)-$(octet)"
---->8----

Also, instead of checking $param1 in multiple elif clauses I'd suggest
to use a case statement:

case "$param1" in
 -a)
   # do some
   ;;
 -l)
   # do other
   ;;
 *)
   # print usage information (which I'd probably do with a here
   # document rather than multiple "echo -e" commands)
   ;;
esac

Well, this is the reason, I invited *any* kind of suggestions or
feedback about this.
And yes, I got suggestion about using 'awk' from some other
suggestions also, and will help making it more efficient.
This again, will help making it more portable as well.


If you require bash anyway, at least make good use of its features.

My 0.02 $CURRENCY.

Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky

------------------------------------------------------------------------
Securing Apache Web Server with thawte Digital Certificate
In this guide we examine the importance of Apache-SSL and who needs an SSL certificate.  We look at how SSL works, 
how it benefits your company and how your customers can tell if a site is secure. You will find out how to test, 
purchase, install and use a thawte Digital Certificate on your Apache web server. Throughout, best practices for 
set-up are highlighted to help you ensure efficient ongoing management of your encryption keys and digital 
certificates.

http://www.dinclinx.com/Redirect.aspx?36;4175;25;1371;0;5;946;e13b6be442f727d1
------------------------------------------------------------------------



appreciate all your inputs.


-- 
Thanks,
Sagar Belure
Security Analyst
Secfence Technologies
www.secfence.com

------------------------------------------------------------------------
Securing Apache Web Server with thawte Digital Certificate
In this guide we examine the importance of Apache-SSL and who needs an SSL certificate.  We look at how SSL works, how 
it benefits your company and how your customers can tell if a site is secure. You will find out how to test, purchase, 
install and use a thawte Digital Certificate on your Apache web server. Throughout, best practices for set-up are 
highlighted to help you ensure efficient ongoing management of your encryption keys and digital certificates.

http://www.dinclinx.com/Redirect.aspx?36;4175;25;1371;0;5;946;e13b6be442f727d1
------------------------------------------------------------------------


Current thread: