Permalink
Browse files

added chainmgr_test.pl to test IPTables::ChainMgr

git-svn-id: file:///home/mbr/svn/psad_repos/psad/trunk@1289 91a0a83b-1414-0410-bf9a-c3dbc33e90b6
  • Loading branch information...
1 parent 6f9971c commit 5603e45b8ddf3db4932c348596af5f761ed17e37 @mrash committed Mar 4, 2005
Showing with 26 additions and 0 deletions.
  1. +26 −0 chainmgr_test.pl
View
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+use lib '/usr/lib/psad';
+use IPTables::ChainMgr;
+use IPTables::Parse;
+use strict;
+
+my $ipt = new IPTables::ChainMgr(
+ 'iptables' => '/sbin/iptables'
+);
+
+my ($rv, $status_msg) = $ipt->create_chain('filter', 'PSAD');
+print "$status_msg: $rv\n";
+
+($rv, $status_msg) = $ipt->add_ip_rule('1.1.1.1', 'filter', 'PSAD', 'DROP');
+print "$status_msg: $rv\n";
+($rv, $status_msg) = $ipt->add_ip_rule('1.1.1.1', 'filter', 'PSAD', 'DROP');
+print "$status_msg: $rv\n";
+
+($rv, $status_msg) = $ipt->delete_ip_rule('1.1.1.1', 'filter', 'PSAD', 'DROP');
+print "$status_msg: $rv\n";
+
+($rv, $status_msg) = $ipt->delete_chain('filter', 'PSAD');
+print "$status_msg: $rv\n";
+
+exit 0;

0 comments on commit 5603e45

Please sign in to comment.