[pyar] Parser almacena cadenas en diccionario

Ezequiel Garcia elezegarcia en gmail.com
Vie Nov 9 11:26:02 ART 2012


2012/11/9 Alberto Benítez <freestyle10 en gmail.com>:
> Buenas,
>
> Estoy tratando de parsear lineas del log de ip tables, pongo un ejemplo
>
> Feb 20 23:27:11 ubuntu kernel: [1988916.899165] iptables: IN=eth0 OUT=
> MAC=00:00:00:00:00:00:00:
> 00:00:00:00:00:00:00 SRC=192.168.0.3 DST=192.168.0.1 LEN=60 TOS=0x10
> PREC=0x00 TTL=64 ID=30541
> DF PROTO=TCP SPT=60148 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0
>
>
> Es posible parsear esta linea de manera que el diccionario quede por ejemplo
>
> IN -> eth0
>
> MAC -> 00:00:00:00:00:00:00:00:00:00:00:00:00:00
>
>
> He leído algo sobre expresiones regulares pero de entrada parece bastante
> complejo.
>

Como dice el dicho:

Some people, when confronted with a problem, think:
"I know, I'll use regular expressions."
Now they have two problems.

:-)

    Ezequiel



More information about the pyar mailing list