XML import tool or trick?

Andy Wodfer <[email protected]>
Newsgroups gmane.comp.security.firewalls.m0n0wall
Message-ID <[email protected]>
I need some help again here ... My webserver that's on my LAN interface
(10.0.0.10) is being DDOS'ed (TCP port 80). I need to block the attackers.

I have a txt file containing about 1300 IP addresses (one on each line).

I need to create block rules in my firewall (m0n0wall) for all these IP
addresses. The syntax is:

<rule>
<type>block</type>
<interface>wan</interface>
<protocol>tcp</protocol>
<source>
<address>IP ADDRESS</address>
</source>
<destination>
<any/>
</destination>
<descr>blocked</descr>
</rule>

The IP list .txt file looks like this (just random typed numbers):

200.200.202.2
55.33.100.224
81.55.44.75
and so on ...

Is there a way I can generate the XML data rule tags and insert one IP from
each line into the <address> tag and put everything in a new file with the
rules underneath eachother like this so I can add it to my config backup xml
file?

<rule>
<type>block</type>
<interface>wan</interface>
<protocol>tcp</protocol>
<source>
<address>IP ADDRESS</address>
</source>
<destination>
<any/>
</destination>
<descr>blocked</descr>
</rule>
<rule>
<type>block</type>
<interface>wan</interface>
<protocol>tcp</protocol>
<source>
<address>IP ADDRESS</address>
</source>
<destination>
<any/>
</destination>
<descr>blocked</descr>
</rule>
<rule>
<type>block</type>
<interface>wan</interface>
<protocol>tcp</protocol>
<source>
<address>IP ADDRESS</address>
</source>
<destination>
<any/>
</destination>
<descr>blocked</descr>
</rule>

Thanks for all help!

Cheers,
Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.