Google-Apps
Hauptmenü

"Python code obfuscation"

6 Comments -

1 – 6 of 6
Blogger Mattias said...

Wonderful. :)

16 June 2010 at 14:51

Anonymous Anonymous said...

Really, that's vile... let's see what it does...

Line 1, we're using urllib to open a url, and in line 2, reading content from it.

In line 3, we appear to be replacing / characters in a path with the platform's path separator (thus redundant on Unix) and appending it to the current directory. Which on the 4th line, we split on the path separator, to give a list of directory names.

In marginally more readable form:

fp = urllib.urlopen(data[list])

urlContent = fp.read()

path = os.getcwd() + data[list+1].replace("/", os.sep)

pathElements = path.split(os.sep)



Just *why* it's doing all this, I've no idea.

16 June 2010 at 22:48

Blogger Bastien Nocera said...

Anonymous: thanks, but there's at least a 100 lines of obfuscated code like that in the tarball.

16 June 2010 at 23:06

Anonymous Anonymous said...

Why would anyone do that is beyond me :s

17 June 2010 at 02:01

Blogger Bastien Nocera said...

krkhan: probably because they don't want people to link directly to their video feeds without going through their website and tons of adverts...

17 June 2010 at 02:15

Anonymous Anonymous said...

That looks like it was done with pyobfuscate. Which is open source and not obfuscated itself, so you could probably figure out how it works and modify it to reverse the obfuscation faster than you could puzzle it out.

7 July 2011 at 17:43

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot