473,399 Members | 3,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

root password in a .py script

I have to place a root password into a Python script. Is there a way to
encode it so that one can't read the password when viewing the file, but
when the sting is used it's decoded? For example:

pass = "#$%^&@*#&*$^@"
instead of:
pass = "root-password"

Thanks,

Bart
Jul 18 '05 #1
5 2195
On Fri, 12 Mar 2004 12:11:30 -0500, Bart Nessux <ba*********@hotmail.com> wrote:
I have to place a root password into a Python script. Is there a way to
encode it so that one can't read the password when viewing the file, but
when the sting is used it's decoded? For example:


The only remotely secure way is to do what Unix does in /etc/passwd (to name
a well-documented example). As far as I can see.

/Jorgen

--
// Jorgen Grahn <jgrahn@ ''If All Men Were Brothers,
\X/ algonet.se> Would You Let One Marry Your Sister?''
Jul 18 '05 #2
Bart Nessux wrote:
I have to place a root password into a Python script. Is there a way to
encode it so that one can't read the password when viewing the file, but
when the sting is used it's decoded?


No.
Jul 18 '05 #3
Bart Nessux wrote:
I have to place a root password into a Python script. Is there a way to
encode it so that one can't read the password when viewing the file, but
when the sting is used it's decoded? For example:

pass = "#$%^&@*#&*$^@"
instead of:
pass = "root-password"


Why do you need it decoded?

You could list the encrypted root
password and then if the input password
encrypts to the same thing then it means it was
a valid one.

i.
Jul 18 '05 #4
As others have pointed out, it's totally insecure, but I had to do
something similar so did...

import string

unshifted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ'
shifted = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJ KLM'
rot13_table = string.maketrans(unshifted, shifted)

user = string.translate ('sjkeiulkje', rot13_table)
passwd = string.translate ('eorpoipoe', rot13_table)
Jul 18 '05 #5
Wayne Folta wrote:
import string

unshifted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ'
shifted = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJ KLM'
rot13_table = string.maketrans(unshifted, shifted)

user = string.translate ('sjkeiulkje', rot13_table)
passwd = string.translate ('eorpoipoe', rot13_table)


This is actually totally equal to:

'eorpoipoe'.encode('rot13')

Gerrit.

--
Weather in Amsterdam Airport Schiphol, Netherlands 14/03 13:55 UTC:
12.0°C Few clouds mostly cloudy wind 10.3 m/s SSW (-2 m above NAP)
--
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/

Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Doug | last post by:
I have a website I am trying to develop using PHP and Dreamweaver. I also have a library of PHP code which includes the username and password to get in the database. I would like to put this...
12
by: Florian | last post by:
I've been stumbling over this, what I consider strange, behaviour. I installed mySQL on a Win2k machine and tried to change the root password, which didn't seem to work. I changed it this way: ...
1
by: Adam Smith | last post by:
I have a new DB provided by my ISP don't know details of installation, setup etc. I can log in as anybody except root. mysql -h localhost -u mysql Welcome to the MySQL monitor. Commands end...
0
by: John | last post by:
Hi, I'm using mysql-server-3.23.58-4 on a Linux (Fedora 1) machine, and I'm new to databases/MySQL. After reading the security section of the manual from http://dev.mysql.com, I added...
5
by: MLH | last post by:
I'm supposed to set a password for the MySQL root user. The output of mysql_install_db instructed me to run the following commands... /usr/bin/mysqladmin -u root -h appserver password mynwewpasswd...
4
by: Bob | last post by:
I'm just starting PHP and MySQL - and really like the book by Welling and Thomsom. I've installed MySQL on my WinXP desktop, along with Apache and PHP. I have not figured out how to set a...
7
by: rajbala.3399 | last post by:
Hi , I want to download sql in my linux system........... # rpm -ivh MySQL-server-5.0.24a-0.glibc23.i386.rpm MySQL-cl ient-5.0.24a-0.glibc23.i386.rpm Preparing... ...
1
by: mattsql22 | last post by:
I just installed Red Hat Enterprise 5, along with MySQL. I have run mysql_install_db and I can see the mysql folder that contains the 'mysql' database with the users. Unfortunately, I can't login...
2
by: ivytony | last post by:
First of all, I'm not sure if I've set up root password for MySQL server or not. I was following this tutorial http://www.howtoforge.com/centos-5.1-server-lamp-email-dns-ftp-ispconfig-p4 to install...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.