BASH
		
		Configurare email
		
		Configurare software
		
		Hardware
		
		Linux
		
		Linux Mint
		
		Linux Ubuntu
		
		MIKROTIK
		
		Pentru tonti
		
		Securitate
		
		VMWARE
		
		Windows
		
bash :: functie bash pentru generarea unui mac address
|  CAMSCAPE SERVICES Cristian M. | Title | Functie bash pentru generarea unui MAC address | 
| Tags | bash, genereaza, mac, address | |
| Desc. | Functie bash pentru generarea unui MAC address | |
| Code | KBSH0006 v1.0 | |
| Date | 14 septembrie 2012 | 
Primeste un parametru (0 | 1). Daca e 1 functia genereaza un MAC unicast si care este OUI. Daca este 0, este multicast si non-OUI.
function GenerateMACAddress {
    # Function to check for a process PID
    #
    # Param:
    #   - Type. If 1 then only unicast, OUI enforced. If 0, then multicast and
    #     non-OUI included
    #
    # Return:
    #   - string in MAC address format
    #
    # Copyright CAMSCAPE SERVICES GPLv2
    # http://www.camscape.ro
    #
    # Generate first byte
    if [ $1 -eq 1 ]; then
        TEMP=$(RandomInteger 0 64)
        TEMP=$TEMP"00"
        BYTE=$(IntegerLeftPad $(ConvertIntegerBase $TEMP 2 16) 2)
    else
        BYTE=$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    fi
    MAC=$BYTE
    # Next bytes
    MAC=$MAC":"$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    MAC=$MAC":"$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    MAC=$MAC":"$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    MAC=$MAC":"$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    MAC=$MAC":"$(IntegerLeftPad $(ConvertIntegerBase $(RandomInteger 0 256) 10 16) 2)
    echo $MAC
}

