From c15beac78900bc9bca8337d829bffa61066c12a4 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 3 Jan 2019 00:08:26 -0500 Subject: [PATCH] importer fixes --- src/importers/onepassword1PifImporter.ts | 20 +++++++++++++++++++- src/importers/roboformCsvImporter.ts | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/importers/onepassword1PifImporter.ts b/src/importers/onepassword1PifImporter.ts index aad0d31d8f7..eb004fd78d6 100644 --- a/src/importers/onepassword1PifImporter.ts +++ b/src/importers/onepassword1PifImporter.ts @@ -55,7 +55,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer { cipher.type = CipherType.Card; cipher.card = new CardView(); } - + if (cipher.type === CipherType.Login && !this.isNullOrWhitespace(item.details.password)) { + cipher.login.password = item.details.password; + } if (!this.isNullOrWhitespace(item.details.notesPlain)) { cipher.notes = item.details.notesPlain.split(this.newLineRegex).join('\n') + '\n'; } @@ -91,6 +93,22 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer { if (!this.isNullOrWhitespace(item.secureContents.notesPlain)) { cipher.notes = item.secureContents.notesPlain.split(this.newLineRegex).join('\n') + '\n'; } + if (cipher.type === CipherType.Login) { + if (!this.isNullOrWhitespace(item.secureContents.password)) { + cipher.login.password = item.secureContents.password; + } + if (item.secureContents.URLs != null) { + const urls: string[] = []; + item.secureContents.URLs.forEach((u: any) => { + if (!this.isNullOrWhitespace(u.url)) { + urls.push(u.url); + } + }); + if (urls.length > 0) { + cipher.login.uris = this.makeUriArray(urls); + } + } + } if (item.secureContents.fields != null) { this.parseFields(item.secureContents.fields, cipher, 'designation', 'value', 'name'); } diff --git a/src/importers/roboformCsvImporter.ts b/src/importers/roboformCsvImporter.ts index 741cc69e4ec..056479db83b 100644 --- a/src/importers/roboformCsvImporter.ts +++ b/src/importers/roboformCsvImporter.ts @@ -25,11 +25,29 @@ export class RoboFormCsvImporter extends BaseImporter implements Importer { cipher.login.username = this.getValueOrDefault(value.Login); cipher.login.password = this.getValueOrDefault(value.Pwd); cipher.login.uris = this.makeUriArray(value.Url); + + if (!this.isNullOrWhitespace(value.Rf_fields)) { + let fields: string[] = [value.Rf_fields]; + if (value.__parsed_extra != null && value.__parsed_extra.length > 0) { + fields = fields.concat(value.__parsed_extra); + } + fields.forEach((field: string) => { + const parts = field.split(':'); + if (parts.length < 3) { + return; + } + const key = parts[0] === '-no-name-' ? null : parts[0]; + const val = parts.length === 4 && parts[2] === 'rck' ? parts[1] : parts[2]; + this.processKvp(cipher, key, val); + }); + } + this.cleanupCipher(cipher); if (i === results.length && cipher.name === '--' && this.isNullOrWhitespace(cipher.login.password)) { return; } + result.ciphers.push(cipher); i++; });