Code: Select all
#!/usr/bin/perl -w
use Time::Local;
my $AMANDA='amandabackup';
$AMANDA_HOME = (getpwnam($AMANDA) )[7] || die "Cannot find $AMANDA home directory\n" ;
$AM_PASS = "$AMANDA_HOME/.am_passphrase";
$ENV{'PATH'} = '/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin';
$ENV{'GNUPGHOME'} = "$AMANDA_HOME/.gnupg";
sub encrypt() {
system "gpg --batch --disable-mdc --symmetric --cipher-algo AES256 --passphrase-fd 3 3<$AM_PASS";}
sub decrypt() {
system "gpg --batch --quiet --no-mdc-warning --decrypt --passphrase-fd 3 3<$AM_PASS";
}
if ( $#ARGV > 0 ) {
die "Usage: $0 [-d]\n";
}
if ( $#ARGV==0 && $ARGV[0] eq "-d" ) {
decrypt();
}
else {
encrypt();
}
Code: Select all
\begin{flushleft}
\texttt{\#!/usr/bin/perl -w} \\
\texttt{use Time::Local;} \\
\texttt{my \$AMANDA='amandabackup';} \\
\texttt{\$AMANDA\_HOME = (getpwnam(\$AMANDA) )[7] || die "Cannot find \$AMANDA home directory\backslash n" ;} \\
\texttt{\$AM\_PASS = "\$AMANDA\_HOME/.am\_passphrase";} \\
\texttt{\$ENV{'PATH'} = '/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin';} \\
\texttt{\$ENV{'GNUPGHOME'} = "\$AMANDA\_HOME/.gnupg";} \\
\texttt{sub encrypt() \{ } \\
\texttt{ system "gpg $--$batch $--$disable-mdc $--$symmetric $--$cipher-algo AES256 $--$passphrase-fd 3 3<\$AM\_PASS";} } \\
\texttt{sub decrypt() \{ } \\
\texttt{ system "gpg $--$batch $--$quiet $--$no-mdc-warning $--$decrypt $--$passphrase-fd 3 3<\$AM\_PASS"; } \\
\texttt{\} } \\
\texttt{if ( \$\#ARGV > 0 ) \{ } \\
\texttt{ die "Usage: \$0 [-d]\backslash n";} \\
\texttt{\} } \\
\texttt{if ( \$\#ARGV==0 && \$ARGV[0] eq "-d" ) \{ } \\
\texttt{ decrypt();} \\
\texttt{\}}
\texttt{else \{ } \\
\texttt{ encrypt();} \\
\texttt{ \} }
\end{flushleft}
Code: Select all
class temp
{
\\this kind of space
}