Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21302 > unrolled thread

Tools for refactoring/obfuscation

Started byJavier <nospam@nospam.com>
First post2012-03-07 03:29 +0000
Last post2012-03-27 15:12 +0200
Articles 6 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Tools for refactoring/obfuscation Javier <nospam@nospam.com> - 2012-03-07 03:29 +0000
    Re: Tools for refactoring/obfuscation Vladimir Ignatov <kmisoft@gmail.com> - 2012-03-26 21:51 -0400
      Re: Tools for refactoring/obfuscation Javier <nospam@nospam.com> - 2012-03-28 16:04 +0000
        Re: Tools for refactoring/obfuscation Lie Ryan <lie.1296@gmail.com> - 2012-03-31 16:18 +1100
          Re: Tools for refactoring/obfuscation Javier <nospam@nospam.com> - 2012-04-02 14:09 +0000
    Re: Tools for refactoring/obfuscation Stefan Behnel <stefan_ml@behnel.de> - 2012-03-27 15:12 +0200

#21302 — Tools for refactoring/obfuscation

FromJavier <nospam@nospam.com>
Date2012-03-07 03:29 +0000
SubjectTools for refactoring/obfuscation
Message-ID<jj6kmc$7vb$1@speranza.aioe.org>
I am looking for an automated tool for refactoring/obfuscation.
Something that changes names of functions, variables, or which would
merge all the functions of various modules in a single module.
The closest I have seen is http://bicyclerepair.sourceforge.net/

Does somebody know of something that can work from the command line or
simple data structures/text files?, like a python dictionary of functions
{"old":"new",...}

[toc] | [next] | [standalone]


#22221

FromVladimir Ignatov <kmisoft@gmail.com>
Date2012-03-26 21:51 -0400
Message-ID<mailman.1028.1332813076.3037.python-list@python.org>
In reply to#21302
Hi,

(sorry for replying to the old topic)

On Tue, Mar 6, 2012 at 10:29 PM, Javier <nospam@nospam.com> wrote:
> I am looking for an automated tool for refactoring/obfuscation.
> Something that changes names of functions, variables, or which would
> merge all the functions of various modules in a single module.
> The closest I have seen is http://bicyclerepair.sourceforge.net/
>
> Does somebody know of something that can work from the command line or
> simple data structures/text files?, like a python dictionary of functions
> {"old":"new",...}

I am not surprised what nobody answers. I think that such tool is
nearly impossible given the dynamic Python's nature.
But if you put little discipline/restrictions in your source code,
when doing obfuscation could be much more easier. Almost trivial I
would say.

Javier, you can contact me directly if you are interested in this topic.

Vladimir Ignatov
kmisoft at gmail com

[toc] | [prev] | [next] | [standalone]


#22282

FromJavier <nospam@nospam.com>
Date2012-03-28 16:04 +0000
Message-ID<jkvcpm$boh$1@speranza.aioe.org>
In reply to#22221
Yes, in general I follow clear guidelines for writing code.  I just use
modules with functions in the same directory and clear use of name
spaces. I almost never use classes.  I wonder if you use some tool for
refactoring.  I am mainly intersted in scripting tools, no eclipse-style
guis.

Just let me know if you use some scripting tool.

And, as somebody pointed in this thread obfuscating or refactoring the
code are very different things but they can be done with the same tools.

Javier


Vladimir Ignatov <kmisoft@gmail.com> wrote:
> Hi,
> 
> (sorry for replying to the old topic)
> 
> On Tue, Mar 6, 2012 at 10:29 PM, Javier <nospam@nospam.com> wrote:
>> I am looking for an automated tool for refactoring/obfuscation.
>> Something that changes names of functions, variables, or which would
>> merge all the functions of various modules in a single module.
>> The closest I have seen is http://bicyclerepair.sourceforge.net/
>>
>> Does somebody know of something that can work from the command line or
>> simple data structures/text files?, like a python dictionary of functions
>> {"old":"new",...}
> 
> I am not surprised what nobody answers. I think that such tool is
> nearly impossible given the dynamic Python's nature.
> But if you put little discipline/restrictions in your source code,
> when doing obfuscation could be much more easier. Almost trivial I
> would say.
> 
> Javier, you can contact me directly if you are interested in this topic.
> 
> Vladimir Ignatov
> kmisoft at gmail com

[toc] | [prev] | [next] | [standalone]


#22407

FromLie Ryan <lie.1296@gmail.com>
Date2012-03-31 16:18 +1100
Message-ID<mailman.1167.1333171140.3037.python-list@python.org>
In reply to#22282
On 03/29/2012 03:04 AM, Javier wrote:
> Yes, in general I follow clear guidelines for writing code.  I just use
> modules with functions in the same directory and clear use of name
> spaces. I almost never use classes.  I wonder if you use some tool for
> refactoring.  I am mainly intersted in scripting tools, no eclipse-style
> guis.
>
> Just let me know if you use some scripting tool.
>
> And, as somebody pointed in this thread obfuscating or refactoring the
> code are very different things but they can be done with the same tools.

<troll>if you're not using classes, your code is obfuscated already</troll>

Anyway, I think it's better if you describe why you want such a tool. If 
you want to keep your code a secret, just distribute the .pyc file. If 
you want to refactor your code to improve readability, there is rope.

[toc] | [prev] | [next] | [standalone]


#22466

FromJavier <nospam@nospam.com>
Date2012-04-02 14:09 +0000
Message-ID<jlcbts$im1$1@speranza.aioe.org>
In reply to#22407
Well, a .pyc file would be a too blatant obfuscation, and people at my
job would get angry.  I need something more subtle.  So I need a
refactoring tool, preferably with which I can do scripting.  These is
what I found up to now in the CheeseShop:

http://pypi.python.org/pypi/bicyclerepair/0.7.1
http://pypi.python.org/pypi/rope/0.9.3

I need to check how to do scripting with them.  There seems to be no
manual for them.

This code also looks interesting, but in its present state it is for
blatant obfuscation, although it could be changed to do some refactoring:

http://pypi.python.org/pypi/pyfuscate/0.1





Lie Ryan <lie.1296@gmail.com> wrote:
> On 03/29/2012 03:04 AM, Javier wrote:
>> Yes, in general I follow clear guidelines for writing code.  I just use
>> modules with functions in the same directory and clear use of name
>> spaces. I almost never use classes.  I wonder if you use some tool for
>> refactoring.  I am mainly intersted in scripting tools, no eclipse-style
>> guis.
>>
>> Just let me know if you use some scripting tool.
>>
>> And, as somebody pointed in this thread obfuscating or refactoring the
>> code are very different things but they can be done with the same tools.
> 
> <troll>if you're not using classes, your code is obfuscated already</troll>
> 
> Anyway, I think it's better if you describe why you want such a tool. If 
> you want to keep your code a secret, just distribute the .pyc file. If 
> you want to refactor your code to improve readability, there is rope.
> 

[toc] | [prev] | [next] | [standalone]


#22240

FromStefan Behnel <stefan_ml@behnel.de>
Date2012-03-27 15:12 +0200
Message-ID<mailman.1036.1332853945.3037.python-list@python.org>
In reply to#21302
Javier, 07.03.2012 04:29:
> I am looking for an automated tool for refactoring/obfuscation.

Sadly, there really is one thing that these two have in common: they modify
code while retaining its exact functionality. Apart from that, they are
diametric opposites. Refactoring aims at making the code "better" in some
way, e.g. by making it more readable or easier to extend. Obfuscation aims
for making it worse, as in unreadable and hard to access. It's generally
not a good idea to do that. Code is there for humans to read.

Stefan

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web