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"

lunes, 4 de julio de 2016

Usando TCPdump para ver paquetes de ruteo RIP

Para realizar la verificacion de los paquetes RIPv2 propagados en una red local, usaremos tcpdump con las siguientes opciones:

 -n: formato numero  
 -vv: informacion de los paquetes capturados  
 -i eth9.110: interfase seleccionada  
 udp port 520: protocolo UDP puerto 520   

Verificando estas opciones en el trafico capturado podemos ver las redes que son publicadas por RIP desde la direccion ip 172.20.110.16,  en multicas hacia la IP 224.0.0.9

 [root@ENG04-SVR02 ~]# tcpdump -n -vv -i eth9.110 udp port 520  
 tcpdump: listening on eth9.110, link-type EN10MB (Ethernet), capture size 65535 bytes  
 01:37:02.705511 IP (tos 0x0, ttl 1, id 43338, offset 0, flags [none], proto UDP (17), length 512)  
   172.20.110.16.router > 224.0.0.9.router: [udp sum ok]  
     RIPv2, Response, length: 484, routes: 24  
      AFI IPv4,     1.1.1.0/30, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.1.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.2.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.3.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.4.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.5.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.8.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.9.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.10.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.11.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.12.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.13.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.14.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.15.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.16.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.17.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.18.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.19.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.20.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.21.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.22.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.24.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.25.0/24, tag 0x0000, metric: 1, next-hop: self  
      AFI IPv4,   10.110.26.0/24, tag 0x0000, metric: 1, next-hop: self  
     0x0000: 0202 0000 0002 0000 0101 0100 ffff fffc  
     0x0010: 0000 0000 0000 0001 0002 0000 0a6e 0100  
     0x0020: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x0030: 0a6e 0200 ffff ff00 0000 0000 0000 0001  
     0x0040: 0002 0000 0a6e 0300 ffff ff00 0000 0000  
     0x0050: 0000 0001 0002 0000 0a6e 0400 ffff ff00  
     0x0060: 0000 0000 0000 0001 0002 0000 0a6e 0500  
     0x0070: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x0080: 0a6e 0800 ffff ff00 0000 0000 0000 0001  
     0x0090: 0002 0000 0a6e 0900 ffff ff00 0000 0000  
     0x00a0: 0000 0001 0002 0000 0a6e 0a00 ffff ff00  
     0x00b0: 0000 0000 0000 0001 0002 0000 0a6e 0b00  
     0x00c0: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x00d0: 0a6e 0c00 ffff ff00 0000 0000 0000 0001  
     0x00e0: 0002 0000 0a6e 0d00 ffff ff00 0000 0000  
     0x00f0: 0000 0001 0002 0000 0a6e 0e00 ffff ff00  
     0x0100: 0000 0000 0000 0001 0002 0000 0a6e 0f00  
     0x0110: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x0120: 0a6e 1000 ffff ff00 0000 0000 0000 0001  
     0x0130: 0002 0000 0a6e 1100 ffff ff00 0000 0000  
     0x0140: 0000 0001 0002 0000 0a6e 1200 ffff ff00  
     0x0150: 0000 0000 0000 0001 0002 0000 0a6e 1300  
     0x0160: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x0170: 0a6e 1400 ffff ff00 0000 0000 0000 0001  
     0x0180: 0002 0000 0a6e 1500 ffff ff00 0000 0000  
     0x0190: 0000 0001 0002 0000 0a6e 1600 ffff ff00  
     0x01a0: 0000 0000 0000 0001 0002 0000 0a6e 1800  
     0x01b0: ffff ff00 0000 0000 0000 0001 0002 0000  
     0x01c0: 0a6e 1900 ffff ff00 0000 0000 0000 0001  
     0x01d0: 0002 0000 0a6e 1a00 ffff ff00 0000 0000  
     0x01e0: 0000 0001  

domingo, 13 de marzo de 2016

