|
|
@ -106,6 +106,8 @@ class CatCommand extends KdbxFileCommand { |
|
|
|
CatCommand() { |
|
|
|
CatCommand() { |
|
|
|
argParser.addFlag('decrypt', |
|
|
|
argParser.addFlag('decrypt', |
|
|
|
help: 'Force decryption of all protected strings.'); |
|
|
|
help: 'Force decryption of all protected strings.'); |
|
|
|
|
|
|
|
argParser.addFlag('all-fields', |
|
|
|
|
|
|
|
help: 'Force decryption of all protected strings.'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -116,6 +118,8 @@ class CatCommand extends KdbxFileCommand { |
|
|
|
|
|
|
|
|
|
|
|
bool get forceDecrypt => argResults['decrypt'] as bool; |
|
|
|
bool get forceDecrypt => argResults['decrypt'] as bool; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool get allFields => argResults['all-fields'] as bool; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Future<void> runWithFile(KdbxFile file) async { |
|
|
|
Future<void> runWithFile(KdbxFile file) async { |
|
|
|
catGroup(file.body.rootGroup); |
|
|
|
catGroup(file.body.rootGroup); |
|
|
@ -127,10 +131,19 @@ class CatCommand extends KdbxFileCommand { |
|
|
|
for (final group in group.groups) { |
|
|
|
for (final group in group.groups) { |
|
|
|
catGroup(group, depth: depth + 1); |
|
|
|
catGroup(group, depth: depth + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
final valueToSting = (StringValue value) => |
|
|
|
|
|
|
|
forceDecrypt ? value?.getText() : value?.toString(); |
|
|
|
|
|
|
|
|
|
|
|
for (final entry in group.entries) { |
|
|
|
for (final entry in group.entries) { |
|
|
|
final value = entry.getString(KdbxKey('Password')); |
|
|
|
final value = entry.getString(KdbxKey('Password')); |
|
|
|
print( |
|
|
|
print('$indent `- ${entry.getString(KdbxKey('Title'))?.getText()}: ' |
|
|
|
'$indent `- ${entry.getString(KdbxKey('Title'))?.getText()}: ${forceDecrypt ? value?.getText() : value?.toString()}'); |
|
|
|
'${valueToSting(value)}'); |
|
|
|
|
|
|
|
if (allFields) { |
|
|
|
|
|
|
|
print(entry.stringEntries |
|
|
|
|
|
|
|
.map((field) => |
|
|
|
|
|
|
|
'$indent ${field.key} = ${valueToSting(field.value)}') |
|
|
|
|
|
|
|
.join('\n')); |
|
|
|
|
|
|
|
} |
|
|
|
print(entry.binaryEntries |
|
|
|
print(entry.binaryEntries |
|
|
|
.map((b) => '$indent `- file: ${b.key} - ${b.value.value.length}') |
|
|
|
.map((b) => '$indent `- file: ${b.key} - ${b.value.value.length}') |
|
|
|
.join('\n')); |
|
|
|
.join('\n')); |
|
|
|