macclone

Publicado por Rafael de Jesus Miranda 29/05/2008

[ Hits: 5.103 ]

Homepage: www.liberdadetecnologica.com

Download macclone.sh




Este script feito em shell com kdialog tem por finalidade clonar o endereço mac.

Permite escolher a interface de rede que está usando e que deseja clonar o mac, se for na eth0, ou eth1 etc. Script bem simples mas útil.

Obs: Execute sempre com sudo anteriormente.

Ex:    $sudo ./macclone

  



Esconder código-fonte

#! /bin/sh

#####################################################################################
# Nome do Script         : clonemac
# Descricao            : Script para clonar mac adress
# Autor             : Rafael de Jesus Miranda
#####################################################################################

interface=$(kdialog --menu "Escolha sua interface" e0 eth0 e1 eth1 e2 eth2 a0 ath0 a1 ath1 a2 ath2)

mac=$(kdialog --inputbox "Digite o endereço mac a ser clonado")

case $interface in

   e0)
   
   ifconfig eth0 down
   ifconfig eth0 hw ether $mac
   ifconfig eth0 up
   ;;

   e1)
   
   ifconfig eth1 down
   ifconfig eth1 hw ether $mac
   ifconfig eth1 up
   ;;

   e2)
        
        ifconfig eth2 down
   ifconfig eth2 hw ether $mac
   ifconfig eth2 up
        ;;

        a0)
        
        ifconfig ath0 down
        ifconfig ath0 hw ether $mac
        ifconfig ath0 up
   ;;

        a1)
   
        ifconfig ath1 down
        ifconfig ath1 hw ether $mac
        ifconfig ath1 up
        ;;

        a2)
        
        ifconfig ath2 down
        ifconfig ath2 hw ether $mac
   ifconfig ath2 up                
   ;;

esac

Scripts recomendados

Monitorando Squid On Line

Feliz Natal para todos do VOL

Atheros AR242x Script de Instalaçao

Converter todas as imagens de um diretório

Criando um usuário em shell script


  

Comentários
[1] Comentário enviado por tiekookeit em 10/05/2010 - 08:58h

Não seria mais fácil colocar assim

#!/bin/bash -l

interface=$(kdialog --menu "Escolha sua interface" e0 eth0 e1 eth1 e2 eth2 a0 ath0 a1 ath1 a2 ath2)
mac=$(kdialog --inputbox "Digite o endereço mac a ser clonado")

(ifconfig ${interface} 2>&1) >/dev/null # testa interface
if [ $? -gt 0 ]; # verifica se o teste falhou
then
kdialog --msgbox "A interface ${interface} nao existe"
exit 1
fi

ifconfig ${interface} down
ifconfig ${interface} hw ether $mac
ifconfig ${interface} up

exit 0


ao invés de usar um case para comparar o que ele digitou?


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts