Skip to content

Commit a6d068d

Browse files
committed
Updated Task-2 code in accordance with the new PS
1 parent 17992fe commit a6d068d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Task-2/cipher.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ wget $URL -q -O encrypted.txt # -q hides the verbose present while running wget
1212

1313
LOWER='abcdefghijklmnopqrstuvwxyz'
1414
SHIFT=1 # Specifies the Caeser shift
15-
E_LASTLINE=$( cat encrypted.txt | tail -1 ) # Stores the Encrypted Last Line, which is assumed to contain (encrypted) 'Queen', 'Mary', or 'Majesty'
15+
E_LASTLINE=$( cat encrypted.txt | tail -2 ) # Stores the Encrypted Last Line, which is assumed to contain (encrypted) 'Queen', 'Mary', or 'Majesty'
1616

1717
while [ $SHIFT -le 25 ] # Brute-force attack on the last line
1818
do
@@ -28,7 +28,7 @@ do
2828
ALPHABETS=$LOWER$UPPER # Entire english alphabet in both cases
2929
TRANSLATION=$T_LOWER$T_UPPER # The entire translation
3030
D_LASTLINE=$( echo $E_LASTLINE | tr $TRANSLATION $ALPHABETS ) # Decrypted Last Line
31-
TREASON=$( echo $D_LASTLINE | egrep -i 'mary|queen|majesty' ) # Case-insensitive egrep search
31+
TREASON=$( echo $D_LASTLINE | egrep -i 'queen|majesty' ) # Case-insensitive egrep search
3232
if [ ${#TREASON} -gt 0 ] # We have found the right translation
3333
then
3434
break

0 commit comments

Comments
 (0)