четверг, 4 августа 2011 г.

Fast change mac-address via bash

#!/bin/bash
export mac=`ifconfig|grep eth0|tr -s ' '|cut -d ' ' -f5`
export command=""
if [ "$mac" != "52:54:00:e4:55:46" ]
    then command="ifconfig eth0 hw ether 52:54:00:e4:55:46"
    else command="ifconfig eth0 hw ether 52:54:00:e4:55:47"
fi
ifconfig eth0 down
sleep 1;
$command
sleep 1;
ifconfig eth0 up

Комментариев нет:

Отправить комментарий