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

Re: [K12OSN] Ot: scripting help



Here's a quick & dirty perl script that will give you what you describe below:

#!/usr/bin/perl -w
#
# Takes a string and changes one character at a time to upper case

$str = shift;
$length = length($str);
@array = split(//,$str);
for ($i=0;$i<$length;$i++) {
  if ($array[$i] =~ /\D/) {
    $array[$i] = uc($array[$i]);
    print @array;
    print "\n";
    $array[$i] = lc($array[$i]);
  }
}

### End of script

This should give you 123Password, 123pAssword, and so on; it only changes one character each time, and then changes it back. So, it won't give you 123PAssword, nor 123PASsword, etc. Put this in a file, make it executable, and then pass string that you want to modify as a command line parameter, like so:

script 123password

HTH

Petre

Peter Hartmann wrote:
I must have mistyped a password for my appliance (pbx) that has a
https login....becasuse I can't get in!  (slaps head) I'm trying to
figure out how to automatacally generate a password list that like
this:  display every permutation of upper and lower case of a word
prepended by the same number.

ie.

123Password
123pAssword
123paSsword
123pasSword


THANK YOU,
Peter

_______________________________________________
K12OSN mailing list
K12OSN redhat com
https://www.redhat.com/mailman/listinfo/k12osn
For more info see <http://www.k12os.org>



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