The challenge at level krypton5 from the "README" file is much briefer than previously, but is based on the previous level:
--------------------------------------------------------------------------------
$cat README 
Frequency analysis can break a known key length as well.  Lets try one
last polyalphabetic cipher, but this time the key length is unknown.


Enjoy.
--------------------------------------------------------------------------------
So basically I have to do the same as the previous level, but for an unknown key length.
In other words I'll need to write a program to automate the previous method, while also allowing for variable key lengths.
From the output of the program I should be able to see English-ish words for some value of key length, which should tell me the key length, and be able to refine the key from there.
At least that's the idea...

The BASH script I came up with to do this is as follows, with added comments. (It's not elegant, but does the job!)
--------------------------------------------------------------------------------
$more cracker
#!/bin/bash

ciphertext=$(cat found3|tr -d ' ') # Put the cipher text into a variable for use later
#letterarray=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) # I could use an array starting at "A" as my letter 'ruler' to compute values between ciphertext and plaintext.
letterarray=( E F G H I J K L M N O P Q R S T U V W X Y Z A B C D ) #but it is more efficient to zero index from "E", since working from E as most frequent, so I use this as my zero index point.

#Do some testing of the array by writing it out two different ways, to make sure I didn't mess up. :)
echo "TEST:"
echo "Print letters in letterarray by value:"
for i in "${letterarray[@]}";do echo -ne $i;done
echo -e "\nPrint letters in letterarray by index:"
for i in {0..25};do echo -ne ${letterarray[$i]};done
echo

#Main outer loop to repeat for each keylength
for i in {1..15} #keylengths
do
  echo "$ciphertext"|fold -w$i >folded-ciphertext #Fold the ciphertext according to the keylength, $i
  for (( j=1 ; j <=$i ; j++ ))
  do
    cut -c$j folded-ciphertext > folded-ciphertext-keylen_cut$i.$j #Slice each column, $j, of the folded ciphertext
    echo -ne "$i.$j : "
    cat folded-ciphertext-keylen_cut$i.$j | sort | uniq -c | sort -rn | sed -n '1s/.*\(.\)$/\1/p' #Perform frequency analysis and output only the most frequent character
    eletter=$(cat folded-ciphertext-keylen_cut$i.$j | sort | uniq -c | sort -rn | sed -n '1s/.*\(.\)$/\1/p') #Do the same as the line above, but store in variable $eletter
    for (( k=0 ; k <=${#letterarray[*]} ; k++ )) #Now loop, $k, through the array and find the index value of the $eletter, i.e. the ciphertext character index corresponding to plaintext "E".
    do
      if [ ${letterarray[$k]} == $eletter ]
      then
         echo $eletter found at index $k
         # No need to -4 as using E as zero index. echo $k - 4 = $(($k -4)) ${letterarray[$(($k-4))]} #I would need this if I had indexed my array from "A" instead of "E", but dont.
         #lettershift=$(($k -4)) #This too isn't needed because I'm indexing the array from "E" instead of "A".
         #cat folded-ciphertext-keylen_cut$i.$j | tr $(printf %${k}s | tr ' ' '.')\A-Z A-ZA-Z >folded-plain-keylen_cut$i.$j
         m=$((26 - $k ))
         cat folded-ciphertext-keylen_cut$i.$j | tr $(printf %${m}s | tr ' ' '.')\A-Z A-ZA-Z >folded-plain-keylen_cut$i.$j #Perform a ROTxx decipher on the ciphertext according to the key shift, $m. This effectively gives me deciphered column slices of the ciphertext, and these columns of plaintext need to be stitched together later on.
         break
      fi
    done
  done
#OK, now I look at stitching the columns of plaintext back together..
  pastelist="" #Reset the list of files to paste together.
  for (( j=1 ; j <=$i ; j++ ))
  do
    pastelist+=$(echo -ne "folded-plain-keylen_cut$i.$j ") #Create a list of files that need to be pasted together
  done
  echo pastelist is $pastelist
  paste ${pastelist} |tr -d '\t' |paste - - - - - > pasted-plain.$i #Paste the files together, remove the tabs inbetween the columns, then paste 5 blocks of these side by side for easier reading.
done

--------------------------------------------------------------------------------
Having run this I noticed that English like words appeared for a key length of x (number spoiler removed).
--------------------------------------------------------------------------------
$./cracker ;head -n5 pasted-plain.*
--------------------------------------------------------------------------------
I then modified the "cracker" script to explicitly use the x character key it was automatically generating.
I used the other ciphertexts "found2" "found3" to indicate better key characters to tweak the values of the x character key until the ciphertext was correctly being deciphered.
--------------------------------------------------------------------------------
$cat pasted-plain.x| tr -d '\t'|head 
ITWASTHEBESTOFTIMESITWASTHEWORSTOFTIMESITWAST
HEAGEOFWISDOMITWASTHEAGEOFFOOLISHNESSITWASTHE
EPOCHOFBELIEFITWASTHEEPOCHOFINCREDULITYITWAST
HESEASONOFLIGHTITWASTHESEASONOFDARKNESSITWAST
HESPRINGOFHOPEITWASTHEWINTEROFDESPAIRWEHADEVE
RYTHINGBEFOREUSWEHADNOTHINGBEFOREUSWEWEREALLG
OINGDIRECTTOHEAVENWEWEREALLGOINGDIRECTTHEOTHE
RWAYINSHORTTHEPERIODWASSOFARLIKETHEPRESENTPER
IODTHATSOMEOFITSNOISIESTAUTHORITIESINSISTEDON
ITSBEINGRECEIVEDFORGOODORFOREVILINTHESUPERLAT

--------------------------------------------------------------------------------
Applying this x character key to the ciphertext of the password, "BELOS Z", yielded the password to the next level, krypton6.
I had also generated a few files along the way...
--------------------------------------------------------------------------------
$ls
cracker                            folded-ciphertext-keylen_cut13.10  folded-ciphertext-keylen_cut15.7  folded-ciphertext-keylen_cut9.1  folded-plain-keylen_cut12.5   folded-plain-keylen_cut15.15  folded-plain-keylen_cut8.3
cracker-keylenx                    folded-ciphertext-keylen_cut13.11  folded-ciphertext-keylen_cut15.8  folded-ciphertext-keylen_cut9.2  folded-plain-keylen_cut12.6   folded-plain-keylen_cut15.2   folded-plain-keylen_cut8.4
folded-ciphertext                  folded-ciphertext-keylen_cut13.12  folded-ciphertext-keylen_cut15.9  folded-ciphertext-keylen_cut9.3  folded-plain-keylen_cut12.7   folded-plain-keylen_cut15.3   folded-plain-keylen_cut8.5
folded-ciphertext-keylen_cut10.1   folded-ciphertext-keylen_cut13.13  folded-ciphertext-keylen_cut2.1   folded-ciphertext-keylen_cut9.4  folded-plain-keylen_cut12.8   folded-plain-keylen_cut15.4   folded-plain-keylen_cut8.6
folded-ciphertext-keylen_cut10.10  folded-ciphertext-keylen_cut13.2   folded-ciphertext-keylen_cut2.2   folded-ciphertext-keylen_cut9.5  folded-plain-keylen_cut12.9   folded-plain-keylen_cut15.5   folded-plain-keylen_cut8.7
folded-ciphertext-keylen_cut10.2   folded-ciphertext-keylen_cut13.3   folded-ciphertext-keylen_cut3.1   folded-ciphertext-keylen_cut9.6  folded-plain-keylen_cut13.1   folded-plain-keylen_cut15.6   folded-plain-keylen_cut8.8
folded-ciphertext-keylen_cut10.3   folded-ciphertext-keylen_cut13.4   folded-ciphertext-keylen_cut3.2   folded-ciphertext-keylen_cut9.7  folded-plain-keylen_cut13.10  folded-plain-keylen_cut15.7   folded-plain-keylen_cut9.1
folded-ciphertext-keylen_cut10.4   folded-ciphertext-keylen_cut13.5   folded-ciphertext-keylen_cut3.3   folded-ciphertext-keylen_cut9.8  folded-plain-keylen_cut13.11  folded-plain-keylen_cut15.8   folded-plain-keylen_cut9.2
folded-ciphertext-keylen_cut10.5   folded-ciphertext-keylen_cut13.6   folded-ciphertext-keylen_cut4.1   folded-ciphertext-keylen_cut9.9  folded-plain-keylen_cut13.12  folded-plain-keylen_cut15.9   folded-plain-keylen_cut9.3
folded-ciphertext-keylen_cut10.6   folded-ciphertext-keylen_cut13.7   folded-ciphertext-keylen_cut4.2   folded-plain-keylen_cut10.1      folded-plain-keylen_cut13.13  folded-plain-keylen_cut2.1    folded-plain-keylen_cut9.4
folded-ciphertext-keylen_cut10.7   folded-ciphertext-keylen_cut13.8   folded-ciphertext-keylen_cut4.3   folded-plain-keylen_cut10.10     folded-plain-keylen_cut13.2   folded-plain-keylen_cut2.2    folded-plain-keylen_cut9.5
folded-ciphertext-keylen_cut10.8   folded-ciphertext-keylen_cut13.9   folded-ciphertext-keylen_cut4.4   folded-plain-keylen_cut10.2      folded-plain-keylen_cut13.3   folded-plain-keylen_cut3.1    folded-plain-keylen_cut9.6
folded-ciphertext-keylen_cut10.9   folded-ciphertext-keylen_cut14.1   folded-ciphertext-keylen_cut5.1   folded-plain-keylen_cut10.3      folded-plain-keylen_cut13.4   folded-plain-keylen_cut3.2    folded-plain-keylen_cut9.7
folded-ciphertext-keylen_cut1.1    folded-ciphertext-keylen_cut14.10  folded-ciphertext-keylen_cut5.2   folded-plain-keylen_cut10.4      folded-plain-keylen_cut13.5   folded-plain-keylen_cut3.3    folded-plain-keylen_cut9.8
folded-ciphertext-keylen_cut11.1   folded-ciphertext-keylen_cut14.11  folded-ciphertext-keylen_cut5.3   folded-plain-keylen_cut10.5      folded-plain-keylen_cut13.6   folded-plain-keylen_cut4.1    folded-plain-keylen_cut9.9
folded-ciphertext-keylen_cut11.10  folded-ciphertext-keylen_cut14.12  folded-ciphertext-keylen_cut5.4   folded-plain-keylen_cut10.6      folded-plain-keylen_cut13.7   folded-plain-keylen_cut4.2    found1
folded-ciphertext-keylen_cut11.11  folded-ciphertext-keylen_cut14.13  folded-ciphertext-keylen_cut5.5   folded-plain-keylen_cut10.7      folded-plain-keylen_cut13.8   folded-plain-keylen_cut4.3    found2
folded-ciphertext-keylen_cut11.2   folded-ciphertext-keylen_cut14.14  folded-ciphertext-keylen_cut6.1   folded-plain-keylen_cut10.8      folded-plain-keylen_cut13.9   folded-plain-keylen_cut4.4    found3
folded-ciphertext-keylen_cut11.3   folded-ciphertext-keylen_cut14.2   folded-ciphertext-keylen_cut6.2   folded-plain-keylen_cut10.9      folded-plain-keylen_cut14.1   folded-plain-keylen_cut5.1    krypton6
folded-ciphertext-keylen_cut11.4   folded-ciphertext-keylen_cut14.3   folded-ciphertext-keylen_cut6.3   folded-plain-keylen_cut1.1       folded-plain-keylen_cut14.10  folded-plain-keylen_cut5.2    pasted-plain.1
folded-ciphertext-keylen_cut11.5   folded-ciphertext-keylen_cut14.4   folded-ciphertext-keylen_cut6.4   folded-plain-keylen_cut11.1      folded-plain-keylen_cut14.11  folded-plain-keylen_cut5.3    pasted-plain.10
folded-ciphertext-keylen_cut11.6   folded-ciphertext-keylen_cut14.5   folded-ciphertext-keylen_cut6.5   folded-plain-keylen_cut11.10     folded-plain-keylen_cut14.12  folded-plain-keylen_cut5.4    pasted-plain.11
folded-ciphertext-keylen_cut11.7   folded-ciphertext-keylen_cut14.6   folded-ciphertext-keylen_cut6.6   folded-plain-keylen_cut11.11     folded-plain-keylen_cut14.13  folded-plain-keylen_cut5.5    pasted-plain.12
folded-ciphertext-keylen_cut11.8   folded-ciphertext-keylen_cut14.7   folded-ciphertext-keylen_cut7.1   folded-plain-keylen_cut11.2      folded-plain-keylen_cut14.14  folded-plain-keylen_cut6.1    pasted-plain.13
folded-ciphertext-keylen_cut11.9   folded-ciphertext-keylen_cut14.8   folded-ciphertext-keylen_cut7.2   folded-plain-keylen_cut11.3      folded-plain-keylen_cut14.2   folded-plain-keylen_cut6.2    pasted-plain.14
folded-ciphertext-keylen_cut12.1   folded-ciphertext-keylen_cut14.9   folded-ciphertext-keylen_cut7.3   folded-plain-keylen_cut11.4      folded-plain-keylen_cut14.3   folded-plain-keylen_cut6.3    pasted-plain.15
folded-ciphertext-keylen_cut12.10  folded-ciphertext-keylen_cut15.1   folded-ciphertext-keylen_cut7.4   folded-plain-keylen_cut11.5      folded-plain-keylen_cut14.4   folded-plain-keylen_cut6.4    pasted-plain.2
folded-ciphertext-keylen_cut12.11  folded-ciphertext-keylen_cut15.10  folded-ciphertext-keylen_cut7.5   folded-plain-keylen_cut11.6      folded-plain-keylen_cut14.5   folded-plain-keylen_cut6.5    pasted-plain.3
folded-ciphertext-keylen_cut12.12  folded-ciphertext-keylen_cut15.11  folded-ciphertext-keylen_cut7.6   folded-plain-keylen_cut11.7      folded-plain-keylen_cut14.6   folded-plain-keylen_cut6.6    pasted-plain.4
folded-ciphertext-keylen_cut12.2   folded-ciphertext-keylen_cut15.12  folded-ciphertext-keylen_cut7.7   folded-plain-keylen_cut11.8      folded-plain-keylen_cut14.7   folded-plain-keylen_cut7.1    pasted-plain.5
folded-ciphertext-keylen_cut12.3   folded-ciphertext-keylen_cut15.13  folded-ciphertext-keylen_cut8.1   folded-plain-keylen_cut11.9      folded-plain-keylen_cut14.8   folded-plain-keylen_cut7.2    pasted-plain.6
folded-ciphertext-keylen_cut12.4   folded-ciphertext-keylen_cut15.14  folded-ciphertext-keylen_cut8.2   folded-plain-keylen_cut12.1      folded-plain-keylen_cut14.9   folded-plain-keylen_cut7.3    pasted-plain.7
folded-ciphertext-keylen_cut12.5   folded-ciphertext-keylen_cut15.15  folded-ciphertext-keylen_cut8.3   folded-plain-keylen_cut12.10     folded-plain-keylen_cut15.1   folded-plain-keylen_cut7.4    pasted-plain.8
folded-ciphertext-keylen_cut12.6   folded-ciphertext-keylen_cut15.2   folded-ciphertext-keylen_cut8.4   folded-plain-keylen_cut12.11     folded-plain-keylen_cut15.10  folded-plain-keylen_cut7.5    pasted-plain.9
folded-ciphertext-keylen_cut12.7   folded-ciphertext-keylen_cut15.3   folded-ciphertext-keylen_cut8.5   folded-plain-keylen_cut12.12     folded-plain-keylen_cut15.11  folded-plain-keylen_cut7.6    README
folded-ciphertext-keylen_cut12.8   folded-ciphertext-keylen_cut15.4   folded-ciphertext-keylen_cut8.6   folded-plain-keylen_cut12.2      folded-plain-keylen_cut15.12  folded-plain-keylen_cut7.7
folded-ciphertext-keylen_cut12.9   folded-ciphertext-keylen_cut15.5   folded-ciphertext-keylen_cut8.7   folded-plain-keylen_cut12.3      folded-plain-keylen_cut15.13  folded-plain-keylen_cut8.1
folded-ciphertext-keylen_cut13.1   folded-ciphertext-keylen_cut15.6   folded-ciphertext-keylen_cut8.8   folded-plain-keylen_cut12.4      folded-plain-keylen_cut15.14  folded-plain-keylen_cut8.2
--------------------------------------------------------------------------------
So I now had access to the next level, krypton6!
--------------------------------------------------------------------------------
$ssh -p2222 krypton6@krypton.labs.overthewire.org
 _                     _              
| | ___ __ _   _ _ __ | |_ ___  _ __  
| |/ / '__| | | | '_ \| __/ _ \| '_ \ 
|   <| |  | |_| | |_) | || (_) | | | |
|_|\_\_|   \__, | .__/ \__\___/|_| |_|
           |___/|_|                   
a http://www.overthewire.org wargame.

krypton6@krypton.labs.overthewire.org's password: 
Welcome to Ubuntu 14.04 LTS (GNU/Linux 4.4.0-92-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

krypton6@krypton:~$ figlet $(whoami)
 _                     _               __   
| | ___ __ _   _ _ __ | |_ ___  _ __  / /_  
| |/ / '__| | | | '_ \| __/ _ \| '_ \| '_ \ 
|   <| |  | |_| | |_) | || (_) | | | | (_) |
|_|\_\_|   \__, | .__/ \__\___/|_| |_|\___/ 
           |___/|_|                         
krypton6@krypton:~$