python_utils.LOGGER = python_utils.setup_logging() python_utils.WAIT_TIME = python_utils.get_remaining_wait_time(first = True) # send slack notification if os.path.isfile("%s/utilities/sendMessage.sh" % python_utils.EXT_DIR): command='{path}/utilities/sendMessage.sh -l info -m \"Starting dynamic security scan\"'.format(path=python_utils.EXT_DIR) if python_utils.DEBUG: print "running command " + command proc = Popen([command], shell=True, stdout=PIPE, stderr=PIPE) out, err = proc.communicate(); python_utils.LOGGER.debug(out) else: if python_utils.DEBUG: print "sendMessage.sh not found, notifications not attempted" python_utils.LOGGER.info("Getting credentials for Dynamic Analysis service") creds = python_utils.get_credentials_from_bound_app(service=DYNAMIC_ANALYSIS_SERVICE, plan=DEFAULT_SERVICE_PLAN) python_utils.LOGGER.info("Connecting to Dynamic Analysis service") appscan_login(creds['bindingid'],creds['password']) # allow testing connection without full job scan and submission if parsed_args['loginonly']: python_utils.LOGGER.info("LoginOnly set, login complete, exiting") endtime = timeit.default_timer() print "Script completed in " + str(endtime - python_utils.SCRIPT_START_TIME) + " seconds" sys.exit(0) # see if we have related jobs (need this for both paths) joblist = check_for_existing_job(ignore_older_jobs=False) # if checkstate, don't really do a scan, just check state of current outstanding ones if parsed_args['checkstate']: # for checkstate, don't wait, just check current
python_utils.LOGGER = python_utils.setup_logging() # send slack notification if os.path.isfile("%s/utilities/sendMessage.sh" % python_utils.EXT_DIR): command='{path}/utilities/sendMessage.sh -l info -m \"Starting static security scan\"'.format(path=python_utils.EXT_DIR) if python_utils.DEBUG: print "running command " + command proc = Popen([command], shell=True, stdout=PIPE, stderr=PIPE) out, err = proc.communicate(); python_utils.LOGGER.debug(out) else: if python_utils.DEBUG: print "sendMessage.sh not found, notifications not attempted" python_utils.WAIT_TIME = python_utils.get_remaining_wait_time(first = True) python_utils.LOGGER.info("Getting credentials for Static Analysis service") creds = python_utils.get_credentials_from_bound_app(service=STATIC_ANALYSIS_SERVICE) python_utils.LOGGER.info("Connecting to Static Analysis service") appscan_login(creds['bindingid'],creds['password']) # allow testing connection without full job scan and submission if parsed_args['loginonly']: python_utils.LOGGER.info("LoginOnly set, login complete, exiting") endtime = timeit.default_timer() print "Script completed in " + str(endtime - python_utils.SCRIPT_START_TIME) + " seconds" sys.exit(0) # if checkstate, don't really do a scan, just check state of current outstanding ones if parsed_args['checkstate']: # for checkstate, don't wait, just check current python_utils.WAIT_TIME = 0 # see if we have related jobs
print "running command " + command proc = Popen([command], shell=True, stdout=PIPE, stderr=PIPE) out, err = proc.communicate(); python_utils.LOGGER.debug(out) else: if python_utils.DEBUG: print "sendMessage.sh not found, notifications not attempted" python_utils.LOGGER.info("Getting credentials for Dynamic Analysis service") # creds = python_utils.get_credentials_for_non_binding_service(service=APP_SECURITY_SERVICE) # python_utils.LOGGER.info("Connecting to Dynamic Analysis service") # appscan_login(creds['bindingid'],creds['password']) #get_credentials_from_bound_app will bind the app if SETUP_SERVICE_SPACE is true if AD_BOUND_APP: creds = python_utils.get_credentials_from_bound_app(service=APP_SECURITY_SERVICE, binding_app=AD_BOUND_APP) else: creds = python_utils.get_credentials_for_non_binding_service(service=APP_SECURITY_SERVICE) python_utils.LOGGER.info("Connecting to Dynamic Analysis service") appscan_login(creds['bindingid'],creds['password']) # allow testing connection without full job scan and submission if parsed_args['loginonly']: python_utils.LOGGER.info("LoginOnly set, login complete, exiting") endtime = timeit.default_timer() print "Script completed in " + str(endtime - python_utils.SCRIPT_START_TIME) + " seconds" sys.exit(0) # see if we have related jobs (need this for both paths) joblist = check_for_existing_scan(ignore_older_jobs=False) # if checkstate, don't really do a scan, just check state of current outstanding ones if parsed_args['checkstate']: