Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computing > Computer Security > Linux software to randomize PC hostname & wireless MAC for privacyat hotspots

Reply
Thread Tools

Linux software to randomize PC hostname & wireless MAC for privacyat hotspots

 
 
Y Knot
Guest
Posts: n/a
 
      09-24-2010
If I understand Jeff L. correctly, hotspots often log your hostname and
wirelss car MAC address; so I wish to automatically change my wireless
card MAC and laptop PC hostname upon every reboot.

On Windows, I can change these things manually but there are plenty of
freeware packages which pseudo-randomize the hostname (based on a lookup
table) and wireless MAC address for added privacy at hotspots upon every
reboot. These work great!

However, on Linux, while I can change these things manually, I have not
yet found software that does so automatically upon every reboot.

Here's how I change the hostname on Linux manually:
$ sudo vi /etc/hosts

Change the contents of /etc/hosts from:
127.0.1.1 ubuntu ubuntu

Change the contents of /etc/hosts to:
# 127.0.1.1 ubuntu ubuntu
127.0.0.1 foo foo

$ sudo echo foo > /etc/hostname
$ sudo reboot

And, here's how I change the MAC address on Linux manually:
$ ifconfig -a | grep HWaddr
$ sudo ifconfig wlan0 down hw ether DE:AD:BE:EF:CA:FE
$ sudo ifconfig wlan0 up

The question is where can I find software that will perform that task of
changing the wireless card MAC address and PC hostname upon every reboot?
 
Reply With Quote
 
 
 
 
Nomen Nescio
Guest
Posts: n/a
 
      09-24-2010
> If I understand Jeff L. correctly, hotspots often log your hostname and
> wirelss car MAC address; so I wish to automatically change my wireless
> card MAC and laptop PC hostname upon every reboot.


> On Windows, I can change these things manually but there are plenty of
> freeware packages which pseudo-randomize the hostname (based on a lookup
> table) and wireless MAC address for added privacy at hotspots upon every
> reboot. These work great!


> However, on Linux, while I can change these things manually, I have not
> yet found software that does so automatically upon every reboot.


> Here's how I change the hostname on Linux manually:
> $ sudo vi /etc/hosts


> Change the contents of /etc/hosts from:
> 127.0.1.1 ubuntu ubuntu


> Change the contents of /etc/hosts to:
> # 127.0.1.1 ubuntu ubuntu
> 127.0.0.1 foo foo


> $ sudo echo foo > /etc/hostname
> $ sudo reboot


> And, here's how I change the MAC address on Linux manually:
> $ ifconfig -a | grep HWaddr
> $ sudo ifconfig wlan0 down hw ether DE:AD:BE:EF:CA:FE
> $ sudo ifconfig wlan0 up


> The question is where can I find software that will perform that task of
> changing the wireless card MAC address and PC hostname upon every reboot?


I know nothing about Linux, but can't you put your code into a
bat file and execute upon every boot?













 
Reply With Quote
 
 
 
 
Bit Twister
Guest
Posts: n/a
 
      09-24-2010
On Fri, 24 Sep 2010 16:59:30 +0000 (UTC), Y Knot wrote:
>
> However, on Linux, while I can change these things manually, I have not
> yet found software that does so automatically upon every reboot.
>


For about 99.99% of the time, whatever you can do manually, you can
put the commands in a script to do the same thing.


> The question is where can I find software that will perform that task of
> changing the wireless card MAC address and PC hostname upon every reboot?


If you look in /etc/init.d you will see several scripts which execute
during system startup/shutdown.

If you look in /etc you will see several directories which contain
links back to /etc/init.d scripts. Do a
ls /etc/rc?.d

