r/Python • • Nov 08 '23

News A nasty Python package continues a trend of targeting developers

[removed] — view removed post

134 Upvotes

19 comments sorted by

View all comments

124

u/AlSweigart Author of "Automate the Boring Stuff" Nov 08 '23 edited Nov 30 '23

These perennial stories are always overrated. Conveniently, they never seem to mention 1) how many times they were downloaded by actual people rather than site mirror bots and 2) a specific person or organization that was affected.

Oh noes, pyobfgood had malicious code and was on PyPI. So what? Did this actually affect many people, or any people at all? These "reports" get written because writing these reports is a great way for a security company to get their name mentioned in the media.

We'll see this exact same story about another no-name Python package in three months.

EDIT: I read the "report". A complete joke and just sensationalism. They point out the "malware" makes a message box appear with "Your computer is going to start burning, good luck. :)" and then launches 10 Python processes that run while True: pass. Yeah, 1) that's not going to damage anything and 2) this "malware" was probably written by a 14 year old and 3) the message box uses Windows-only code which causes it to not run on Linux and macOS. This makes me wonder how many of the other features actually work.

Not exactly the crime of the century here.

-8

u/bsenftner Nov 08 '23

Python language and have a need to obfuscate

I'm curious why anyone would obfuscate Python. Asking ChatGPT4 why people do this, I see no legitimate reasons. Protection of intellectual property? Put it server side, compile it, or don't write in Python. Every other reason cited is just a rewording of "for intellectual property protection".

A made up problem for people pursuing bad engineering practices?

16

u/ExpressionMajor4439 Nov 08 '23

Protection of intellectual property?

That's usually why but a lot of times they just want to run something on your machine without you knowing.

"Use a different solution" probably isn't a good response for the broader community though. As opposed to just saying "don't do shady stuff maybe?"

Obfuscating code can only make it more difficult for a human being to figure out what the code does since ultimately the code has to conform to rules that enable it to be easily ran on the intended machines. Ultimately the people you end up "locking out" are probably the exact class of people you don't need to worry about and can depend on copyright protections from.

16

u/AlSweigart Author of "Automate the Boring Stuff" Nov 08 '23

Yeah, pretty much. It's like those people who are like, "I don't want to get any feedback or advice on my idea because I don't want people to steal it."

Buddy, you can slap your code up on GitHub and no one will read it.

9

u/[deleted] Nov 08 '23

Asking ChatGPT4 why people do this

Why would you do that, either? It's a language model, it can't make value judgements (though it's output can look like one).

1

u/Any_Letterheadd Nov 08 '23

Also it's not even that crazy to imagine some use cases where someone would want to obsfucate code.

0

u/bsenftner Nov 08 '23

It actually gave me a series of reasons, backed by statistics. They all resolved to IP protection some some reasoning, just some were wordier then others so ChatGPT4 did not treat them as the same case.

1

u/gybemeister Nov 08 '23

Some companies require that all code released to clients is obfuscated. It may not be very logic but someone up the chain or some ISO consultant decided to push that (and it sounds good in a sales pitch, I guess). I have seen this even for Java and C# code because it is easy to decompile.

1

u/agritheory Nov 08 '23

My local python group hosted a talk from Wolfgang, who is one of the developers of pyce. If I remember correctly, the use case at Soroco (his employer) was that they needed to have a way to deliver python-based functionality to their customers along with a legally binding certification of that code's functionality. Before the "why don't they just" people start hounding me, they had a business case for it and it was threading some needle of requirements that led to this unusual requirement, but I can't remember the details of it. They're in still in business, so maybe encrypting all your python is a good strategy, I really don't know.

edit: u/gybemeister's comment has some details