Guest User

Crypter

a guest
May 5th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.13 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # Crypter by R3s1stanc3 (http://www.r3s1stanc3.co.cc)
  4.  
  5. use Crypt::CBC ;
  6.  
  7. if ( @ARGV[3] ) { run ( @ARGV[0], @ARGV[1], @ARGV[2], @ARGV[3] ) ; }
  8. else { usage ( ) ; }
  9.  
  10. sub usage
  11. {
  12.   print "[*] Usage: $0 filename key operation  algorithm\n" ;
  13.   print "[-] Operation: dec, enc\n" ;
  14.   print "[-] Algorithm: Twofish, Blowfish AES\n" ;
  15. }
  16.  
  17. sub run
  18. {
  19.  
  20.   $file = $_[0] ;
  21.   $key = $_[1] ;
  22.   $op = $_[2] ;
  23.   $alg = $_[3]
  24.  
  25.   if ( $op eq "dec" || $op eq "enc" ) { $op .= "rypting" ; }
  26.   else
  27.   {
  28.     print "Unknown Operation\n" ;
  29.     usage ( ) ;
  30.     exit ;
  31.   }
  32.  
  33.   if ( $alg eq "Twofish" || $alg eq "Blowfish" || $alg eq "AES" ) { $crypt = Crypt::CBC -> new ( -key => $key, -crypher => $alg ) ; }
  34.   else
  35.   {
  36.     print "Unknown algorithm\n" ;
  37.     usage ( ) ;
  38.     exit ;
  39.   }
  40.  
  41.   open ( F, "$file" ) ;
  42.   $crypt -> start ( $op ) ;
  43.   while ( read ( F, $buffer, 1024 ) )
  44.   {
  45.     $file_new .= $crypt -> crypt ( $buffer ) ;
  46.   }
  47.   $file_new .= $crypt -> finish ;
  48.   close ( F ) ;
  49.  
  50.   open ( file, ">", "$file" ) ;
  51.   print file $file_new ;
  52.   close (file ) ;
  53.  
  54.   print "Done\n" ;
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment