Re: Crack a dm-LUKS partition or harddisk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05.11.2009, Si St wrote: 

> For my wireless router I double the character count to 32.

You can safely use up to 63 characters. To set up wireless AP, I use this
little script I hacked together quite some time ago, it works very well. 

It generates passwords in the correct character range for wireless AP
using /dev/random. Save this in a file, do a "chmod +x " on it, and run 
it with the desired length as argument. In case it is a large passphrase
you want to generate, you'll have to move the mouse a bit.


#!/usr/bin/perl -Tw

use strict;

my $randkey;
my $iter;
my $howmany;

$howmany = $ARGV[0];

$randkey = &gen_randkey;

if ($randkey) { 
   print "Passphrase: $randkey\n"; }
else { 
   print "Something went wrong\n"; 
}

sub gen_randkey {

  my $keylength = $howmany;
  my $len = shift; $len = $keylength unless $len; 
  my @range; @range = (33..126);
  my $id = &read_dev_random($len);
  
  return unless $id;

  $id =~ s/(.)/chr($range[ord($1) % $#range+1])/esg;
  return $id;
}

sub read_dev_random {
	                     	
  my $len = shift;
  unless ($len) { print STDERR "No parameter given\n"; return; }
            	
  eval {
  open(RANDOM, "/dev/random") or die; };
  if ($@) { print STDERR "Unable to open the random device\n"; return; }
	    
  my $random;
  unless (read(RANDOM, $random, $len) == $len) { 
  print STDERR "Unable to read from the random device\n"; return;
  }
	    
	close(RANDOM);
	return $random;
}

_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
http://www.saout.de/mailman/listinfo/dm-crypt

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux