perl regexp for iptables

Discussion in 'Perl Misc' started by Kaushal Bhandu, Oct 7, 2004.

  1. 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
     
    Kaushal Bhandu, Oct 7, 2004
    #1
    1. Advertising

  2. Kaushal Bhandu

    Anno Siegel Guest

    Kaushal Bhandu <> wrote in comp.lang.perl.misc:
    > 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
     
    Anno Siegel, Oct 7, 2004
    #2
    1. Advertising

  3. 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


    -berlin.de (Anno Siegel) wrote in message news:<ck3cho$4gn$-Berlin.DE>...
    > Kaushal Bhandu <> wrote in comp.lang.perl.misc:
    > > 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
     
    Kaushal Bhandu, Oct 8, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lincoln Yeoh
    Replies:
    1
    Views:
    1,008
    Ben Morrow
    Nov 12, 2003
  2. Krashan

    Java bindings for IPTABLES

    Krashan, Jul 26, 2005, in forum: Java
    Replies:
    3
    Views:
    1,560
    Pawel Kraszewski
    Jul 26, 2005
  3. Douglas Soares de Andrade

    About a python module (iptables)

    Douglas Soares de Andrade, Nov 10, 2004, in forum: Python
    Replies:
    0
    Views:
    276
    Douglas Soares de Andrade
    Nov 10, 2004
  4. John Hunter

    Re: About a python module (iptables)

    John Hunter, Nov 10, 2004, in forum: Python
    Replies:
    0
    Views:
    384
    John Hunter
    Nov 10, 2004
  5. Joao Silva
    Replies:
    16
    Views:
    381
    7stud --
    Aug 21, 2009
Loading...

Share This Page