Now look in a directory, with
ls -l /etc/rc2.d/*
Those S* links are the order they
execute during Startup and the K* are the links executed in that order
during kill/shutdown.

If you were to do the command
runlevel
you would see what level you are running and can look in that
directory to see what executes when.

If you do a
$ runlevel
N 2
the your runlevel is 2. So, do a
ls -l /etc/rc2.d/*

I your case you might try creating a /etc/init.d/rnd_hostname
then create a /etc/rc2.d/S05rnd_hostname link pointing to
/etc/init.d/rnd_hostname.

Next boot, S05rnd_hostname would run your script to change host name.

Going to guess you are running ubuntu. It runs dhclient which gets
your ip address and whatnot to connect to the internet.

Doing a man dhclient eventually suggests doing a
man dhclient_script
which can lead to the fact that you can create a
/etc/dhcp3/dhclient-exit-hooks script. That is where I would try to
put code to munge your MAC address.

You might want to bookmark this url
http://tldp.org/LDP/abs/html/index.html

You could create /etc/dhcp3/dhclient-exit-hooks with
echo $@ > /tmp/hooks
env >> /tmp/hooks

Set execute permission with
chmod +x /etc/dhcp3/dhclient-exit-hooks

After booting, look at /tmp/hooks to see what information is available
for your code.

Now, delete /tmp/hooks and restart the network and see what you have.

rm /tmp/hooks
service network-manager restart
cat /tmp/hooks

All the above needs to done from a root terminal. To get to a root terminal:

sudo -i

when through with root terminal, enter the command exit or do a control d

--
The warranty and liability expired as you read this message.
If the above breaks your system, it's yours and you keep both pieces.
Practice safe computing. Backup the file before you change it.
Do a, man command_here or cat command_here, before using it.
 
Reply With Quote
 
Y Knot
Guest
Posts: n/a
 
      09-25-2010
On Fri, 24 Sep 2010 19:44:15 +0200, Nomen Nescio wrote:
> I know nothing about Linux, but can't you put your code into a
> bat file and execute upon every boot?


Probably.

The goal is to put it in the 'startup' directory (/etc/init.d/) somehow.

I did find a good way to 'randomize' the MAC address manually:
`echo $RANDOM$RANDOM | md5sum | sed -r 's/(..)/\1:/g; s/^(.{17}).*$/\1/;'`

And, I did find a way to 'randomize' the hostname based on a random
selection out of the standard Linux dictionary of words at /usr/share/
dict/words

The question now is how to tie all that together so that the random wlan0
mac and the random hostname are assigned upon reboot of the Ubuntu 10.04
laptop.




 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a
 
      09-25-2010
On Sat, 25 Sep 2010 01:29:17 +0000 (UTC), Y Knot wrote:

> The goal is to put it in the 'startup' directory (/etc/init.d/) somehow.
>
> The question now is how to tie all that together so that the random wlan0
> mac and the random hostname are assigned upon reboot of the Ubuntu 10.04
> laptop.


As an FYI: I took a quick peek through Ubuntu's init.d/ scripts.
I will suggest you change hostname on shutdown since I did not see
when hostname set during boot/start.

Put you code in rnd_hostname script I suggested and create a
Kxxrnd_hostname link in /etc/rcx.d

Suggest taking one of the scripts in init.d, copy to rnd_hostname and
start playing around.

Better yet, install virtualbox, create a guest virtual machine, take a
snapshot and start playing around. That way if you screw it up, you
can delete current snapshot, create a new on, and try again.

Changing hostname on the fly can cause you to lose gui desktop manager.

You might want to http://groups.google.com/groups/search to check out
init scripts.

http://groups.google.com/groups/sear...hors=&safe=off

alt.computer.security would be off topic now that you have a direction.

comp.unix.shell for scripting questions.
alt.os.linux.ubuntu for specific ubuntu questions.
ubuntu has a forum where you might get some help.
 
Reply With Quote
 
alexd
Guest
Posts: n/a
 
      09-25-2010
Meanwhile, at the alt.internet.wireless Job Justification Hearings, Bit
Twister chose the tried and tested strategy of:

> As an FYI: I took a quick peek through Ubuntu's init.d/ scripts.
> I will suggest you change hostname on shutdown since I did not see
> when hostname set during boot/start.


I've got /etc/init.d/hostname on my 10.04 laptop, although it's an Upstart
skeleton script so I can't actually see what it does.

--
<http://ale.cx/> (AIM:troffasky) ()
09:32:51 up 1 day, 15:52, 3 users, load average: 0.00, 0.02, 0.04
Qua illic est accuso, illic est a vindicatum

 
Reply With Quote
 
alexd
Guest
Posts: n/a
 
      09-25-2010
Meanwhile, at the alt.internet.wireless Job Justification Hearings, Y Knot
chose the tried and tested strategy of:

> And, I did find a way to 'randomize' the hostname based on a random
> selection out of the standard Linux dictionary of words at /usr/share/
> dict/words


Wouldn't it be funny if you got busted because your laptop had assigned
itself a hostname of 'pederast' [or similar].

--
<http://ale.cx/> (AIM:troffasky) ()
09:39:31 up 1 day, 15:59, 3 users, load average: 0.04, 0.01, 0.01
Qua illic est accuso, illic est a vindicatum

 
Reply With Quote
 
Shadow
Guest
Posts: n/a
 
      09-25-2010
On Fri, 24 Sep 2010 16:59:30 +0000 (UTC), Y Knot <>
wrote:
>However, on Linux, while I can change these things manually, I have not
>yet found software that does so automatically upon every reboot.

http://www.alobbs.com/macchanger/
Been around for ages. Packages available for ubuntu, debian,
etc etc
Put it in rc.local. But why on boot ?
Just link to a script. Don't forget the gksu, or whatever, you
need to be root.
[]'s
 
Reply With Quote
 
Y Knot
Guest
Posts: n/a
 
      09-27-2010
On Sat, 25 Sep 2010 11:03:42 -0300, Shadow wrote:

> http://www.alobbs.com/macchanger/
> Been around for ages.
> But why on boot


I already tested MacChanger which didn't add ANY value whatsoever.
It's EXACTLY the same number of steps with MacChanger than without
MacChanger (so what's the point of the program anyway?).

With MacChanger, the steps are:
1. sudo macchanger -s wlan0
2. sudo /etc/init.d/networking stop
3. sudo macchanger --another wlan0
4. sudo /etc/init.d/networking start

Without MacChanger, the steps are:
1. sudo /etc/init.d/networking stop
2. sudo ifconfig wlan0 down hw ether DE:AD:BE:EF:CA:FE
3. sudo ifconfig wlan0 up
4. sudo /etc/init.d/networking start

The hostname can ONLY be changed (AFAIK) upon reboot anyway, so you may
as well do the MAC at the same time.

This is such a basic need that I'm sure a LOT of people have done it
already. The trick is to find them!

I'm working on adapting this script:
http://cryptoanarchy.org/wiki/Random_hostname_on_boot

 
Reply With Quote
 
Shadow
Guest
Posts: n/a
 
      09-27-2010
On Mon, 27 Sep 2010 05:40:07 +0000 (UTC), Y Knot <>
wrote:

>On Sat, 25 Sep 2010 11:03:42 -0300, Shadow wrote:
>
>> http://www.alobbs.com/macchanger/
>> Been around for ages.
>> But why on boot

>
>I already tested MacChanger which didn't add ANY value whatsoever.
>It's EXACTLY the same number of steps with MacChanger than without
>MacChanger (so what's the point of the program anyway?).
>
>With MacChanger, the steps are:
>1. sudo macchanger -s wlan0
>2. sudo /etc/init.d/networking stop
>3. sudo macchanger --another wlan0
>4. sudo /etc/init.d/networking start

is line one necessary ?
/sbin/ifconfig wlan0 down
/sbin/(or wherever)/macchanger -A wlan0
/sbin/ifconfig wlan0 up
>
>Without MacChanger, the steps are:
>1. sudo /etc/init.d/networking stop
>2. sudo ifconfig wlan0 down hw ether DE:AD:BE:EF:CA:FE

And that gives you a random MAC ?
DeadBeefCafe ? HELP!!! ALERT!! A HACKER!!!!
macchanger -A gives you a random MAC from a KNOWN
manufacturer.
and macchanger can be easily scripted.
This second example does not give you a random MAC.
>3. sudo ifconfig wlan0 up
>4. sudo /etc/init.d/networking start
>
>The hostname can ONLY be changed (AFAIK) upon reboot anyway, so you may
>as well do the MAC at the same time.
>
>This is such a basic need that I'm sure a LOT of people have done it
>already. The trick is to find them!
>
>I'm working on adapting this script:
>http://cryptoanarchy.org/wiki/Random_hostname_on_boot

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why wont this Randomize? (Classic VB Script ASP) Badass Scotsman ASP .Net 1 05-05-2006 07:53 PM
Telecom targets PSP with wireless hotspots XP NZ Computing 0 09-21-2005 08:37 AM
RMI: take ip/hostname what client was using and give it back as aremote objects hostname AWieminer Java 0 07-12-2005 08:05 PM
own code for randomize Sweety C Programming 2 07-27-2004 08:28 AM
Randomize STL stack Zaphod C++ 3 04-27-2004 02:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57