Skip to content

Commit

Permalink
fix parsing paramaters for report command
Browse files Browse the repository at this point in the history
  • Loading branch information
saeeddhqan authored Nov 21, 2022
1 parent 616a293 commit 0a9d04c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions maryam/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import sys
import traceback
import requests
import shlex
from .util.helpers import rand_uagent
from textwrap import wrap

Expand Down Expand Up @@ -644,7 +645,10 @@ def do_report(self, params):
if not params:
self.help_report()
return
arg = params.lower().split(' ')
if self._mode == 'execute':
arg = sys.argv[3:]
else:
arg = shlex.split(params)
gather_file = os.path.join(self.workspace, 'gather.dat')
if not os.path.exists(gather_file):
self.alert('No data found.')
Expand All @@ -657,7 +661,7 @@ def do_report(self, params):
self.error('Gather data is incorrect. Gather is missed!')
return

if arg[0] == 'saved':
if arg[0].lower() == 'saved':
if gather_data:
for mod in gather_data:
self.alert(mod)
Expand All @@ -667,12 +671,11 @@ def do_report(self, params):
self.output('No result found.')
print('')
return

if len(arg) < 3 or len(arg) > 4:
self.error("Module name not found")
self.help_report()
return
_format = arg[0]
_format = arg[0].lower()
if _format not in ('json', 'txt', 'xml', 'csv'):
self.error(f"Format '{_format}' doesn't found.")
return
Expand Down

0 comments on commit 0a9d04c

Please sign in to comment.