maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   How to avoid saving password in scripts? (https://talk.maemo.org/showthread.php?t=88656)

814d3 2013-01-13 21:59

How to avoid saving password in scripts?
 
Hi there,

i use a Python script to login to my providers Hotspots. (without a visit of the providers webpage and enter data manually) But the script needs username and pw, sure. So, I think it's unsafe to safe both in the script. (everbody who get the phone can read them). I could implement a call to enter the pw, but I use the Command Execution Widget to exucute the script and have no idea to create soemthing like a popup window to enter the pw.
Did anybody deal with this safety problem in scripts?

Greetings

marxian 2013-01-13 23:17

Re: How to avoid saving password in scripts?
 
One possible way is to use a QInputDialog via the PyQt bindings, but this requires an instance of QApplication (and thus an event loop). There is probably also a GTK equivalent. Another way is to use zenity http://library.gnome.org/users/zenity/stable/. It seems that the PyZenity module is not available for Maemo5, but you can use zenity via the os.system() method, e.g

Code:

import os

credentials = os.system('zenity --password --username').split('|')

if len(credentials) >= 2:
    username = credentials[0].strip()
    password = credentials[1].strip() // remove leading/trailing whitespace
else:
    print "Problem with username/password"



All times are GMT. The time now is 01:48.

vBulletin® Version 3.8.8