@@ -27,7 +27,11 @@ class Command(BaseCommand):
27
27
help = "Details:\n \t Runs nmap scans\n \n Arguments:" + \
28
28
"\n \t Weekly\n \t Monthly\n \t Quarterly"
29
29
30
+ def add_arguments (self , parser ):
31
+ parser .add_argument ('type' )
32
+
30
33
def handle (self , * args , ** options ):
34
+ type = options ['type' ]
31
35
32
36
# Scan the host and add the results of the scan to the host informaiton
33
37
def runScan (prod_id , p_dict ):
@@ -195,23 +199,23 @@ def run(self):
195
199
Scans are performed on a Weekly, Monthly, or Quarterly bases. The
196
200
target frequency is specified by the cron job scheduler.
197
201
"""
198
- if not args :
202
+ if not options :
199
203
print "Must specify an argument: Weekly, Monthly, Quarterly, or ID" ,\
200
204
" of Scan Settings to use."
201
205
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 ()):
204
208
pass
205
209
else :
206
210
print ("Unexpected parameter: " + str (args [0 ]))
207
211
print "\n Must specify an argument: Weekly, Monthly, Quarterly" ,\
208
212
" or ID of Scan Settings to use."
209
213
sys .exit (0 )
210
214
211
- if args [ 0 ] .isdigit ():
212
- scSettings = ScanSettings .objects .filter (id = args [ 0 ] )
215
+ if type .isdigit ():
216
+ scSettings = ScanSettings .objects .filter (id = type )
213
217
else :
214
- scSettings = ScanSettings .objects .filter (frequency = args [ 0 ] )
218
+ scSettings = ScanSettings .objects .filter (frequency = type )
215
219
216
220
if len (scSettings ) <= 0 :
217
221
print ("No scan settings found with parameter specified." )
0 commit comments