imprint.py
Go to the documentation of this file.
1 import argparse
2 import pathlib
3 import sys
4 import yaml
5 
6 from system_fingerprint import modules
7 
8 
9 def main(argv=None):
10  parser = argparse.ArgumentParser()
11  parser.add_argument('-p', '--print', action='store_true')
12  parser.add_argument('output_path', type=pathlib.Path,
13  nargs='?', default='fingerprint.yaml')
14  args = parser.parse_args(argv)
15 
16  D = {}
17  for module in modules:
18  try:
19  D[module.__name__] = module()
20  except Exception as e:
21  print(f'{repr(e)} occurred when fingerprinting {module.__name__}. Skipping...', file=sys.stderr)
22 
23  contents = yaml.safe_dump(D)
24 
25  if args.print:
26  print(contents)
27 
28  print(f'saving fingerprint to {args.output_path}')
29  with open(args.output_path, 'w') as f:
30  f.write(contents)
system_fingerprint.imprint.main
def main(argv=None)
Definition: imprint.py:9


system_fingerprint
Author(s):
autogenerated on Wed May 14 2025 02:20:56