bash: 4.4.12 (1) -release

There is a team

! : "`/???/???/???${#?}???<<<_.`";_____=${_::-~$?} ____='__+=___,___=__-___,__<_[$($_____<<<$___>&$[-~${##}])]||____' ((__=-~$?,____))|&$_____ 

which should output Fibonacci numbers.

PS: I don’t even imagine how it can work, but it’s impossible to understand the error in this case. The team is not mine.


There is another team

 : "`/???/???/???${#?}???<<<]`";/???/${_::${#?}}??${_:${#?}:${#?}} 

which prints the date. And here everything is working fine, but I get a mistake from Fibonacci.

  • one
    I think it is better to contact the author of this team - andreymal
  • @ 0xdb, set -x , I apologize, it was sealed. set -x , this is a debug mode, then the launch of the command, a more detailed message will be displayed - Total Pusher

1 answer 1

There is no desire to disassemble the first team, I will disassemble the second, and if you like, disassemble the first one by the same principle, since the idea is very simple.

We substitute the first ${#?} , It is assumed that there will be 1, because this is the length of the return code of the previous command. Usually it is code 0 (if it does not happen), respectively, its length is 1:

 : "`/???/???/???1???<<<]`";/???/${_::${#?}}??${_:${#?}:${#?}} 

by mask /???/???/???1??? After searching the disk, there is a command /usr/bin/sha1sum , at least the script calculates it:

 : "`/usr/bin/sha1sum<<<]`";/???/${_::${#?}}??${_:${#?}:${#?}} 

/usr/bin/sha1sum<<<] roughly corresponds to echo "]" | /usr/bin/sha1sum echo "]" | /usr/bin/sha1sum . Substitute the result:

 : "de603c91038f329cce1cca8a30ea161b2271e2f6 -";/???/${_::${#?}}??${_:${#?}:${#?}} 

the command : "de603c91038f329cce1cca8a30ea161b2271e2f6 -" doesn't do anything useful, but does the corresponding line fall into $_ , and the error code $? will be equal to 0

Therefore, units will be replaced instead of the next ${#?} , Although in my (earlier) version of bash this substitution does not work correctly:

 /???/${_::1}??${_:1:1} 

Next, we substitute the substrings of the $_ variable: ${_::1} takes its first character, i.e. d , and ${_:1:1} is the second, i.e. e

 /???/d??e 

there is a mask /bin/date

  • SHA sum is not a command, but a command argument : - 0andriy
  • one
    @ 0andriy, thank, corrected. - extrn
  • In case someone wants details on my comment: stackoverflow.com/a/3224910/2511795 - 0andriy