@@ -27,7 +27,11 @@ class Command(BaseCommand):
2727 help = "Details:\n \t Runs nmap scans\n \n Arguments:" + \
2828 "\n \t Weekly\n \t Monthly\n \t Quarterly"
2929
30+ def add_arguments (self , parser ):
31+ parser .add_argument ('type' )
32+
3033 def handle (self , * args , ** options ):
34+ type = options ['type' ]
3135
3236 # Scan the host and add the results of the scan to the host informaiton
3337 def runScan (prod_id , p_dict ):
@@ -195,23 +199,23 @@ def run(self):
195199 Scans are performed on a Weekly, Monthly, or Quarterly bases. The
196200 target frequency is specified by the cron job scheduler.
197201 """
198- if not args :
202+ if not options :
199203 print "Must specify an argument: Weekly, Monthly, Quarterly, or ID" ,\
200204 " of Scan Settings to use."
201205 sys .exit (0 )
202- if (args [ 0 ] in ["Weekly" , "Monthly" , "Quarterly" ]
203- or args [ 0 ] .isdigit ()):
206+ if (type in ["Weekly" , "Monthly" , "Quarterly" ]
207+ or type .isdigit ()):
204208 pass
205209 else :
206210 print ("Unexpected parameter: " + str (args [0 ]))
207211 print "\n Must specify an argument: Weekly, Monthly, Quarterly" ,\
208212 " or ID of Scan Settings to use."
209213 sys .exit (0 )
210214
211- if args [ 0 ] .isdigit ():
212- scSettings = ScanSettings .objects .filter (id = args [ 0 ] )
215+ if type .isdigit ():
216+ scSettings = ScanSettings .objects .filter (id = type )
213217 else :
214- scSettings = ScanSettings .objects .filter (frequency = args [ 0 ] )
218+ scSettings = ScanSettings .objects .filter (frequency = type )
215219
216220 if len (scSettings ) <= 0 :
217221 print ("No scan settings found with parameter specified." )
0 commit comments