7 def create_output(args
):
8 in_st
= os
.stat(args
.input_file
)
9 in_size
= in_st
.st_size
11 in_f
= open(args
.input_file
, 'r+b')
12 in_bytes
= in_f
.read(in_size
)
16 pid_st
= os
.stat(args
.pid_file
)
17 pid_size
= pid_st
.st_size
19 pid_f
= open(args
.pid_file
, 'r+b')
20 pid_bytes
= pid_f
.read(pid_size
)
23 pid_bytes
= bytes
.fromhex(args
.pid
)
25 sha256
= hashlib
.sha256()
26 sha256
.update(in_bytes
)
28 out_f
= open(args
.output_file
, 'w+b')
29 out_f
.write(pid_bytes
)
30 out_f
.write(sha256
.digest())
37 parser
= argparse
.ArgumentParser(description
='')
39 parser
.add_argument('--input-file',
45 parser
.add_argument('--output-file',
51 parser
.add_argument('--pid-file',
55 help='Sercomm PID file')
57 parser
.add_argument('--pid',
63 args
= parser
.parse_args()
65 if ((not args
.input_file
) or
66 (not args
.output_file
) or
67 (not args
.pid_file
and not args
.pid
)):