Browse code

Introduce --simple-to-full.

Xavier G authored on26/04/2020 18:24:15
Showing1 changed files

  • yamltab index 09001ab..afe12a5 100755
... ...
@@ -483,6 +483,8 @@ def yaml_to_keytab(buf, args):
483 483
 		# If the provided structure exposes "entries" rather than "records",
484 484
 		# then it very likely features the "simple" data layout.
485 485
 		data = simple_keytab_to_full(data)
486
+		if args.simple_to_full:
487
+			output_data(data, args, 0)
486 488
 	result = raw_keytab_to_binary(data)
487 489
 	sys.stdout.buffer.write(result)
488 490
 
... ...
@@ -492,6 +494,7 @@ def parse_args():
492 494
 	parser.add_argument('--data-layout', '-l',  dest='data_layout', choices=DATA_LAYOUTS.keys(), default='simple', help='data layout (keytab to YAML/JSON only)')
493 495
 	parser.add_argument('--output-format', '-f', dest='output_format', choices=['json', 'yaml'], default='yaml', help='output format (keytab to YAML/JSON only)')
494 496
 	parser.add_argument('--v1-endianness', '-e', dest='v1_endianness', choices=['native', 'little', 'big'], default='native', help='Enforce endianness (keytab v1 to YAML/JSON only)')
497
+	parser.add_argument('--simple-to-full', dest='simple_to_full', action='store_true', default=False, help='Convert from simple to full layout (YAML/JSON input only)')
495 498
 	parser.add_argument('input', nargs='?', type=argparse.FileType('rb'), default=sys.stdin.buffer, help='input file; defaults to standard input')
496 499
 	args = parser.parse_args()
497 500
 	return args