[MISC] QuickR

Can someone nudge on how to send the result please?

Thanks!

Type your comment> @philomath213 said:

Type your comment> @Drxxx said:

Do I suppose to see the page content as this

e[7m e[0me[7m e[0me[7m e[0me[7m e[0me[7m

or there something wrong with my browser ?

The connection type is raw TCP not HTTP.
You should use sockets in order to solve this challenge.

OK, I think I got it :slight_smile:

Got it! This was a good one.

It's important to realise that this is, in a real sense, an illusion: you simply need the true machine value.
[!] Decoded string: [+] Congratulations! Here is your flag: 

Someone could kindly help here? I’m pretty new on sockets coding and there are some little thing that i’m not undertanding… Could DM me please?

finally got this. it is really nice challenge and lot of fun :wink:

Edit: Nvm that

Thanks @limbernie for hint!
Try different functions when you send calculated result

The reason why somebody managed to solve it by using Py3 is because the ‘illusion’ has just a little bit changed since Py3.2+
It remain a funny code exercise…
There’re some different way to do that.

I enjoyed it, thank you

Currently I am banging my head against this one, I don’t seem to be able to get any data from the qr code, even though I think I am using the proper tool for it (using python3).
The QR code is correct, since I can decode it with my phone…
Any hints on this?

Setup a socket in python to receive the appropriate code (only the QR). Considering the QR is not in image format is there an effective way to make it an image to use with existing img to QR decoding tools? Are there any QR modules in python that can take current format from the server and decode it? Could definitely use a nudge…

Well that flexed a lot of my knowledge. Ended up taking screenshot from terminal using a terminal command. Really enjoyed this one…

Nice challenge; for those who are getting “wrong”, maybe you should be MORE precise in giving your answer XD

Type your comment> @keyf0 said:

Hi all!
I’m stuck with this challenge…
I’ve managed to get data from the instance, grab and decode the QR code, do the arithmetic “exactly” and send back the result but I’m always getting the “[-] Wrong!” answer.

I don’t get the “illusion” part… :confused:

Please, can someone help me?
Thank!

having the same problem could any one PM me with any hint?

Edit: Got it. Thanks @socialkas for hint

Got it, annoyingly I had to use python2 instead of python3. I was trying to use the qrtools module, but for some reason I don’t understand, python3 couldn’t find the qrtools.QR() class >:( (using linux mint tessa) but python2 had no problems.

Respect to anyone who can explain that to me!

Edit : I solved it

I am curious to know if anybody is successfully using : qr = qrtools.QR() ??
whether i import :
from qrtools import qrtools
or from qrtools import QR
or from qrtools.qrtools import qrtools (… or QR)
nothing is working

Type your comment> @meaculpa said:

I am curious to know if anybody is successfully using : qr = qrtools.QR() ??
whether i import :
from qrtools import qrtools
or from qrtools import QR
or from qrtools.qrtools import qrtools (… or QR)
nothing is working

after a couple hours of trying to get it to work I found this

that whole mess completely soured me on what was otherwise a easy fun challenge

1 Like

This was a pretty neat challenge that was mostly complicated by the fact you don’t receive an image type. It looks like some people did some kind of screenshot but I chose to do it differently.

I may have done it the “hard” way but I didn’t want to just output/screenshot. What I used were a few assumptions:
1: A QR code can be broken down into pixels, where each pixel is either on or off (red or white, in our case)
2: A QR code is a square, so you can figure out how many pixels you have by taking the square root of your length
3: You can turn a 1d list into a 2d one by using the modulo/division operators to determine x/y coordinates

Once you have your “pixel” 2d list, the image library everyone has mentioned has a paste() method, which allows you to overlay on image on another. If you have a list of pixels and their coordinates, you should be able to recreate your image.

I will reiterate peoples’ struggles with the libraries to parse the QR code. I used python + zbarlight but I had to do more than just simply pip install. I had to apt install the libraries as well: sudo apt install libzbar-dev. Once you do that, you should be able to pip install without error.

Hey, i ve script, I all succeeded (calculation etc) except that when I return the answer: error message. I go by curl you use well -X

I of course am a quick R :face_with_raised_eyebrow:

Guess after the CTF ended I felt the need to complete HTB challenges again, this one was certainly easy, just needed some coding

If anyone ends up needing help, just send me a message, R is always here :heart:

Hey Everyone quick question can you give me hint on this like what can cause the issue

python3 QRdecoder.py
[-] Opening connection to ://161.35.170.221 on port 32357: Failed
[ERROR] Could not resolve hostname: ‘://161.35.170.221’
Traceback (most recent call last):
File “/home/happyhunting/.local/lib/python3.11/site-packages/pwnlib/tubes/remote.py”, line 77, in init
self.sock = self._connect(fam, typ)
^^^^^^^^^^^^^^^^^^^^^^^
File “/home/happyhunting/.local/lib/python3.11/site-packages/pwnlib/tubes/remote.py”, line 103, in _connect
for res in socket.getaddrinfo(self.rhost, self.rport, fam, typ, 0, socket.AI_PASSIVE):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/socket.py”, line 962, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/happyhunting/Downloads/QRdecoder.py”, line 6, in
connection = pwn.remote(“http://161.35.170.221”, 32357)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/happyhunting/.local/lib/python3.11/site-packages/pwnlib/tubes/remote.py”, line 81, in init
self.error(‘Could not resolve hostname: %r’, host)
File “/home/happyhunting/.local/lib/python3.11/site-packages/pwnlib/log.py”, line 439, in error
raise PwnlibException(message % args)
pwnlib.exception.PwnlibException: Could not resolve hostname: ‘http://161.35.170.221

I have done a research and most of them are using docker.hackthebox,eu: as an hostname but when I try it with that domain it doesnt open the website for me

Any suggestions I am new to this

Thanks in advance