Author Topic: Patch for Python port  (Read 28074 times)

Offline richbeales

  • Newbie
  • *
  • Posts: 4
Patch for Python port
« on: November 12, 2008, 07:29:49 AM »
Hi All,

This is my first post on the forums, I really like the project and the firefox extension is excellent, however I'm more interested in getting a Python port up to date and more functional for everyday usage.

To that end I'm submitting this patch in the hope that it's useful to others and can be committed to the project.   This is the product of a couple of hours yesterday, and although i'm a developer I'm still learning Python so please forgive any non-pythonisms!  Hopefully if I have time it'll be the first patch of many.

The main changes are:
1) file split into two modules - passwordmaker.py and pwmlib.py
2) settings class added with initial support for saving/retrieving
settings to a file (pwm.settings) (in gui mode only)
3) a few minor typos fixed

This has been tested with Python 2.4/Windows, Python 2.6/Windows and Python 2.6/Linux.

Files located at: http://www.richbeales.net/passwordmaker-patch20081112.zip

Regards,

Rich.

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3348
    • http://passwordmaker.org/
Re: Patch for Python port
« Reply #1 on: November 12, 2008, 06:27:21 PM »
Rich,

Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?

Eric

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1141
  • Programmer
    • http://www.miquelfire.com/
Re: Patch for Python port
« Reply #2 on: November 12, 2008, 09:48:43 PM »
Actually, a diff is not really needed. I took a quick peak at it already, just waiting until I have time to check on one thing, if we need to include the setting file or not.
"I'm not drunk, just sleep deprived."

Offline richbeales

  • Newbie
  • *
  • Posts: 4
Re: Patch for Python port
« Reply #3 on: November 13, 2008, 01:25:15 AM »
Hi,

The settings file will be generated automatically if it is not found.

Regards,

Rich.

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3348
    • http://passwordmaker.org/
Re: Patch for Python port
« Reply #4 on: November 13, 2008, 03:17:16 AM »
miquel, feel free to commit this before me if you agree the changes are OK. I still haven't gotten a diff to see more precisely what's changed. My SVN client is hosed, gotta find 15 spare minutes to figure out why and/or reinstall.

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1141
  • Programmer
    • http://www.miquelfire.com/
Re: Patch for Python port
« Reply #5 on: November 13, 2008, 04:25:44 AM »
The diff would basically show most of the code leaving passwordmaker.py and being put into pwmlib.py, which happens to cause it to have the same config setup as the PHP version now. Then there's the saving of the changes as well.

It's committed now.
"I'm not drunk, just sleep deprived."

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3348
    • http://passwordmaker.org/
Re: Patch for Python port
« Reply #6 on: November 13, 2008, 04:05:08 PM »
Thanks, Miquel. Rich, we look forward to more contributions.

Eric

Offline tanstaafl

  • Administrator
  • *****
  • Posts: 1361
Re: Patch for Python port
« Reply #7 on: November 14, 2008, 06:03:51 PM »
Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?
Looks good to me... but since I'm not a programmer, any code looks 'good' to me... ;)

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3348
    • http://passwordmaker.org/
Re: Patch for Python port
« Reply #8 on: November 15, 2008, 03:14:42 AM »
Thanks very much for the patch. I had a look through it briefly, and it looks good. I'll need to generate a diff/patch file so it can be submitted to Subversion, though. Miquel, have you had a look at it? Tanstaafl?
Looks good to me... but since I'm not a programmer, any code looks 'good' to me... ;)

How's this look then?

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1141
  • Programmer
    • http://www.miquelfire.com/
Re: Patch for Python port
« Reply #9 on: November 15, 2008, 05:24:56 AM »
"I'm not drunk, just sleep deprived."

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3348
    • http://passwordmaker.org/
Re: Patch for Python port
« Reply #10 on: November 15, 2008, 04:13:03 PM »
Do we need to issue a new python release now?

Offline tanstaafl

  • Administrator
  • *****
  • Posts: 1361
Re: Patch for Python port
« Reply #11 on: November 15, 2008, 05:40:19 PM »
How's this look then?

Ha! 'tis a thing of beauty...

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1141
  • Programmer
    • http://www.miquelfire.com/
Re: Patch for Python port
« Reply #12 on: November 16, 2008, 01:02:00 AM »
Do we need to issue a new python release now?
Never had an official release to begin with actually.
"I'm not drunk, just sleep deprived."

Offline richbeales

  • Newbie
  • *
  • Posts: 4
Re: Patch for Python port
« Reply #13 on: May 21, 2012, 07:38:17 PM »
Sorry to drag this one up, but I had an email appear in my inbox asking for improvements to the UI of the python port, so being a glutton for punishment, I agreed, and have opened a git repository with my new changes at https://github.com/richbeales/passwordmaker-python

However in doing so, the user has discovered an issue in the underlying implementation, which was (I believe) ported straight from the PHP version, and other than refactoring I haven't touched this code.  I would be grateful if anyone could answer why the python version starts getting passwords "wrong" when the length requested is > 19 characters?

Offline Miquel 'Fire' Burns

  • Administrator
  • *****
  • Posts: 1141
  • Programmer
    • http://www.miquelfire.com/
Re: Patch for Python port
« Reply #14 on: May 21, 2012, 08:28:56 PM »
The length before the password is wrong depends on the algorithm and character set actually.

But if that is the case, then the code to make passwords long enough need to be double checked against one of the JS based versions at least.
"I'm not drunk, just sleep deprived."

PasswordMaker Forums

Re: Patch for Python port
« Reply #14 on: May 21, 2012, 08:28:56 PM »