perl regexp for iptables

K

Kaushal Bhandu

I want to use the perl regular Expression for iptables script and
arrange the data in tables . I have no idea how to insert the
variables like -m , -A etc . which stand for Appending a new rule to
the script . Then I want to write a custom application ( GUI interface
) that can modify or add rules easily .

eg of a line in the script
-A OUTPUT -p tcp --dport 21 -j ACCEPT FTP

I compared my approach with the webmin mechanism , there seems to be
large difference the way it handles files ..

Can anybody help me with this ??

Kaushal
 
A

Anno Siegel

Kaushal Bhandu said:
I want to use the perl regular Expression for iptables script and
arrange the data in tables .

Which iptables script? Iptables itself appears to be a binary. Their
web site lists dozens of scripts that go with it.
I have no idea how to insert the
variables like -m , -A etc . which stand for Appending a new rule to
the script .

"-m" and "-A" aren't variables, they are text strings. Where do you
want to insert them?
Then I want to write a custom application ( GUI interface
) that can modify or add rules easily .

eg of a line in the script
-A OUTPUT -p tcp --dport 21 -j ACCEPT FTP

I compared my approach with the webmin mechanism , there seems to be
large difference the way it handles files ..

Can anybody help me with this ??

Not before you describe in some more detail what you want to accomplish.

Is the "script" something your program will generate and modify? Or
will your program generate output that is going to be used to run a
given script?

Note that people here will have first-hand knowledge of iptables
only by coincidence. We can help with Perl programs, but not with
how to build an iptables script for a certain purpose.

Anno
 
K

Kaushal Bhandu

Actually I want a script that can modify and generate the
iptables.save script that has default rules for iptables in it . I
want a script that can generate new rules , add to the iptables.save
file and restart the services if necessary . So I have to write system
API and userAPI that can handle this .

I am very much used to the regular expressions . But when u have a
look at the iptables.save file anyone can guess the irregularity in
variables and rules pattern . So I need to have a lot of elseifs in my
script . What I am not getting is whether you can put all the
variables like -m , -A , --dport etc. in an array and use them as
$array[4] ( like this ) in an regular expression .
Or is there any other way we can do this ??

Kaushal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top