lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> [DHCP IP: (192.168.20.109)] to MAC address 00:16:B6:94:60:26, 
> Tuesday, Dec 13,2011 19:06:03 and I would like to extract the MAC address
> and
> [DoS attack: Smurf] attack packets in last 20 sec from ip 
> [178.151.111.21], Tuesday, Dec 13,2011 07:14:20 and I would like to 
> extract the IP address
> and [LAN access from remote] from 82.228.252.76:14961 to 
> 192.168.20.109:42765 Monday, Dec 12,2011 09:57:50 and I would like to 
> extract the first IP address

Try this:

s=[[
[DHCP IP: (192.168.20.109)] to MAC address 00:16:B6:94:60:26,
Tuesday, Dec 13,2011 19:06:03 and I would like to extract the MAC address
and
[DoS attack: Smurf] attack packets in last 20 sec from ip
[178.151.111.21], Tuesday, Dec 13,2011 07:14:20 and I would like to
extract the IP address
and [LAN access from remote] from 82.228.252.76:14961 to
192.168.20.109:42765 Monday, Dec 12,2011 09:57:50 and I would like to
extract the first IP address
]]

for a in s:gmatch("DHCP.-to MAC address (.-),") do print("MAC",a) end
for a in s:gmatch("DoS.-from ip.%[(.-)%]") do print("IP1",a) end
for a in s:gmatch("LAN.-%] from (.-):.- to") do print("IP2",a) end