macclone
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
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
Descrição
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
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
#! /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
#!/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?