Guest User

Untitled

a guest
Oct 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import csv
  2. import subprocess
  3.  
  4. def importpass(filepath):
  5. with open(filepath) as csvfile:
  6. reader = csv.DictReader(csvfile, delimiter=',')
  7. for row in reader:
  8. try:
  9. username = row['username']
  10. password = row['password']
  11. name = row['name']
  12. url = row['url']
  13. p = subprocess.run(
  14. 'echo "{}\nlogin: {}\nurl: {}" | pass insert -m web/{}'.format(password,
  15. username,
  16. url,
  17. name),
  18. shell=True)
  19. print(p.returncode, row)
  20. except Exception as e:
  21. print(e, row)
Add Comment
Please, Sign In to add comment