News for hackers. Stuff that matters.
Re:Show HN: Wat – Deep inspection of Python objects by Aeveus on Thursday July 25, 2024 @02:29PM (#41071788)
Looks like a great tool. Will start playing with it whenever I have to dive into an existing project again.

One thing I'd like to note, though, is that most engineers (at least around and including myself) would be triggered by the "Insta-load" example of executing base64 encoded (and thus obfuscated) code.

Re:Show HN: Wat – Deep inspection of Python objects by fuzztester on Thursday July 25, 2024 @03:05PM (#41072201)
just so that it is clear for everyone, including newbies here, does the insta-load code snippet work like this:

the author has encoded the wat module's source code into base64. the snippet shown decodes that back into python code, and then executes it on the fly, thus having the same effect as importing the wat module in the normal python way?

Re:Show HN: Wat – Deep inspection of Python objects by igrek51 on Thursday July 25, 2024 @05:56PM (#41073806)
Yes, that has the same effect as installing the package. So if you feel uncomfortable, you can either install the pip package (and of course review the installed code) or review the decoded string before executing it. It's not that obfuscated anyways, it's still quite readable.
Re:Show HN: Wat – Deep inspection of Python objects by fuzztester on Thursday July 25, 2024 @08:13PM (#41074778)
got it, thanks.
Re:Show HN: Wat – Deep inspection of Python objects by kajecounterhack on Thursday July 25, 2024 @02:38PM (#41071916)
I was just about to post that it freaked me out a little, but wasn't sure if I was going to be the only one.
Re:Show HN: Wat – Deep inspection of Python objects by tacoooooooo on Thursday July 25, 2024 @02:43PM (#41071966)
not hard to see it

with open('wat_source.py', 'w') as f: f.write(zlib.decompress(base64.b64decode(code.encode())).decode())

Re:Show HN: Wat – Deep inspection of Python objects by Spivak on Thursday July 25, 2024 @02:40PM (#41071934)
The insta-load is fine. You're supposed to save the snippet, decode and uncompress it, look at it to see what it does and that it's completely self-contained uncontroversial Python code and copy-paste your version that you bookmarked. It's super short.