Re: IPTables and RegEx

2006-05-14 Thread John W. Krahn
Sumo Wrestler (or just ate too much) wrote: > > Try something like this: > > use strict; > use Data::Dumper; > > $var = ' > iptables -A INPUT -p tcp -s 123.45.678.90 --dport 22 -j ACCEPT > > and ... > > iptables -A INPUT -p tcp --dport 25 -j ACCEPT > '; > > open (FH, '<', \$var) > or die

Re: IPTables and RegEx

2006-05-13 Thread Sumo Wrestler (or just ate too much)
Richard Bagshaw wrote: Peeps, Hi Richard. I'm very new to perl and I have been trying to solve a problem for a few days now, I am reading a file that I use to setup my firewall rules on a Linux box, the file contains many lines, but as an example I will show just two here :- iptables -A

Re: IPTables and RegEx

2006-05-13 Thread D. Bolliger
D. Bolliger am Sonntag, 14. Mai 2006 00.34: > Richard Bagshaw am Samstag, 13. Mai 2006 23.11: > > Hi, > > > > Thanks for the points, you are totally right though, I had thought about > > the order being different in the lines, im still pretty green when it > > comes to regular expressions, not yet

Re: IPTables and RegEx

2006-05-13 Thread D. Bolliger
John W. Krahn am Sonntag, 14. Mai 2006 01.03: > D. Bolliger wrote: > > John W. Krahn am Sonntag, 14. Mai 2006 00.11: > >>Or you could "cheat" and let Getopt::Long parse it for you: > >> > >>$ perl -MGetopt::Long -MData::Dumper -e' > >>$_ = q[iptables -A INPUT -p tcp -s 123.45.678.90 --dport 22 -j A

Re: IPTables and RegEx

2006-05-13 Thread John W. Krahn
D. Bolliger wrote: > John W. Krahn am Sonntag, 14. Mai 2006 00.11: >> >>Or you could "cheat" and let Getopt::Long parse it for you: >> >>$ perl -MGetopt::Long -MData::Dumper -e' >>$_ = q[iptables -A INPUT -p tcp -s 123.45.678.90 --dport 22 -j ACCEPT]; >>my %h; >>{ local @ARGV = split; >>GetOp

Re: IPTables and RegEx

2006-05-13 Thread D. Bolliger
John W. Krahn am Sonntag, 14. Mai 2006 00.11: > Richard Bagshaw wrote: > > I'm very new to perl and I have been trying to solve a problem for a few > > days now, I am reading a file that I use to setup my firewall rules on a > > Linux box, the file contains many lines, but as an example I will show

Re: IPTables and RegEx

2006-05-13 Thread D. Bolliger
Richard Bagshaw am Samstag, 13. Mai 2006 23.11: > Hi, > > Thanks for the points, you are totally right though, I had thought about > the order being different in the lines, im still pretty green when it > comes to regular expressions, not yet figured out a way to get around > the differences in ord

Re: IPTables and RegEx

2006-05-13 Thread John W. Krahn
Richard Bagshaw wrote: > > I'm very new to perl and I have been trying to solve a problem for a few > days now, I am reading a file that I use to setup my firewall rules on a > Linux box, the file contains many lines, but as an example I will show > just two here :- > > iptables -A INPUT -p tcp -

Re: IPTables and RegEx

2006-05-13 Thread Richard Bagshaw
Hi, Thanks for the points, you are totally right though, I had thought about the order being different in the lines, im still pretty green when it comes to regular expressions, not yet figured out a way to get around the differences in order, but I will RTFM :-) Thanks for the feedback :-)

Re: IPTables and RegEx

2006-05-13 Thread D. Bolliger
Richard Bagshaw am Samstag, 13. Mai 2006 15.56: > Peeps, > > I'm very new to perl and I have been trying to solve a problem for a few > days now, I am reading a file that I use to setup my firewall rules on a > Linux box, the file contains many lines, but as an example I will show > just two here :

Re: IPTables and RegEx

2006-05-13 Thread Doug Maxwell
On 5/13/06, Richard Bagshaw <[EMAIL PROTECTED]> wrote: I'm very new to perl and I have been trying to solve a problem for a few days now, I am reading a file that I use to setup my firewall rules on a Linux box, the file contains many lines, but as an example I will show just two here :- iptable

IPTables and RegEx

2006-05-13 Thread Richard Bagshaw
Peeps, I'm very new to perl and I have been trying to solve a problem for a few days now, I am reading a file that I use to setup my firewall rules on a Linux box, the file contains many lines, but as an example I will show just two here :- iptables -A INPUT -p tcp -s 123.45.678.90 --dport 2