Exemplo n.º 1
0
func revertMac(name string) (err error) {
	currentMacInfo, err := getCurrentMacInfo(name)
	if err != nil {
		return
	}
	LogWriter.Info(currentMacInfo)
	permMac, err := lmf.GetPermanentMac(name)
	if err != nil {
		return
	}
	err = lmf.RevertMac(name)
	if err != nil {
		return
	}
	newMac, err := lmf.GetCurrentMac(name)
	if err != nil {
		return
	}
	if lmf.CompareMacs(permMac, newMac) {
		newMac, err2 := getMacInfo(name, "New MAC")
		if err2 != nil {
			err = err2
			return
		}
		LogWriter.Info(newMac)
	}
	return
}
Exemplo n.º 2
0
func spoofMac(name string, mac string) (err error) {
	currentMacInfo, err := getCurrentMacInfo(name)
	if err != nil {
		return
	}
	fmt.Println(currentMacInfo)
	pMac, err := net.ParseMAC(mac)
	if err != nil {
		return
	}
	err = lmf.SetMac(name, mac)
	if err != nil {
		return
	}
	newMac, err := lmf.GetCurrentMac(name)
	if err != nil {
		return
	}
	changed := lmf.CompareMacs(pMac, newMac)
	if changed {
		newMacInfo, err2 := getMacInfo(name, "New MAC")
		if err2 != nil {
			err = err2
			return
		}
		fmt.Printf(newMacInfo)
	}
	return
}