|
19 | 19 | parser = argparse.ArgumentParser(description='🦅 A powerful scanner to scan your Filesystem, S3, MySQL, PostgreSQL, MongoDB, Redis, Google Cloud Storage and Firebase storage for PII and sensitive data.') |
20 | 20 | parser.add_argument('command', nargs='?', choices=data_sources_option, help='Command to execute') |
21 | 21 | parser.add_argument('--connection', action='store', help='YAML Connection file path') |
| 22 | +parser.add_argument('--connection-json', type=str, help='Connection details in JSON format, useful for passing connection info directly as CLI Input') |
22 | 23 | parser.add_argument('--fingerprint', action='store', help='Override YAML fingerprint file path') |
23 | | -parser.add_argument('--json', help='Save output to json file') |
24 | | -parser.add_argument('--stdout', action='store_true', help='Print output to stdout') |
| 24 | +parser.add_argument('--json', help='Save output to a json file') |
| 25 | +parser.add_argument('--stdout', action='store_true', help='Print output to stdout in JSON format') |
25 | 26 | parser.add_argument('--quiet', action='store_true', help='Print only the results') |
26 | 27 | parser.add_argument('--debug', action='store_true', help='Enable debug mode') |
27 | 28 | parser.add_argument('--no-write', action='store_true', help='Do not write previous alerts to file, this may flood you with duplicate alerts') |
@@ -126,8 +127,15 @@ def get_connection(): |
126 | 127 | else: |
127 | 128 | print_error(f"Connection file not found: {args.connection}") |
128 | 129 | exit(1) |
| 130 | + elif args.connection_json: |
| 131 | + try: |
| 132 | + connections = json.loads(args.connection_json) |
| 133 | + return connections |
| 134 | + except json.JSONDecodeError as e: |
| 135 | + print_error(f"Error parsing JSON: {e}") |
| 136 | + exit(1) |
129 | 137 | else: |
130 | | - print_error(f"Please provide a connection file using --connection flag") |
| 138 | + print_error("Please provide a connection file using --connection flag or connection details using --connection-json flag") |
131 | 139 | exit(1) |
132 | 140 |
|
133 | 141 | def get_fingerprint_file(): |
|
0 commit comments