hide sourcecode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Buch

    hide sourcecode

    Hi, is it possible to protect the python sourcecode?
    I have a nice little script and i dont want to show everbody the source.

    Im using python on a windows pc.

    Thank you - Mark


  • Larry Bates

    #2
    Re: hide sourcecode

    You could move the .PY file somewhere where
    it cannot be seen and leave the .pyc for execution
    or you can "freeze" it with py2exe.

    -Larry

    "Mark Buch" <mark.buch@ewet el.net> wrote in message
    news:bvtm5f$pgq $00$1@news.t-online.com...[color=blue]
    > Hi, is it possible to protect the python sourcecode?
    > I have a nice little script and i dont want to show everbody the source.
    >
    > Im using python on a windows pc.
    >
    > Thank you - Mark
    >
    >[/color]


    Comment

    • Josiah Carlson

      #3
      Re: hide sourcecode

      > Hi, is it possible to protect the python sourcecode?[color=blue]
      > I have a nice little script and i dont want to show everbody the source.
      >
      > Im using python on a windows pc.[/color]

      Compile the .py file into bytecode (.pyc). That .pyc file will only be
      usable on platforms with the same x.y version of Python as you.

      Remember that .pyc files suffer from the same decompilation
      vulnerabilities as any other programming language (which is why there
      exists software cracks). If someone wants to know what you are doing,
      they will.

      - Josiah

      P.S. What kind of script do you have that you want to hide from prying eyes?

      Comment

      • Gerrit

        #4
        Re: hide sourcecode

        Josiah Carlson wrote:[color=blue][color=green]
        > >Hi, is it possible to protect the python sourcecode?
        > >I have a nice little script and i dont want to show everbody the source.
        > >
        > >Im using python on a windows pc.[/color]
        >
        > Compile the .py file into bytecode (.pyc). That .pyc file will only be
        > usable on platforms with the same x.y version of Python as you.
        >
        > Remember that .pyc files suffer from the same decompilation
        > vulnerabilities as any other programming language (which is why there
        > exists software cracks). If someone wants to know what you are doing,
        > they will.[/color]

        I don't know about Windows, but on Unix you can create a script with
        permissions 700 and create a small setuid program executing this script.

        Don't know whether Windows has such useful things though, probably not :-P

        Gerrit.

        --
        PrePEP: Builtin path type

        Asperger's Syndrome - a personal approach:


        Comment

        • Josiah Carlson

          #5
          Re: hide sourcecode

          > I don't know about Windows, but on Unix you can create a script with[color=blue]
          > permissions 700 and create a small setuid program executing this script.
          >
          > Don't know whether Windows has such useful things though, probably not :-P[/color]

          I've never used setuid, but I would imagine that it works as the name
          suggests, it sets the user id of the process. Which would allow you to
          run the script with Python, but not read the source.

          There is likely a nontrivial set of methods and system calls where a
          script could use the 'run as' service in windows to do a similar thing,
          but I wouldn't want to write it.

          - Josiah

          Comment

          • Anand Pillai

            #6
            Re: hide sourcecode

            In a lighter vein, why do you want to hide your
            python source code? Python is an 'open source' language
            so I advise you to share your source code with us :-)

            -Anand

            Josiah Carlson <jcarlson@nospa m.uci.edu> wrote in message news:<bvu6m3$cg 1$1@news.servic e.uci.edu>...[color=blue][color=green]
            > > I don't know about Windows, but on Unix you can create a script with
            > > permissions 700 and create a small setuid program executing this script.
            > >
            > > Don't know whether Windows has such useful things though, probably not :-P[/color]
            >
            > I've never used setuid, but I would imagine that it works as the name
            > suggests, it sets the user id of the process. Which would allow you to
            > run the script with Python, but not read the source.
            >
            > There is likely a nontrivial set of methods and system calls where a
            > script could use the 'run as' service in windows to do a similar thing,
            > but I wouldn't want to write it.
            >
            > - Josiah[/color]

            Comment

            • Josiah Carlson

              #7
              Re: hide sourcecode

              Anand Pillai wrote:
              [color=blue]
              > In a lighter vein, why do you want to hide your
              > python source code? Python is an 'open source' language
              > so I advise you to share your source code with us :-)[/color]

              I'm all about sharing the code, the starter of the thread wanted to hide
              it, I was just answering his question.

              - Josiah

              Comment

              • Terry Reedy

                #8
                Re: hide sourcecode


                "Simon Wittber" <drconrad@metap lay.com.au> wrote in message
                news:005a01c3ec 89$b10eaeb0$000 0fea9@simonxp.. .[color=blue]
                > Anand wrote:[color=green]
                > >Python is an 'open source' language so I advise you to share your[/color]
                > source code with us :-)[/color]

                This was preceded by "In a lighter vein, why do you want to hide your
                python source code?".
                [color=blue]
                > Python is open-source, true. However that does not mean programs written
                > in Python must be open-sourced. Maybe I am having a bad day,[/color]

                I think so.
                [color=blue]
                > but I read your comment as a mob/peer pressure tactic,[/color]

                Come now. One person's opinion, written 'in a lighter vein' and concluded
                with ':-)' is hardly mob pressure, and not even much peer pressure.

                In any case, there are a couple of relevant and related points contained in
                'Python is open-source'.

                On the one hand, Guido intentionally did not GPL Python or put any but the
                most obvious and sensible restrictions on its use. In particular, one can
                do the following that GPL prohibits: modify the compile and eval functions
                to use a different set of op codes and distribute apps using the modified
                interpreter without making the source of the modified interpreter
                available. (This is not absolute security, but it does make disassembly of
                application runtime code harder.)

                On the other hand, Guido and the developers, as Python developers,
                generally prefer that Python code be potentially and actually shared. So
                they are under no obligation and are disinclined to do anything to make
                non-sharing easier, not withstanding whatever they may have to do privately
                to feed themselves and their families.

                Terry J. Reedy




                Comment

                • A. Lloyd Flanagan

                  #9
                  Re: hide sourcecode

                  "Mark Buch" <mark.buch@ewet el.net> wrote in message news:<bvtm5f$pg q$00$1@news.t-online.com>...[color=blue]
                  > Hi, is it possible to protect the python sourcecode?
                  > I have a nice little script and i dont want to show everbody the source.
                  >
                  > Im using python on a windows pc.
                  >
                  > Thank you - Mark[/color]

                  This comes up every once in a while. If you want to hide your source,
                  python is probably a bad choice of language -- it's designed to be
                  easy to understand, and you can probably decompile the byte-code
                  pretty easily.

                  Have you considered Perl? The advantage of Perl is, you could share
                  the source code with anybody you wanted, and be perfectly safe. You
                  can easily write Perl code that makes no sense at all to anyone but
                  you :)

                  Comment

                  • Ira Baxter

                    #10
                    Re: hide sourcecode

                    > Josiah Carlson <jcarlson@nospa m.uci.edu> wrote in message
                    news:<bvu6m3$cg 1$1@news.servic e.uci.edu>...[color=blue][color=green][color=darkred]
                    > > > I don't know about Windows, but on Unix you can create a script with
                    > > > permissions 700 and create a small setuid program executing this[/color][/color][/color]
                    script.

                    One way is to hide the source as obfuscated "cleartext" .
                    We build obfuscators for many languages, and could easily
                    build one for Python.
                    See http://www.semanticdesigns.com/Produ...ors/index.html.

                    (Hello from another Irviner!)


                    --
                    Ira D. Baxter, Ph.D., CTO 512-250-1018
                    Semantic Designs, Inc. www.semdesigns.com




                    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
                    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---

                    Comment

                    • Bernhard Herzog

                      #11
                      Re: hide sourcecode

                      "Ira Baxter" <idbaxter@semde signs.com> writes:
                      [color=blue]
                      > One way is to hide the source as obfuscated "cleartext" .[/color]

                      As usual Python comes with batteries included:

                      # -*- coding=rot13 -*-

                      cevag "uryyb ebg13 jbeyq"



                      :-)

                      Bernhard

                      --
                      Intevation GmbH http://intevation.de/
                      Skencil http://sketch.sourceforge.net/
                      Thuban http://thuban.intevation.org/

                      Comment

                      • Mike C. Fletcher

                        #12
                        Re: hide sourcecode

                        Bernhard Herzog wrote:
                        ....
                        [color=blue]
                        >As usual Python comes with batteries included:
                        >
                        ># -*- coding=rot13 -*-
                        >
                        >cevag "uryyb ebg13 jbeyq"
                        >
                        >[/color]
                        cevag h"uryyb ebg13 jbeyq"

                        Don't you mean?

                        Nice trick, btw, especially what happens if you include a syntax error
                        (translated to un-encoded :) ).

                        Have fun,
                        Mike

                        _______________ _______________ _________
                        Mike C. Fletcher
                        Designer, VR Plumber, Coder




                        Comment

                        • Bernhard Herzog

                          #13
                          Re: hide sourcecode

                          "Mike C. Fletcher" <mcfletch@roger s.com> writes:
                          [color=blue]
                          > Bernhard Herzog wrote:
                          > ...
                          >[color=green]
                          >>As usual Python comes with batteries included:
                          >>
                          >># -*- coding=rot13 -*-
                          >>
                          >>cevag "uryyb ebg13 jbeyq"
                          >>[/color]
                          > cevag h"uryyb ebg13 jbeyq"
                          >
                          > Don't you mean?[/color]

                          Yes. I had played around with that a few months ago and should have
                          checked the code again before posting.

                          Bernhard

                          --
                          Intevation GmbH http://intevation.de/
                          Skencil http://sketch.sourceforge.net/
                          Thuban http://thuban.intevation.org/

                          Comment

                          Working...