Automatizacion del hogar - Orbivo S20

Para la automatización de tomas eléctricas, he seleccionado el Smart Socket Orbivo S20. Este equipo se puede manejar desde una aplicación para smartphone, y se conecta mediante la red WiFi.


Revisándolo por dentro, se ve como un rele acompañado de una electrónica simple, el adaptador WiFi se encuentra en una segunda tarjeta montada sobre la tarjeta principal.


jueves, 11 de febrero de 2016

Identificando aplicaciones por puerto de conexion TCP utilizado


Para verificar que programa o aplicación esta usando un puerto TCP en particular, podemos utiliza el utilitario netstat.





netstat --help
usage: netstat [-veenNcCF] [] -r         netstat {-V|--version|-h|--help}
       netstat [-vnNcaeol] [ ...]
       netstat { [-veenNac] -I[] | [-veenNac] -i | [-cnNe] -M | -s } [delay]

        -t, --tcp
        -p, --programs             display PID/Program name for sockets
        -a, --all, --listening     display all sockets (default: connected)
        -l, --listening            display listening server sockets

[root@ENG04-SVR02 ~]# netstat -tapl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 *:commplex-link             *:*                         LISTEN      7187/iperf
tcp        0      0 *:rfe                       *:*                         LISTEN      8638/iperf
tcp        0      0 localhost:mysql             *:*                         LISTEN      2024/mysqld
tcp        0      0 *:ndmp                      *:*                         LISTEN      2247/perl
tcp        0      0 *:http                      *:*                         LISTEN      2204/httpd
tcp        0      0 *:ssh                       *:*                         LISTEN      2080/sshd
tcp        0      0 localhost:smtp              *:*                         LISTEN      2186/master
tcp        0      0 *:9050                      *:*                         LISTEN      2218/php
tcp        0      0 *:https                     *:*                         LISTEN      2204/httpd
tcp        0      0 *:terabase                  *:*                         LISTEN      6258/iperf
tcp        0      0 10.117.51.164:ssh           10.10.106.125:37525         ESTABLISHED 6261/sshd
tcp        0      0 10.117.51.164:ssh           192.168.44.214:53198        ESTABLISHED 8505/sshd
tcp        0      0 10.117.51.164:ssh           10.10.106.134:59753         ESTABLISHED 28289/sshd
tcp        0    100 10.117.51.164:ssh           10.10.106.134:59739         ESTABLISHED 28071/sshd
tcp        0      0 10.117.51.164:ssh           10.10.106.125:37514         ESTABLISHED 6127/sshd
tcp        0    200 10.117.51.164:ssh           192.168.44.214:51089        ESTABLISHED 697/sshd
tcp        0      0 localhost:mysql             localhost:48223             ESTABLISHED 2024/mysqld
tcp        0      0 localhost:48223             localhost:mysql             ESTABLISHED 2047/rsyslogd


domingo, 31 de enero de 2016

Camara de Seguridad Xiaomi Ant



He tenido oportunidad de trabajar con la cámara IP "Xiaomi Xiaoyi Ants Night Vision Smart Camera", probándola en uso doméstico, y hasta ahora, mi veredicto es aprobado con restricciones.

Entre las cosas positivas que le veo mencionare:
- Es bonita a la vista
- Tiene visión nocturna
- El precio es económico.
- Permite almacenamiento con memoria SD.
- Manda alertas de movimiento usando la aplicación.

En las cosas no tan positivas mencionare:
- Por defecto solo se puede acceder desde el smartphone usando su aplicación
- No tiene almacenamiento en la nube, ni permite interactuar directamente con un NVR.
- No tiene documentación disponible para poder integrarlo a aplicaciones de videovigilancia.



Acciones pendiente:

1. Probar el tutorial en web para habilitar la cámara como sistema de monitoreo.
Setting up Xiaomi / XiaoYi Small Ants Intelligent Camera (Home IP Camera) for security monitoring