Remove some debug code
This commit is contained in:
parent
a5cf7d058f
commit
6e0a97c683
15
convert.py
15
convert.py
@ -4,14 +4,10 @@ import os
|
|||||||
import datetime
|
import datetime
|
||||||
import shutil
|
import shutil
|
||||||
import json
|
import json
|
||||||
import pprint
|
|
||||||
|
|
||||||
from pykeepass import PyKeePass
|
from pykeepass import PyKeePass
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
#until = 281
|
|
||||||
until = 20000
|
|
||||||
|
|
||||||
shutil.copyfile("in.kdbx", "out.kdbx")
|
shutil.copyfile("in.kdbx", "out.kdbx")
|
||||||
|
|
||||||
kp = PyKeePass("out.kdbx", password="test")
|
kp = PyKeePass("out.kdbx", password="test")
|
||||||
@ -37,7 +33,6 @@ def getGroup(item):
|
|||||||
|
|
||||||
label = groupLabels.get(item["typeName"])
|
label = groupLabels.get(item["typeName"])
|
||||||
if not label:
|
if not label:
|
||||||
pprint.pprint(item)
|
|
||||||
raise Exception("Unknown type name {}".format(item["typeName"]))
|
raise Exception("Unknown type name {}".format(item["typeName"]))
|
||||||
|
|
||||||
group = kp.add_group(kp.root_group, label)
|
group = kp.add_group(kp.root_group, label)
|
||||||
@ -58,7 +53,6 @@ def getField(item, designation):
|
|||||||
with open("in.1pif/data.1pif", "r") as fp:
|
with open("in.1pif/data.1pif", "r") as fp:
|
||||||
data = fp.read().strip().split("***5642bee8-a5ff-11dc-8314-0800200c9a66***")
|
data = fp.read().strip().split("***5642bee8-a5ff-11dc-8314-0800200c9a66***")
|
||||||
|
|
||||||
done = 0
|
|
||||||
for line in data:
|
for line in data:
|
||||||
if line.strip() == "":
|
if line.strip() == "":
|
||||||
continue
|
continue
|
||||||
@ -68,9 +62,6 @@ for line in data:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
group = getGroup(item)
|
group = getGroup(item)
|
||||||
if done == until - 1:
|
|
||||||
pprint.pprint(item)
|
|
||||||
pprint.pprint(group)
|
|
||||||
|
|
||||||
entry = kp.add_entry(group, item["title"], "", "")
|
entry = kp.add_entry(group, item["title"], "", "")
|
||||||
secure = item["secureContents"]
|
secure = item["secureContents"]
|
||||||
@ -189,10 +180,4 @@ for line in data:
|
|||||||
entry.ctime = datetime.datetime.fromtimestamp(item["createdAt"])
|
entry.ctime = datetime.datetime.fromtimestamp(item["createdAt"])
|
||||||
entry.mtime = datetime.datetime.fromtimestamp(item["updatedAt"])
|
entry.mtime = datetime.datetime.fromtimestamp(item["updatedAt"])
|
||||||
|
|
||||||
done = done + 1
|
|
||||||
if done >= until:
|
|
||||||
print("Halting at {}".format(done))
|
|
||||||
print("-------------------------------------------------------------------------")
|
|
||||||
break
|
|
||||||
|
|
||||||
kp.save()
|
kp.save()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user