Decoding the obfuscated bash script on a Uniqlo t-shirt

(tris.sherliker.net)

143 points | by speerer 1 hour ago

13 comments

  • world2vec 34 minutes ago
    Oh wow I saw that tshirt at the store and said to my girlfriend "no way that script is functional, probably just for show". I should have persevered.
  • Tiberium 1 hour ago
    OCRing this is a nightmare and is a good benchmark to any self-proclaimed good OCR/vision model.

    I think though it could likely be easily OCR'd if you give the image to any decent agentic harness with a good vision model, e.g. newest Claude/GPT ones, and tell them to split the image per lines, and then just OCR each line individually.

    I wonder if the script itself was written by an LLM before obfuscation? There seem to be a lot of comments in it, but in this case it's still ok :)

    • lemagedurage 10 minutes ago
      I don't think it was written by an LLM, some things stand out:

      The congratulations text is both in English and Japanese. Contains a single heart emoji.

      There was an intention to have a cyan to orange gradient, but the range starts in an ANSI block, ends halfway through the 256 color block and 256 terminal colors are not arranged like a gradient at all.

      There's no sleep at the end of the loop where I feel like an LLM would add that defensively.

      • n2j3 0 minutes ago
        Human here. I added a sleep 0.5 at the end, it's too fast to read otherwise. Makes for a nice terminal screensaver!
    • IshKebab 45 minutes ago
      Definitely LLM. No humans write that many comments.
      • ChrisMarshallNY 8 minutes ago
        Ahem...

        My code usually clocs at 50/50 (or thereabouts)[0]. Has, since my very first real engineering project (in 1987)[1]. I discuss in detail, here[2].

        But one reason that I like LLMs, is that they help me to write even more documentation. I have found that I can instruct an LLM to revise my documentation, and make it even more effective.

        [0] https://github.com/ChrisMarshallNY (My GH profile. Pretty much everything there, is like that -has, since long before LLMs were a broken rubber on the drug store shelf).

        [1] https://littlegreenviper.com/wp-content/uploads/2022/07/TF30... (Downloads a PDF)

        [2] https://littlegreenviper.com/leaving-a-legacy/

      • petu 22 minutes ago
        Human could write that many comments to get enough base64 text for a design. Maybe to even get some of the highlighted characters in places they want (roughly equally spaced apart).
      • latexr 7 minutes ago
        > No humans write that many comments.

        Especially in a case like this, I would definitely write a lot of comments to aid in understanding, thus increasing trust so people would try it out and tinker with it.

      • Tiberium 42 minutes ago
        Honestly it's a bit of a shame. I checked and they could've shortened their base64 payload by 304 chars by removing all comments except the top two congratulatory ones, or by 524 if they removed those too.
        • lemagedurage 1 minute ago
          Maybe they added the comments to get a longer payload for the sake of the shirt's design.

          The comments can be more cute/awe inspiring for people who aren't as familiar with bash but like solving puzzles as well.

        • OtherShrezzing 6 minutes ago
          Would they still get the highlighted "PEACE FOR ALL" text throughout the shortened string? It looks like the length, and presence of those characters, was an explicit design choice.
        • saidnooneever 38 minutes ago
          im just sad it didnt render a qr code leading to malware :'). the different ways ppl look at obfuscated codes and scripts hah
  • DrewADesign 35 minutes ago
    > I guess Uniqlo is run through Windows though: one thing that struck me was the font, which I’m almost certain is Consolas,

    Surely this would use whatever font the virtual terminal profile was set to? I don’t know of any method to choose a virtual terminal font from bash and don’t see any code that addresses it?

    • nisiddharth 33 minutes ago
      They're referring to the font on the T-shirt.
      • tym0 15 minutes ago
        Thank you for spelling it out for me because I thought I was looking at a completely hallucinated AI article...
  • haileys 42 minutes ago
    I thought it was funny that the author used a variety of OCR tools with mixed success before spending a lot of time manually fixing up the output from the best one, rather than just typing it in
    • rtldg 21 minutes ago
      Took me almost 2 minutes for 4 lines (and I missed a character in one of them!). I would opt for OCR too, obviously so I'm prepared for the next bash t-shirt I'd come across...
      • OtherShrezzing 2 minutes ago
        I think this is a case where two people can successfully complete the task manually faster than one attempting to automate it. Get a ruler, read five centimetres of characters to your colleague, have them repeat that five centimetres back to you, correct as you go. Trial-and-error adjust the five-cm distance depending on your success rate as you go along. Format your string with the same line-breaks as the t-shirt, and remove them at the end, so you can be sure you've got the correct length on each row.

        All in, you should have a non-corrupted string in 10-15 min.

    • christoph 14 minutes ago
      That was also my thought… but I grew up mashing rubber keys for hours copying “games” out of magazines and books! Then hours after fixing all the typos!
    • duskdozer 12 minutes ago
      I'm guilty of this, but for me this kind of thing is optimizing over annoyance rather than time.
    • mayas_ 36 minutes ago
      "just typing it" would be more error prone for the average human
  • doppp 20 minutes ago
    Thanks for the post! Love Easter Eggs like these!
  • l337h4x0rz 14 minutes ago
    there's no newline between the shebang and the actual code
  • icevl 18 minutes ago
    Base64 without error correction turns the t-shirt itself into a lossy transport layer, so the OCR/transcription step becomes the actual challenge.
  • dylanzhangdev 52 minutes ago
    Cool! I bought one a few months ago as soon as I spotted it at a Uniqlo store, and later ordered a larger size online—I really love wearing them. But it never occurred to me to look into the story behind them.
  • high_byte 1 hour ago
    what if it contained a zero day for tesseract and the script you thought you got is just a throwaway
  • tancop 22 minutes ago
    [dead]
  • bryanrasmussen 1 hour ago
    Why does the shirt have an obfuscated bash script on the back?
  • lloydatkinson 18 minutes ago
    P ./cool.sh: line 31: bc: command not found ./cool.sh: line 34: bc: command not found ./cool.sh: line 37: bc: command not found E ./cool.sh: line 31: bc: command not found ./cool.sh: line 34: bc: command not found ./cool.sh: line 37: bc: command not found

    Very wow. Shame they assumed everyone has "bc"...

    • em500 6 minutes ago
      Why would that be a shame? "bc" is a mandatory POSIX command, while /bin/bash isn't (/bin/sh is the standard).
    • comradesmith 2 minutes ago
      You are fun.
    • greazy 15 minutes ago
      Which distro are you running? Perchance did you run the shell script in alpine Linux (docker)?
      • piacos_ 1 minute ago
        it doesn't seem to be installed on my endeavouros laptop