Advertisement
saltycracker

BruteFinal.pl

Apr 3rd, 2020
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.21 KB | None | 0 0
  1. #! /usr/bin/env perl
  2.  
  3. use warnings;
  4. use strict;
  5. use utf8;
  6. use feature qw<say>;
  7.  
  8. use List::Util qw<any>;
  9.  
  10. my @chars = map{ord} (0..9,'a'..'z','A'..'Z');
  11. my @firstKey;
  12. my @secondKey;
  13. my $counter = 1;
  14.  
  15. for my $i (@chars) {
  16.     for my $j (@chars) {
  17.         my $i_ans = ($i ^ 0x16);
  18.         my $j_ans = ($j ^ 0x0f);
  19.         my $i_t = any{$_ == $i_ans} @chars;
  20.         my $j_t = any{$_ == $j_ans} @chars;
  21.         if (($i_ans == $j_ans) && $i_t && $j_t) {
  22.             push @firstKey
  23.                 => sprintf "(%d)->First Key: [%s] %s %s", $counter, chr($i_ans), chr($i), chr($j);
  24.             $counter++;
  25.         }
  26.     }
  27. }
  28. $counter = 1;
  29. for my $i (@chars) {
  30.     for my $j (@chars) {
  31.         my $i_ans = ($i ^ 0x1a);
  32.         my $j_ans = ($j ^ 0x02);
  33.         my $i_t = any{$_ == $i_ans} @chars;
  34.         my $j_t = any{$_ == $j_ans} @chars;
  35.         if (($i_ans == $j_ans) && $i_t && $j_t) {
  36.             push @secondKey
  37.                 => sprintf "(%d)->Second Key: [%s] %s %s", $counter, chr($i_ans), chr($i), chr($j);
  38.             $counter++;
  39.         }
  40.     }
  41. }
  42.  
  43. for my $f (@firstKey) {
  44.     say "|------------------------------------------------------------------|";
  45.     say $f;
  46.     for my $s (@secondKey) {
  47.         say "\t\t\t$s";
  48.     }
  49.     say "|------------------------------------------------------------------|";
  50. }
  51.  
  52.  
  53. exit (0);
  54.  
  55. #0x16 0x1a 0x10 0x6c 0x0f 0x02
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement