-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented the get domain command #18
base: SilentPush-v1.0.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karand-metron Please check the review comments
demisto.error('Job status URL not found in the response') | ||
return response | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karand-metron Check what if job status is null/empty.
Returns: | ||
dict: A dictionary containing the search results | ||
""" | ||
demisto.debug(f'Searching domains with query: {query}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karand-metron Please remove the debug prints
if len(domains) > 100: | ||
raise DemistoException("Maximum of 100 domains can be submitted in a single request") | ||
|
||
demisto.debug(f'Processing domains in bulk: {domains}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
demisto.debug(f'Processing domains in bulk: {domains}') | |
demisto.debug(f'Processing domains in bulk: {domains}') |
Please remove these prints
""" | ||
Command handler for fetching domain information. | ||
domain = args.get('domain', 'silentpush.com') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domain = args.get('domain', 'silentpush.com') | |
domain = args.get('domain', 'silentpush.com') |
@karand-metron Please remove hard coded values
|
||
domain = domain_list[0] | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need separate API for getting single domain.
|
||
|
||
job_complete = False | ||
while not job_complete: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like wrong logic for response receive for domain certificate.
demisto.debug(f'Headers: {masked_headers}') | ||
demisto.debug(f'Params: {params}') | ||
demisto.debug(f'Data: {data}') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not remove all the logs, can we have some logs, those are useful for debugging.
domains = [domain.strip() for domain in domains_arg.split(',') if domain.strip()] | ||
if len(domains) > 100: | ||
raise DemistoException("A maximum of 100 domains can be submitted in a single request.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove so many empty lines in the code.
fetch_whois_info = argToBoolean(args.get('fetch_whois_info', False)) | ||
|
||
|
||
raw_response = client.list_domain_information(domains, fetch_risk_score, fetch_whois_info) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty lines from everywhere.
if as_of: | ||
params['as_of'] = as_of | ||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain why do we need an try except block here? are you handling any specific situation?
|
||
url_suffix = "explore/bulk/ip2asn" | ||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain why do we need an try except block here?
|
||
|
||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explain why do we need an try except block here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karand-metron Let's try to add YMLMetadataCollector. This is the only way we can generate the .yml from .py file with all the validations. Here is the link for reference
|
||
|
||
|
||
def test_module(client: Client) -> str: | ||
try: | ||
client.list_domain_information('silentpush.com') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason you are using this function for the test command? In this command, we only need to verify that we can connect to the Client instance. If possible, try adding a simple method to test the connection.
'Common Name': cert.get('common_name', 'N/A'), | ||
'Subject Alternative Names': ', '.join(cert.get('subject_alt_names', [])), | ||
} | ||
markdown.append(tableToMarkdown('Certificate Information', [cert_info])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add tableToMarkdown() inside loop. Please update this in all the functions.
limit = arg_to_number(args.get('limit')) | ||
|
||
if not nameserver: | ||
raise DemistoException("nameserver is a required parameter") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise DemistoException("nameserver is a required parameter") | |
raise DemistoException("Nameserver is a required parameter.") |
implemented the get domain command