Skip to content
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

fix json loads of data arg in stix-shifter CLI #1394

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions stix_shifter/scripts/stix_shifter.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,16 @@ def main():
log = utils_logger.set_logger(__name__)


if args.command not in [TRANSLATE] and hasattr(args, 'data') and args.data:
try:
args.data = json.loads(args.data)
except Exception as ex:
log.debug(exception_to_string(ex))
log.error('Cannot convert supplied data json string to json')
help_and_exit = True
if hasattr(args, 'data') and args.data:
if args.command in [TRANSLATE] and args.translate_type == 'query':
pass
else:
try:
args.data = json.loads(args.data)
except Exception as ex:
log.debug(exception_to_string(ex))
log.error('Cannot convert supplied data json string to json')
help_and_exit = True

if hasattr(args, 'data_source') and args.data_source:
try:
Expand Down