Csci 3351 write a python script called passmerger that will


Programming Problem

Write a Python script called passmerger that will merge the contents of two simplified user account tables in a database as described below. The script uses one command line argument that represents the name of the database file. This name should he validated.

The simple account database contains two tables of accounts. Each entry in these tables has three fields (all text strings) - the username, the encrypted password, and a home directory location like this:

eggert kljsdfjkl /home/eggert

All regular account home directories are in the /home directory based on the account name as given above. Special system account names begin with the word system and have a home directory value of None.

Create a third table in the database with similar fields that represents the merger of the data from the other two tables according to the following rules.

• a system account in the first table should have its entry included just as it is, no changes.
• a system account in the second table should not be included in the merged table.
• an account in either table that is not listed in the other table should have its entry included just as it is, no changes.
• an account that is listed in both tables should have two entries. For the first, the account name should be changed to append _1 to the name in the first field, the password should stay the same, and the home directory location should have a 1_ inserted before the name. For the second entry, the account name should be changed to append _2 to the name in the first field, the password should stay the same, and the home directory location should have a 2_ inserted before the name.

Below is an example showing how these rules apply.

Table 1 accounts:
fred ksdfjsl /home/fred
systeml abc None
wilma skai9e /home/wilma

Table 2 accounts:
barney mmaam /home/barney
wilma oiwehh /home/Wilma
system2 abc None

Merged table accounts:
fred ksdfjsl /home/fred
systeml abc None

wilma _l skai9e /home/1_wilma
wilma_2 oiwehh /home/2_wilma
barney mmaam /home/barney

The modified database should be saved back to the disk before the program ends.

Solution Preview :

Prepared by a verified Expert
Python Programming: Csci 3351 write a python script called passmerger that will
Reference No:- TGS01725381

Now Priced at $50 (50% Discount)

Recommended (99%)

Rated (4.3/5)