Mac modifier

Discussion in 'C++' started by DevNull, May 2, 2007.

  1. DevNull

    DevNull Guest

    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());
    }
     
    DevNull, May 2, 2007
    #1
    1. Advertising

  2. DevNull

    Jim Langston Guest

    "DevNull" <> wrote in message
    news:...
    > 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
     
    Jim Langston, May 2, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski
    Replies:
    1
    Views:
    2,754
    Herfried K. Wagner
    Jul 23, 2003
  2. =?Utf-8?B?YWppdA==?=

    access modifier for webcontrols

    =?Utf-8?B?YWppdA==?=, Nov 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    371
    Eliahu
    Nov 17, 2004
  3. Fabio Negri Cicotti [MCP]

    Overloads modifier

    Fabio Negri Cicotti [MCP], Dec 13, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    488
    William F. Robertson, Jr.
    Dec 13, 2004
  4. Mr Newbie
    Replies:
    3
    Views:
    500
    Kevin Spencer
    Oct 31, 2005
  5. Stephen

    Protected access modifier in Struct

    Stephen, Apr 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    402
    Stephen
    Apr 7, 2006
Loading...

Share This Page