-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcli.py
More file actions
45 lines (36 loc) · 1.02 KB
/
cli.py
File metadata and controls
45 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import argparse
from dataclasses import dataclass
from typing import List
@dataclass(frozen=True)
class CliArgs:
mountpoint: str
dirs: List[str]
output_dir: str
def _setup_argparser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog='fscryptdump',
description='Dump directories encrypted with fscrypt',
)
parser.add_argument(
'mountpoint',
help='The mount point to analyze for fscrypt encrypted files'
)
parser.add_argument(
'-d', '--dir',
help='A list of directory paths (relative to the mountpoint), encrypted using fscrypt, to dump',
nargs='+',
)
parser.add_argument(
'-o', '--output-dir',
help='Directory path where to store the decrypted files',
required=True
)
return parser
def parse_args() -> CliArgs:
parser = _setup_argparser()
args = parser.parse_args()
return CliArgs(
mountpoint=args.mountpoint,
dirs=args.dir,
output_dir=args.output_dir,
)