Skip to content

Commit 5c98576

Browse files
committed
Add no_header_authentication option in cli for iris endpoints.
1 parent b05fc77 commit 5c98576

File tree

3 files changed

+96
-27
lines changed

3 files changed

+96
-27
lines changed

domaintools/cli/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def run(cls, name: str, params: Optional[Dict] = {}, **kwargs):
180180
out_file = params.pop("out_file", sys.stdout)
181181
verify_ssl = params.pop("no_verify_ssl", False)
182182
always_sign_api_key = params.pop("no_sign_api_key", False)
183+
header_authentication = params.pop("no_header_authentication", False)
183184
source = None
184185

185186
if "src_file" in params:
@@ -214,6 +215,7 @@ def run(cls, name: str, params: Optional[Dict] = {}, **kwargs):
214215
verify_ssl=verify_ssl,
215216
rate_limit=rate_limit,
216217
always_sign_api_key=always_sign_api_key,
218+
header_authentication=header_authentication,
217219
)
218220
dt_api_func = getattr(dt_api, name)
219221

domaintools/cli/commands/feeds.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ def feeds_nad(
2727
"--no-verify-ssl",
2828
help="Skip verification of SSL certificate when making HTTPs API calls",
2929
),
30+
no_sign_api_key: bool = typer.Option(
31+
False,
32+
"--no-sign-api-key",
33+
help="Skip signing of api key",
34+
),
35+
no_header_authentication: bool = typer.Option(
36+
False,
37+
"--no-header-auth",
38+
help="Don't use header authentication",
39+
),
3040
output_format: str = typer.Option(
3141
"jsonl",
3242
"-f",
@@ -97,6 +107,16 @@ def feeds_nod(
97107
"--no-verify-ssl",
98108
help="Skip verification of SSL certificate when making HTTPs API calls",
99109
),
110+
no_sign_api_key: bool = typer.Option(
111+
False,
112+
"--no-sign-api-key",
113+
help="Skip signing of api key",
114+
),
115+
no_header_authentication: bool = typer.Option(
116+
False,
117+
"--no-header-auth",
118+
help="Don't use header authentication",
119+
),
100120
output_format: str = typer.Option(
101121
"jsonl",
102122
"-f",
@@ -167,6 +187,16 @@ def feeds_domainrdap(
167187
"--no-verify-ssl",
168188
help="Skip verification of SSL certificate when making HTTPs API calls",
169189
),
190+
no_sign_api_key: bool = typer.Option(
191+
False,
192+
"--no-sign-api-key",
193+
help="Skip signing of api key",
194+
),
195+
no_header_authentication: bool = typer.Option(
196+
False,
197+
"--no-header-auth",
198+
help="Don't use header authentication",
199+
),
170200
endpoint: str = typer.Option(
171201
Endpoint.FEED.value,
172202
"-e",
@@ -225,6 +255,16 @@ def feeds_domaindiscovery(
225255
"--no-verify-ssl",
226256
help="Skip verification of SSL certificate when making HTTPs API calls",
227257
),
258+
no_sign_api_key: bool = typer.Option(
259+
False,
260+
"--no-sign-api-key",
261+
help="Skip signing of api key",
262+
),
263+
no_header_authentication: bool = typer.Option(
264+
False,
265+
"--no-header-auth",
266+
help="Don't use header authentication",
267+
),
228268
output_format: str = typer.Option(
229269
"jsonl",
230270
"-f",
@@ -295,6 +335,16 @@ def feeds_noh(
295335
"--no-verify-ssl",
296336
help="Skip verification of SSL certificate when making HTTPs API calls",
297337
),
338+
no_sign_api_key: bool = typer.Option(
339+
False,
340+
"--no-sign-api-key",
341+
help="Skip signing of api key",
342+
),
343+
no_header_authentication: bool = typer.Option(
344+
False,
345+
"--no-header-auth",
346+
help="Don't use header authentication",
347+
),
298348
output_format: str = typer.Option(
299349
"jsonl",
300350
"-f",
@@ -365,6 +415,16 @@ def feeds_domainhotlist(
365415
"--no-verify-ssl",
366416
help="Skip verification of SSL certificate when making HTTPs API calls",
367417
),
418+
no_sign_api_key: bool = typer.Option(
419+
False,
420+
"--no-sign-api-key",
421+
help="Skip signing of api key",
422+
),
423+
no_header_authentication: bool = typer.Option(
424+
False,
425+
"--no-header-auth",
426+
help="Don't use header authentication",
427+
),
368428
output_format: str = typer.Option(
369429
"jsonl",
370430
"-f",
@@ -435,6 +495,16 @@ def feeds_realtime_domain_risk(
435495
"--no-verify-ssl",
436496
help="Skip verification of SSL certificate when making HTTPs API calls",
437497
),
498+
no_sign_api_key: bool = typer.Option(
499+
False,
500+
"--no-sign-api-key",
501+
help="Skip signing of api key",
502+
),
503+
no_header_authentication: bool = typer.Option(
504+
False,
505+
"--no-header-auth",
506+
help="Don't use header authentication",
507+
),
438508
output_format: str = typer.Option(
439509
"jsonl",
440510
"-f",

domaintools/cli/commands/iris.py

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,11 @@
1818
def iris_investigate(
1919
ctx: typer.Context,
2020
domains: str = typer.Option(None, "-d", "--domains", help="Domains to use."),
21-
data_updated_after: str = typer.Option(
22-
None, "--data-updated-after", help="The data updated after."
23-
),
24-
expiration_date: str = typer.Option(
25-
None, "--expiration-date", help="The expiration date."
26-
),
21+
data_updated_after: str = typer.Option(None, "--data-updated-after", help="The data updated after."),
22+
expiration_date: str = typer.Option(None, "--expiration-date", help="The expiration date."),
2723
create_date: str = typer.Option(None, "--create-date", help="The create date."),
28-
active: bool = typer.Option(
29-
None, "--active", help="The domains that are in active state"
30-
),
31-
search_hash: str = typer.Option(
32-
None, "--search-hash", help="The search hash to use"
33-
),
24+
active: bool = typer.Option(None, "--active", help="The domains that are in active state"),
25+
search_hash: str = typer.Option(None, "--search-hash", help="The search hash to use"),
3426
src_file: str = typer.Option(
3527
None,
3628
"-s",
@@ -59,24 +51,25 @@ def iris_investigate(
5951
help="Output format in {'list', 'json', 'xml', 'html'}",
6052
callback=DTCLICommand.validate_format_input,
6153
),
62-
out_file: typer.FileTextWrite = typer.Option(
63-
sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"
64-
),
54+
out_file: typer.FileTextWrite = typer.Option(sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"),
6555
no_verify_ssl: bool = typer.Option(
6656
False,
6757
"--no-verify-ssl",
6858
help="Skip verification of SSL certificate when making HTTPs API calls",
6959
),
60+
no_header_authentication: bool = typer.Option(
61+
False,
62+
"--no-header-auth",
63+
help="Don't use header authentication",
64+
),
7065
):
7166

7267
extra_args = ctx.args.copy()
7368
kwargs = DTCLICommand.args_to_dict(*extra_args)
7469
if "ssl_hash" in kwargs:
7570
# silently remove the ':' if present.
7671
ssl_hash_value = kwargs["ssl_hash"]
77-
kwargs["ssl_hash"] = remove_special_char_in_string(
78-
ssl_hash_value, special_char=":"
79-
)
72+
kwargs["ssl_hash"] = remove_special_char_in_string(ssl_hash_value, special_char=":")
8073

8174
DTCLICommand.run(name=c.IRIS_INVESTIGATE, params=ctx.params, **kwargs)
8275

@@ -117,14 +110,17 @@ def iris_enrich(
117110
help="Output format in {'list', 'json', 'xml', 'html'}",
118111
callback=DTCLICommand.validate_format_input,
119112
),
120-
out_file: typer.FileTextWrite = typer.Option(
121-
sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"
122-
),
113+
out_file: typer.FileTextWrite = typer.Option(sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"),
123114
no_verify_ssl: bool = typer.Option(
124115
False,
125116
"--no-verify-ssl",
126117
help="Skip verification of SSL certificate when making HTTPs API calls",
127118
),
119+
no_header_authentication: bool = typer.Option(
120+
False,
121+
"--no-header-auth",
122+
help="Don't use header authentication",
123+
),
128124
):
129125
DTCLICommand.run(name=c.IRIS_ENRICH, params=ctx.params)
130126

@@ -142,9 +138,7 @@ def iris(
142138
nameserver: str = typer.Option(None, "--nameserver", help="Nameserver to use."),
143139
registrar: str = typer.Option(None, "--registrar", help="Registrar to use."),
144140
registrant: str = typer.Option(None, "--registrant", help="Registrant to use."),
145-
registrant_org: str = typer.Option(
146-
None, "--registrant-org", help="Registrant Org to use."
147-
),
141+
registrant_org: str = typer.Option(None, "--registrant-org", help="Registrant Org to use."),
148142
user: str = typer.Option(None, "-u", "--user", help="Domaintools API Username."),
149143
key: str = typer.Option(None, "-k", "--key", help="DomainTools API key"),
150144
creds_file: str = typer.Option(
@@ -166,14 +160,17 @@ def iris(
166160
help="Output format in {'list', 'json', 'xml', 'html'}",
167161
callback=DTCLICommand.validate_format_input,
168162
),
169-
out_file: typer.FileTextWrite = typer.Option(
170-
sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"
171-
),
163+
out_file: typer.FileTextWrite = typer.Option(sys.stdout, "-o", "--out-file", help="Output file (defaults to stdout)"),
172164
no_verify_ssl: bool = typer.Option(
173165
False,
174166
"--no-verify-ssl",
175167
help="Skip verification of SSL certificate when making HTTPs API calls",
176168
),
169+
no_header_authentication: bool = typer.Option(
170+
False,
171+
"--no-header-auth",
172+
help="Don't use header authentication",
173+
),
177174
):
178175
params = ctx.params.copy()
179176
if (

0 commit comments

Comments
 (0)