Added archive converter
This commit is contained in:
parent
e2d2e06489
commit
d5e1c7a7e0
1 changed files with 63 additions and 0 deletions
63
tools/archive.py
Normal file
63
tools/archive.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
"""
|
||||
ARHIVE for FlipypPass
|
||||
|
||||
This will prepare your passwords for Import with FlippyPass
|
||||
Excuse that this is written in Python...
|
||||
"""
|
||||
|
||||
# Libraries
|
||||
import sys
|
||||
import json
|
||||
|
||||
# Variables
|
||||
all_passwords = ""
|
||||
|
||||
# Functions
|
||||
def load_json():
|
||||
# Getting file path
|
||||
file_path = sys.argv[1]
|
||||
|
||||
# Opening file
|
||||
f_file = open(file_path)
|
||||
f_data = f_file.read()
|
||||
|
||||
# Parsing json
|
||||
return json.loads(f_data)
|
||||
def insert_passwords(json_data):
|
||||
# Global
|
||||
global all_passwords
|
||||
|
||||
# Going through items
|
||||
for item in json_data["items"]:
|
||||
# Is it not valid?
|
||||
if not "login" in item:
|
||||
continue
|
||||
|
||||
# Getting important data from each
|
||||
name = item["name"]
|
||||
username = item["login"]["username"]
|
||||
password = item["login"]["password"]
|
||||
|
||||
# Adding it into our password array
|
||||
all_passwords += name + "|" + username + "|" + password + "|0|"
|
||||
def save_data():
|
||||
# Global
|
||||
global all_passwords
|
||||
|
||||
# Opening file
|
||||
file_data = open('archive.txt', 'w')
|
||||
file_data.write("Data: " + all_passwords)
|
||||
file_data.close()
|
||||
|
||||
def main():
|
||||
# Loading json
|
||||
json_data = load_json()
|
||||
|
||||
# Going through all passwords
|
||||
insert_passwords(json_data)
|
||||
|
||||
# Saving the passwords
|
||||
save_data()
|
||||
|
||||
# Entry point
|
||||
main()
|
Loading…
Reference in a new issue