diff options
Diffstat (limited to 'sql/strip.pl')
-rw-r--r-- | sql/strip.pl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sql/strip.pl b/sql/strip.pl new file mode 100644 index 0000000..51739a6 --- /dev/null +++ b/sql/strip.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +use warnings; +use strict; + +my $ignore = "((([0-9a-f]{2}[:]){5}[0-9a-f]{2})|"; +$ignore .= "([0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2})"; +$ignore .= ").*"; + +my $community = "<removed>"; + +my $skip = 0; + +open (SQL, $ARGV[0]) or die "Unable to open SQL-file"; +while (<SQL>) { + unless (/^$ignore$/){ + + if (/COPY (mbd_log|squeue|temppoll|ap_poll)/){ + $skip = 1; + print; + } + + if (/\\\./){ + $skip = 0; + } + + unless ($skip){ + s/$community/<removed>/g; # community + s/PASSWORD '.+'/PASSWORD '<removed>'/g; # password for SQL-users + s/public$/<removed>/; # public-community -- assuming last column + print; + } + } +} |