lua-users home
lua-l archive

Re: lua code help for beginner

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


On 11-12-28 08:50 AM, chuck@allthehowards.com wrote: [ 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

=============================

I admit, I am still studying it to figure out how it works - but

can someone offer recommendations on opening the single file to read all this data

and creating 3 output files to each contain MAC address, IP1 and IP2.

Sample file would be: (of course with many multiple lines of each type.

 

[DHCP IP: (192.168.20.109)] to MAC address 00:16:B6:94:60:26, Tuesday, Dec 13,2011 19:06:03

[DoS attack: Smurf] attack packets in last 20 sec from ip [178.151.111.21], Tuesday, Dec 13,2011 07:14:20

[LAN access from remote] from 82.228.252.76:14961 to 192.168.20.109:42765 Monday, Dec 12,2011 09:57:50



Hi Chuck
 
Maybe you could just edit the bit at the end that prints the three variables. You could just write a little function to write to a file and then call it three times with the three variables and three file names.

This is covered around page 196 of programming in Lua.

Hope this helps-Patrick

AltStyle によって変換されたページ (->オリジナル) /