#!/usr/bin/python ################################################################################################# # # # GPL statement: # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # # Copyright 2007 Bengt J. Olsson # # # # Filename: my2key.py # # Rev: 1.0 # # Date: 2007-08-13 # # Changes: # # # ################################################################################################# import os import os.path import sys import glob import re fil = raw_input('Exported .txt file from MyPasswordSafe: ') infile = open(fil,'r') outfile = open('pass.csv','w') count = 0 outline ='' for line in infile: count += 1 if count == 1: pass else: if not count % 2: recs = line.split('\t') # print recs outline = '"'+recs[0]+'"'+','+'"'+recs[1]+'"'+','+'"'+recs[2]+'"'+','+'"'+recs[3]+'"'+',' else: line = line.rstrip() if line =='': outline +='"'+'"' else: outline += '"'+line+'"' outfile.write(outline+'\n') print 'CSV data written to "pass.csv"' infile.close() outfile.close()