MCPcopy
hub / github.com/guelfoweb/knockpy / main

Function main

knockpy/cli.py:124–602  ·  view source on GitHub ↗

CLI entrypoint. This function is responsible for argument parsing, config layering (CLI > saved setup > built-in defaults), mode dispatch and result handling.

()

Source from the content-addressed store, hash-verified

122
123
124def main() -> None:
125 """CLI entrypoint.
126
127 This function is responsible for argument parsing, config layering
128 (CLI > saved setup > built-in defaults), mode dispatch and result handling.
129 """
130 stdin_domain_sentinel = "__stdin_domain__"
131 parser = argparse.ArgumentParser(
132 prog="KNOCKPY",
133 description=(
134 f"knockpy v.{__version__} - Subdomain discovery and security checks\n"
135 "CLI options > saved setup (--setup) > built-in defaults.\n"
136 "https://github.com/guelfoweb/knockpy"
137 ),
138 )
139 target_group = parser.add_argument_group("Target")
140 target_group.add_argument(
141 "-d",
142 "--domain",
143 nargs="?",
144 const=stdin_domain_sentinel,
145 help="Domain to analyze. If used without value, reads from stdin.",
146 )
147 target_group.add_argument("-f", "--file", help="File with domains, one per line.")
148
149 mode_group = parser.add_argument_group("Scan Modes")
150 mode_group.add_argument("--recon", help="Enable reconnaissance.", action="store_true")
151 mode_group.add_argument("--bruteforce", "--brute", help="Enable bruteforce.", action="store_true")
152 mode_group.add_argument("--wildcard", help="Test wildcard and exit.", action="store_true")
153 mode_group.add_argument(
154 "--exclude",
155 nargs=2,
156 action="append",
157 metavar=("TYPE", "VALUE"),
158 help="Exclude matches. TYPE=status, length/lenght (e.g. 275), or body. Repeatable.",
159 )
160 mode_group.add_argument(
161 "--verbose",
162 help="Verbose checks for single-domain scan only (without --recon/--bruteforce).",
163 action="store_true",
164 )
165 mode_group.add_argument(
166 "--test",
167 help="With --recon, test each recon service and show which fails or returns data.",
168 action="store_true",
169 )
170
171 setup_group = parser.add_argument_group("Setup and Reports")
172 setup_group.add_argument(
173 "--setup",
174 help="Interactive setup: save runtime defaults and API keys in the local DB.",
175 action="store_true",
176 )
177 setup_group.add_argument(
178 "--report",
179 nargs="?",
180 const="choose",
181 help="Report mode. In interactive terminals it opens the menu (show/delete/export/search/findings).",

Callers 2

knockpy.pyFile · 0.90
cli.pyFile · 0.85

Calls 15

check_latest_versionFunction · 0.85
_normalize_domain_inputFunction · 0.85
_normalize_domain_listFunction · 0.85
pick_user_agentFunction · 0.85
_load_domains_from_fileFunction · 0.85
print_scan_statusFunction · 0.85
BruteforceClass · 0.85
KNOCKPYFunction · 0.85
outputFunction · 0.85
_run_coro_syncFunction · 0.85
_run_asyncFunction · 0.85

Tested by

no test coverage detected