Academy Introduction to Bash Scripting.

Anyone who did the module, can give me a hand?
I am at the point of “Flow Control - Loops”
The question is “Create a “For” loop that encodes the variable “var” 28 times in “base64”. The number of characters in the 28th hash is the value that must be assigned to the “salt” variable.”
So I did encode var 28 times in bas64 and send the number of characters to the salt variable, but the decrypt fails, now I don’t understand if I gave the wrong value or there is an issue with openssl?

This is the error I get:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
bad decrypt
140671661004096:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:…/crypto/evp/evp_enc.c:583:

I don’t get bad decrypt anymore but I get a different flag every time I run the script. To be honest I am not sure what they want me to submit as the answer, I’ve tried the flag, the salt, I also gave the flag encoder my $salt variable and tried to encoded the $hash variable as well. I’m really lost here please advise what to submit. I’ve even typed my for loop and salt assignment into the answer box. What am I missing here?

i figured out it was a wrong value eventually.
so once you get the right value for a salt it gets you the flag.

Hello, can someone give me a clue to solve the Comparison Operators exercise, I have tried everything but I cannot provide the correct answer, I have bought the size of the VAR variable and that its content has the value of the VALUE variable, I also make sure that the VAR variable seam greater than 113,469 characters. I enter the last 20 characters but I can’t get it right.

1 Like

Type your comment> @Dannypena said: > Hello, can someone give me a clue to solve the Comparison Operators exercise, I have tried everything but I cannot provide the correct answer, I have bought the size of the VAR variable and that its content has the value of the VALUE variable, I also make sure that the VAR variable seam greater than 113,469 characters. I enter the last 20 characters but I can’t get it right. I believe they meant greater or EQUAL 113,469 characters :slight_smile:

> I believe they meant greater or EQUAL 113,469 characters :slight_smile: This has really annoyed me - it’s an error on HTBs part not defining the operator clearly, or incorrectly… wasted most of my evening on this.

hey bro did you solve this problem?
Create a “For” loop that encodes the variable “var” 28 times in “base64”. The number of characters in the 28th hash is the value that must be assigned to the “salt” variable.
it gives me this error
Extra arguments given.
enc: Use -help for summary.
can u help me please?

I had the same problem and just solved it. The problem is the way you use of counting the characters in var. Basically using “wc” (correct answer) returns one more character than “#var”, as it also counts the newline.

Good morning! I`m working on this lab but the hints says to use tail - 20… Also I can’t seem to get it right!

if [[ $var -ge 113450 && $var =~ [$var][$value* ]]
then
echo $var | tail -c 20

How did you overcome the bad decrypt problem?