exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

BKtclipabdc.c

BKtclipabdc.c
Posted Aug 14, 2000
Authored by Bikappa

BKtclipabdc.c is a tool to change the mac address of your ethernet device. It doesn't change the hardware address, but just the stack implementation of it.

systems | unix
SHA-256 | f8bd82cad3394a8e8ffbbce3e28b60bcb00bff580ed81044a67a2b1a2e664187

BKtclipabdc.c

Change Mirror Download
/*
* _/_/_/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/
* _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/_/
* _/_/_/_/ _/ _/_/ _/ _/ _/_/_/ _/_/_/ _/ _/
* _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/_/_/
* _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
*
*
* $Id: BKtclipabdc.c ,v 9.9 2000/03/18 12:11:09 l0wlevel Exp $
*
* BKtrpibdc.c - Network tool for change local mac address
* Based on Amua Library - Arp&Mac:Use&Abuse
* Coded on a Redbug 5.0+1.0
* Tools used: vi,gcc,ifconfig
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Copyright (c) 2000 bikappa <bikappa@itapac.net> [l0wlevel]
* All rights reserved.
*
*/


#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>

u_char mac_address[6] =
{
0xd0,
0xd0,
0xd0,
0xd0,
0xd0,
0xd0
};

void info()
{
printf("\n Based on Amua Library - Arp&Mac:Use&Abuse\n");
printf("\n This tool change mac address to your ethernet device\n");
printf(" It doesn't change the hardware address, but just the\n");
printf(" stack implementation of it.\n");
printf(" The device must be down. (ifconfig eth$ down)\n\n");
printf(" Copyright (C) 2000 by bikappa <bikappa@itapac.net> [l0wlevel]\n\n");
}

void usage(char * arg)
{
printf("\n BKtclipabdc - Copyright (C) 2000 by bikappa [l0wlevel]\n");
printf(" This tool permit to change your ethernet's MAC address \n\n");
printf(" usage: %s <-i> <-r | -a> \n\n", arg);
printf(" -i info print info about this tool \n");
printf(" -d device number of ethernet device (0 for eth0) \n");
printf(" -r random random address \n");
printf(" -a address set the address \n\n");
}

void print_mac_address(int c,char *arg)
{
for (c = 0; c < 6; c++)
printf("%X ", c[arg] & 0xff);
printf("*\n");
}

void change_mac_address (unsigned char *mac_add, char *ethernet_device)
{
struct ifreq devea;
int socket_chk, i;

socket_chk = socket(AF_INET, SOCK_DGRAM, 0);
if (socket_chk < 0)
{
perror("Socket error");
exit(1);
}

sprintf(devea.ifr_name, "%s", ethernet_device);

if (ioctl(socket_chk, SIOCGIFHWADDR, &devea) < 0)
{
perror(devea.ifr_name);
exit(1);
}

printf("\n *************************************************\n");
printf(" * The current MAC address is: ");
print_mac_address(i,devea.ifr_hwaddr.sa_data);

for(i = 0; i < 6; i++)
i[devea.ifr_hwaddr.sa_data] = i[mac_add];

printf(" * It Changing MAC address to: ");
for (i = 0; i < 6; i++)
printf("%X ", i[mac_add] & 0xff);
printf("*\n");

if (ioctl(socket_chk,SIOCSIFHWADDR,&devea) < 0)
{
printf("\n The %s device must be down\n", ethernet_device);
perror(devea.ifr_name);
exit(1);
}

printf(" * The MAC address is correctly changed *\n");

if (ioctl(socket_chk, SIOCGIFHWADDR, &devea) < 0)
{
perror(devea.ifr_name);
exit(1);
}

printf(" * The setted MAC address is: ");
print_mac_address(i,devea.ifr_hwaddr.sa_data);
printf(" *************************************************\n\n");
close(socket_chk);
}

void set_random_mac_address (char *mac_add)
{
int i;

for(i = 0; i < 6; i++)
i[mac_add] = random() % 256;
}

void set_address (char *mac, char *mac_add)
{
unsigned int temp[6];
int i;

if (sscanf (mac, "%2x:%2x:%2x:%2x:%2x:%2x",
&temp[0], &temp[1], &temp[2], &temp[3], &temp[4], &temp[5]) != 6)
{
printf("The address format is not correct\n");
exit(0);
}

for(i = 0; i < 6; i++)
i[mac_add] = temp[i];
}

int main(int argc, char ** argv)
{
char c;
char *ethernet_device = "eth0";

int
count_1 = 0,
count_2 = 0;

extern char *optarg;

if (argc == 1)
{
usage(argv[0]);
exit(1);
}

while ((c = getopt(argc, argv, "-ira:d:")) != EOF)
{
switch(c)
{
case 'i' :
info();
exit(1);
case 'r' :
count_1++;
set_random_mac_address(mac_address);
break;
case 'a' :
count_1++;
set_address(optarg,mac_address);
break;
case 'd' :
count_2++;
ethernet_device = optarg;
break;
}

if (count_1 > 1 || count_2 > 1)
{
printf("Bad options\n");
exit(1);
}
}
change_mac_address(mac_address,ethernet_device);
return (0);
}
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close