lunes, 7 de noviembre de 2016

Actualizando datos fabricante <-> direcciones MAC para NMAP

Por defecto, los rangos de direcciones MAC que vienen en las distribuciones, no se encuentran actualizados. Buscando en internet encontre la manera de poder actualizarlas sin mucho drama. A continuacion detallo la informacion: Base de datos actualizada de direcciones MAC: http://standards.ieee.org/regauth/oui/oui.txt Archivo utilizado por NMAP para resolver al fabricante a partir de las direcciones MAC: /usr/share/nmap/nmap-mac-prefixes El procedimiento detallado se encuentra en el siguiente URL http://jhjessup.blogspot.pe/2010/04/update-mac-address-manufacturer-tables.html y el script se detalla:


#!/bin/bash
# update_mac_addresses.sh
# This script downloads the currect mac address data from the IEEE and parses it for nmap and arpwatch.
# nmap-mac-prefixes is for nmap.
# ethercodes.dat is arpwatch.

# Download the current data

wget http://standards-oui.ieee.org/oui.txt

# Divide the data into Manufacturer and Address files
cat oui.txt | grep '(base 16)' | cut -f3 > mac.manufacturer
cat oui.txt | grep '(base 16)' | cut -f1 -d' ' > mac.address

# Paste them back together for nmap data
paste mac.address mac.manufacturer > nmap-mac-prefixes

# Parse the address data for arpwatch
cat mac.address | perl -pe 's/^(([^0].)|0(.))(([^0].)|0(.))(([^0].)|0(.))/\2\3:\5\6:\8\9/' > tmp.address
cat tmp.address | tr [A-Z] [a-z] > mac.address

# Paste the parsed data into the arpwatch file
paste mac.address mac.manufacturer > ethercodes.dat

# Clean up intermediary files
rm tmp.address
rm mac.address
rm mac.manufacturer
rm oui.txt



El archivo "nmap-mac-prefixes" que se genera debe de reemplazar al archivo que se tiene instalado por defecto en la ruta de nmap "/usr/share/nmap/nmap-mac-prefixes"