Solution de balldeux pour A l'envers

intro misc algo

13 décembre 2023

Table des matières

Description

C’est un challenge où il faut envoyer une chaine reçue en l’inversant jusqu’à obtenir le flag.

Solution

Très simplement en bash en utilisant le fichier spécial /dev/tcp/{host}/{port} pour ouvrir une socket en lecture/écriture.

Code

#!/bin/bash

exec 3<>/dev/tcp/localhost/4000

while read line 
  do
    echo $line
    if [[ $line == \>\>\>* ]]
    then
      nline=$(echo $line |rev |tr -d '>>>')
      echo $nline
      echo $nline >&3
    fi
done <&3

exec 3<&-
exec 3>&-

Exécution

$ ./intro-1.sh


>>> ANSSI
ISSNA
Well done, continue!
>>> Agence
ecnegA
Well done, continue!
>>> nationale
elanoitan
Well done, continue!
>>> Oui
iuO
Well done, continue!
>>> Bonjour
ruojnoB
Well done, continue!
>>> France
ecnarF
Well done, continue!
>>> baguette
etteugab
Well done, continue!
>>> cassoulet
teluossac
Well done, continue!
>>> 1KN1fFn2
2nFf1NK1
Well done, continue!
>>> k7QOf9TP
PT9fOQ7k
Well done, continue!
>>> jGCFtj5c
c5jtFCGj
Well done, continue!
>>> cFLFLtsb
bstLFLFc
Well done, continue!
>>> 2F6QQEsw
wsEQQ6F2
Well done, continue!
>>> LojC2igq
qgi2CjoL
Well done, continue!
>>> cWKXbvAR
RAvbXKWc
Well done, continue!
>>> OSvABjAC
CAjBAvSO
Well done, continue!
>>> Gwnrx9mG9XbQEpqPFyJwWgVk6Z1ZXWRW
WRWXZ1Z6kVgWwJyFPqpEQbX9Gm9xrnwG
Well done, continue!
>>> QYWSWvrd8DNJhZjobfErw5CwjBdPS66r
r66SPdBjwC5wrEfbojZhJND8drvWSWYQ
Well done, continue!
>>> zt2YLB21KzxIrvjpSpWFMDyS4PRUCUeB
BeUCURP4SyDMFWpSpjvrIxzK12BLY2tz
Well done, continue!
>>> VcelyCRs6LYAFZxGnWrcseuLP6NMk1BE
EB1kMN6PLuescrWnGxZFAYL6sRCylecV
Well done, continue!
>>> FykExtFZ9ybk1v5PwZROnJxmGcFOEfaE
EafEOFcGmxJnORZwP5v1kby9ZFtxEkyF
Well done, continue!
>>> XK2ICyz6C9Px3TRnZgR7p9mgP5B7JWWM
MWWJ7B5Pgm9p7RgZnRT3xP9C6zyCI2KX
Well done, continue!
>>> QhuJ0Jl4oYbOargYD6Qm46Ib5dpZtf8w
w8ftZpd5bI64mQ6DYgraObYo4lJ0JuhQ
Well done, continue!
>>> OQOor9qGg0esjlF3o9s2EaNzxd6hOhxl
lxhOh6dxzNaE2s9o3Fljse0gGq9roOQO
Well done, continue!
Congratulations!! Here is your flag:
FCSC{7b20416c4f019ea4486e1e5c13d2d1667eebac732268b46268a9b64035ab294d}

Le flag est donc : FCSC{7b20416c4f019ea4486e1e5c13d2d1667eebac732268b46268a9b64035ab294d}.