Mac modifier

D

DevNull

Recently where I live they have made tried to make the act of
wardriving illegal.
This in a state that has several "state run" wifi hotspots, that all
run wide open (go figure).
Anyways this got me thinking about the potential for plausible
deniability should the need ever arise. I realized that you actually
need to change 2 things, MAC address and hostname, since both are
typicall tracked by DHCP servers.
Below is the complete source for a new tool I made which does exactly
that.
It will randomly change both your hostname and MAC address until you
reboot your computer, at which time (hopefully), they revert to their
default settings again.
Save this, compile it, and run it using sudo and giving a single
argument which is the device name to modify

sudo ./modify eth0

This program is completely free, totally public domain, and
considering the draconian laws getting passed lately I don't even want
credit for it. As such it is also 100% unsupported, if it hoses your
computer, thats your problem. This is for education use only, please
don't use this for illegal purposes, void where prohibited etc, blah
and insert other legal jargon here.

Enjoy!

#include <iostream>
#include <cstdlib>
#include <ctime>

std::string Pickchar(std::string chars){
int pos = rand()%chars.length();
return(chars.substr(pos,1));
}

std::string HostName(){
int x = rand()%32+3;
std::string name;
for(int count = 0; count < x; count++){
name +=Pickchar("abcdefeghijklmnopqrstuvwxyz.
1234567890");
}
return(name);
}

std::string MakeMac(){
std::string mac;
for(int x = 1; x < 18; x++){
if(x%3 > 0){
mac += Pickchar("0123456789ABCDEF");
}else{
mac +=":";
}
}
return(mac);
}

int main(int argc, char* argv[]){
srand((unsigned)time(0));
std::string device = argv[1];
std::string change;
change += "hostname ";
change += HostName();
change +="\n";
change += "ifconfig ";
change += device;
change += " down hw ether ";
change += MakeMac();
change += "\n";
change += "ifconfig ";
change += device;
change += " up\n";
change += "ifdown ";
change += device;
change += "\n";
change += "ifup ";
change += device;
change +="\n";
std::cout << change;
system(change.c_str());
}
 
J

Jim Langston

DevNull said:
Recently where I live they have made tried to make the act of
wardriving illegal.
This in a state that has several "state run" wifi hotspots, that all
run wide open (go figure).
Anyways this got me thinking about the potential for plausible
deniability should the need ever arise. I realized that you actually
need to change 2 things, MAC address and hostname, since both are
typicall tracked by DHCP servers.
Below is the complete source for a new tool I made which does exactly
that.
It will randomly change both your hostname and MAC address until you
reboot your computer, at which time (hopefully), they revert to their
default settings again.
Save this, compile it, and run it using sudo and giving a single
argument which is the device name to modify

sudo ./modify eth0

This program is completely free, totally public domain, and
considering the draconian laws getting passed lately I don't even want
credit for it. As such it is also 100% unsupported, if it hoses your
computer, thats your problem. This is for education use only, please
don't use this for illegal purposes, void where prohibited etc, blah
and insert other legal jargon here.

Enjoy!

#include <iostream>
#include <cstdlib>
#include <ctime>

std::string Pickchar(std::string chars){
int pos = rand()%chars.length();
return(chars.substr(pos,1));
}

std::string HostName(){
int x = rand()%32+3;
std::string name;
for(int count = 0; count < x; count++){
name +=Pickchar("abcdefeghijklmnopqrstuvwxyz.
1234567890");
}
return(name);
}

std::string MakeMac(){
std::string mac;
for(int x = 1; x < 18; x++){
if(x%3 > 0){
mac += Pickchar("0123456789ABCDEF");
}else{
mac +=":";
}
}
return(mac);
}

int main(int argc, char* argv[]){
srand((unsigned)time(0));
std::string device = argv[1];
std::string change;
change += "hostname ";
change += HostName();
change +="\n";
change += "ifconfig ";
change += device;
change += " down hw ether ";
change += MakeMac();
change += "\n";
change += "ifconfig ";
change += device;
change += " up\n";
change += "ifdown ";
change += device;
change += "\n";
change += "ifup ";
change += device;
change +="\n";
std::cout << change;
system(change.c_str());
}

This is probably more appropriate to alt.2600.hackers.programming
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top