|
6 | 6 | from domaintools.cli.api import DTCLICommand |
7 | 7 | from domaintools.cli.utils import get_cli_helptext_by_name |
8 | 8 | from domaintools.cli import constants as c |
| 9 | +from domaintools.constants import Endpoint, OutputFormat |
9 | 10 |
|
10 | 11 |
|
11 | 12 | @dt_cli.command( |
@@ -158,6 +159,13 @@ def feeds_domainrdap( |
158 | 159 | "--no-sign-api-key", |
159 | 160 | help="Skip signing of api key", |
160 | 161 | ), |
| 162 | + endpoint: str = typer.Option( |
| 163 | + Endpoint.FEED.value, |
| 164 | + "-e", |
| 165 | + "--endpoint", |
| 166 | + help=f"Valid endpoints: [{Endpoint.FEED.value}, {Endpoint.DOWNLOAD.value}]", |
| 167 | + callback=DTCLICommand.validate_endpoint_input, |
| 168 | + ), |
161 | 169 | sessionID: str = typer.Option( |
162 | 170 | None, |
163 | 171 | "--session-id", |
@@ -188,3 +196,78 @@ def feeds_domainrdap( |
188 | 196 | ), |
189 | 197 | ): |
190 | 198 | DTCLICommand.run(name=c.FEEDS_DOMAINRDAP, params=ctx.params) |
| 199 | + |
| 200 | + |
| 201 | +@dt_cli.command( |
| 202 | + name=c.FEEDS_DOMAINDISCOVERY, |
| 203 | + help=get_cli_helptext_by_name(command_name=c.FEEDS_DOMAINDISCOVERY), |
| 204 | +) |
| 205 | +def feeds_domaindiscovery( |
| 206 | + ctx: typer.Context, |
| 207 | + user: str = typer.Option(None, "-u", "--user", help="Domaintools API Username."), |
| 208 | + key: str = typer.Option(None, "-k", "--key", help="DomainTools API key"), |
| 209 | + creds_file: str = typer.Option( |
| 210 | + "~/.dtapi", |
| 211 | + "-c", |
| 212 | + "--credfile", |
| 213 | + help="Optional file with API username and API key, one per line.", |
| 214 | + ), |
| 215 | + no_verify_ssl: bool = typer.Option( |
| 216 | + False, |
| 217 | + "--no-verify-ssl", |
| 218 | + help="Skip verification of SSL certificate when making HTTPs API calls", |
| 219 | + ), |
| 220 | + no_sign_api_key: bool = typer.Option( |
| 221 | + False, |
| 222 | + "--no-sign-api-key", |
| 223 | + help="Skip signing of api key", |
| 224 | + ), |
| 225 | + output_format: str = typer.Option( |
| 226 | + "jsonl", |
| 227 | + "-f", |
| 228 | + "--format", |
| 229 | + help=f"Output format in [{OutputFormat.JSONL.value}, {OutputFormat.CSV.value}]", |
| 230 | + callback=DTCLICommand.validate_feeds_format_input, |
| 231 | + ), |
| 232 | + endpoint: str = typer.Option( |
| 233 | + Endpoint.FEED.value, |
| 234 | + "-e", |
| 235 | + "--endpoint", |
| 236 | + help=f"Valid endpoints: [{Endpoint.FEED.value}, {Endpoint.DOWNLOAD.value}]", |
| 237 | + callback=DTCLICommand.validate_endpoint_input, |
| 238 | + ), |
| 239 | + sessionID: str = typer.Option( |
| 240 | + None, |
| 241 | + "--session-id", |
| 242 | + help="Unique identifier for the session", |
| 243 | + ), |
| 244 | + after: str = typer.Option( |
| 245 | + None, |
| 246 | + "--after", |
| 247 | + help="Start of the time window, relative to the current time in seconds, for which data will be provided", |
| 248 | + callback=DTCLICommand.validate_after_or_before_input, |
| 249 | + ), |
| 250 | + before: str = typer.Option( |
| 251 | + None, |
| 252 | + "--before", |
| 253 | + help="The end of the query window in seconds, relative to the current time, inclusive", |
| 254 | + callback=DTCLICommand.validate_after_or_before_input, |
| 255 | + ), |
| 256 | + domain: str = typer.Option( |
| 257 | + None, |
| 258 | + "-d", |
| 259 | + "--domain", |
| 260 | + help="A string value used to filter feed results", |
| 261 | + ), |
| 262 | + headers: bool = typer.Option( |
| 263 | + False, |
| 264 | + "--headers", |
| 265 | + help="Adds a header to the first line of response when text/csv is set in header parameters", |
| 266 | + ), |
| 267 | + top: str = typer.Option( |
| 268 | + None, |
| 269 | + "--top", |
| 270 | + help="Number of results to return in the response payload. This is ignored in download endpoint", |
| 271 | + ), |
| 272 | +): |
| 273 | + DTCLICommand.run(name=c.FEEDS_DOMAINDISCOVERY, params=ctx.params) |
0 commit comments