How to use itervalues method in autotest

Best Python code snippet using autotest_python

ascan.py

Source:ascan.py Github

copy

Full Screen

...24 def status(self, scanid=None):25 params = {}26 if scanid is not None:27 params['scanId'] = scanid28 return next(self.zap._request(self.zap.base + 'ascan/view/status/', params).itervalues())29 def scan_progress(self, scanid=None):30 params = {}31 if scanid is not None:32 params['scanId'] = scanid33 return next(self.zap._request(self.zap.base + 'ascan/view/scanProgress/', params).itervalues())34 def messages_ids(self, scanid):35 return next(self.zap._request(self.zap.base + 'ascan/view/messagesIds/', {'scanId' : scanid}).itervalues())36 def alerts_ids(self, scanid):37 return next(self.zap._request(self.zap.base + 'ascan/view/alertsIds/', {'scanId' : scanid}).itervalues())38 @property39 def scans(self):40 return next(self.zap._request(self.zap.base + 'ascan/view/scans/').itervalues())41 @property42 def scan_policy_names(self):43 return next(self.zap._request(self.zap.base + 'ascan/view/scanPolicyNames/').itervalues())44 @property45 def excluded_from_scan(self):46 return next(self.zap._request(self.zap.base + 'ascan/view/excludedFromScan/').itervalues())47 def scanners(self, scanpolicyname=None, policyid=None):48 params = {}49 if scanpolicyname is not None:50 params['scanPolicyName'] = scanpolicyname51 if policyid is not None:52 params['policyId'] = policyid53 return next(self.zap._request(self.zap.base + 'ascan/view/scanners/', params).itervalues())54 def policies(self, scanpolicyname=None, policyid=None):55 params = {}56 if scanpolicyname is not None:57 params['scanPolicyName'] = scanpolicyname58 if policyid is not None:59 params['policyId'] = policyid60 return next(self.zap._request(self.zap.base + 'ascan/view/policies/', params).itervalues())61 @property62 def attack_mode_queue(self):63 return next(self.zap._request(self.zap.base + 'ascan/view/attackModeQueue/').itervalues())64 @property65 def option_attack_policy(self):66 return next(self.zap._request(self.zap.base + 'ascan/view/optionAttackPolicy/').itervalues())67 @property68 def option_default_policy(self):69 return next(self.zap._request(self.zap.base + 'ascan/view/optionDefaultPolicy/').itervalues())70 @property71 def option_delay_in_ms(self):72 return next(self.zap._request(self.zap.base + 'ascan/view/optionDelayInMs/').itervalues())73 @property74 def option_excluded_param_list(self):75 return next(self.zap._request(self.zap.base + 'ascan/view/optionExcludedParamList/').itervalues())76 @property77 def option_handle_anti_csrf_tokens(self):78 return next(self.zap._request(self.zap.base + 'ascan/view/optionHandleAntiCSRFTokens/').itervalues())79 @property80 def option_host_per_scan(self):81 return next(self.zap._request(self.zap.base + 'ascan/view/optionHostPerScan/').itervalues())82 @property83 def option_max_chart_time_in_mins(self):84 return next(self.zap._request(self.zap.base + 'ascan/view/optionMaxChartTimeInMins/').itervalues())85 @property86 def option_max_results_to_list(self):87 return next(self.zap._request(self.zap.base + 'ascan/view/optionMaxResultsToList/').itervalues())88 @property89 def option_max_scans_in_ui(self):90 return next(self.zap._request(self.zap.base + 'ascan/view/optionMaxScansInUI/').itervalues())91 @property92 def option_target_params_enabled_rpc(self):93 return next(self.zap._request(self.zap.base + 'ascan/view/optionTargetParamsEnabledRPC/').itervalues())94 @property95 def option_target_params_injectable(self):96 return next(self.zap._request(self.zap.base + 'ascan/view/optionTargetParamsInjectable/').itervalues())97 @property98 def option_thread_per_host(self):99 return next(self.zap._request(self.zap.base + 'ascan/view/optionThreadPerHost/').itervalues())100 @property101 def option_allow_attack_on_start(self):102 return next(self.zap._request(self.zap.base + 'ascan/view/optionAllowAttackOnStart/').itervalues())103 @property104 def option_inject_plugin_id_in_header(self):105 return next(self.zap._request(self.zap.base + 'ascan/view/optionInjectPluginIdInHeader/').itervalues())106 @property107 def option_prompt_in_attack_mode(self):108 return next(self.zap._request(self.zap.base + 'ascan/view/optionPromptInAttackMode/').itervalues())109 @property110 def option_prompt_to_clear_finished_scans(self):111 return next(self.zap._request(self.zap.base + 'ascan/view/optionPromptToClearFinishedScans/').itervalues())112 @property113 def option_rescan_in_attack_mode(self):114 return next(self.zap._request(self.zap.base + 'ascan/view/optionRescanInAttackMode/').itervalues())115 @property116 def option_scan_headers_all_requests(self):117 """118 Tells whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body.119 """120 return next(self.zap._request(self.zap.base + 'ascan/view/optionScanHeadersAllRequests/').itervalues())121 @property122 def option_show_advanced_dialog(self):123 return next(self.zap._request(self.zap.base + 'ascan/view/optionShowAdvancedDialog/').itervalues())124 def scan(self, url, recurse=None, inscopeonly=None, scanpolicyname=None, method=None, postdata=None, apikey=''):125 params = {'url' : url, 'apikey' : apikey}126 if recurse is not None:127 params['recurse'] = recurse128 if inscopeonly is not None:129 params['inScopeOnly'] = inscopeonly130 if scanpolicyname is not None:131 params['scanPolicyName'] = scanpolicyname132 if method is not None:133 params['method'] = method134 if postdata is not None:135 params['postData'] = postdata136 return next(self.zap._request(self.zap.base + 'ascan/action/scan/', params).itervalues())137 def scan_as_user(self, url, contextid, userid, recurse=None, scanpolicyname=None, method=None, postdata=None, apikey=''):138 """139 Active Scans from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details.140 """141 params = {'url' : url, 'contextId' : contextid, 'userId' : userid, 'apikey' : apikey}142 if recurse is not None:143 params['recurse'] = recurse144 if scanpolicyname is not None:145 params['scanPolicyName'] = scanpolicyname146 if method is not None:147 params['method'] = method148 if postdata is not None:149 params['postData'] = postdata150 return next(self.zap._request(self.zap.base + 'ascan/action/scanAsUser/', params).itervalues())151 def pause(self, scanid, apikey=''):152 return next(self.zap._request(self.zap.base + 'ascan/action/pause/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())153 def resume(self, scanid, apikey=''):154 return next(self.zap._request(self.zap.base + 'ascan/action/resume/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())155 def stop(self, scanid, apikey=''):156 return next(self.zap._request(self.zap.base + 'ascan/action/stop/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())157 def remove_scan(self, scanid, apikey=''):158 return next(self.zap._request(self.zap.base + 'ascan/action/removeScan/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())159 def pause_all_scans(self, apikey=''):160 return next(self.zap._request(self.zap.base + 'ascan/action/pauseAllScans/', {'apikey' : apikey}).itervalues())161 def resume_all_scans(self, apikey=''):162 return next(self.zap._request(self.zap.base + 'ascan/action/resumeAllScans/', {'apikey' : apikey}).itervalues())163 def stop_all_scans(self, apikey=''):164 return next(self.zap._request(self.zap.base + 'ascan/action/stopAllScans/', {'apikey' : apikey}).itervalues())165 def remove_all_scans(self, apikey=''):166 return next(self.zap._request(self.zap.base + 'ascan/action/removeAllScans/', {'apikey' : apikey}).itervalues())167 def clear_excluded_from_scan(self, apikey=''):168 return next(self.zap._request(self.zap.base + 'ascan/action/clearExcludedFromScan/', {'apikey' : apikey}).itervalues())169 def exclude_from_scan(self, regex, apikey=''):170 return next(self.zap._request(self.zap.base + 'ascan/action/excludeFromScan/', {'regex' : regex, 'apikey' : apikey}).itervalues())171 def enable_all_scanners(self, scanpolicyname=None, apikey=''):172 params = {'apikey' : apikey}173 if scanpolicyname is not None:174 params['scanPolicyName'] = scanpolicyname175 return next(self.zap._request(self.zap.base + 'ascan/action/enableAllScanners/', params).itervalues())176 def disable_all_scanners(self, scanpolicyname=None, apikey=''):177 params = {'apikey' : apikey}178 if scanpolicyname is not None:179 params['scanPolicyName'] = scanpolicyname180 return next(self.zap._request(self.zap.base + 'ascan/action/disableAllScanners/', params).itervalues())181 def enable_scanners(self, ids, scanpolicyname=None, apikey=''):182 params = {'ids' : ids, 'apikey' : apikey}183 if scanpolicyname is not None:184 params['scanPolicyName'] = scanpolicyname185 return next(self.zap._request(self.zap.base + 'ascan/action/enableScanners/', params).itervalues())186 def disable_scanners(self, ids, scanpolicyname=None, apikey=''):187 params = {'ids' : ids, 'apikey' : apikey}188 if scanpolicyname is not None:189 params['scanPolicyName'] = scanpolicyname190 return next(self.zap._request(self.zap.base + 'ascan/action/disableScanners/', params).itervalues())191 def set_enabled_policies(self, ids, scanpolicyname=None, apikey=''):192 params = {'ids' : ids, 'apikey' : apikey}193 if scanpolicyname is not None:194 params['scanPolicyName'] = scanpolicyname195 return next(self.zap._request(self.zap.base + 'ascan/action/setEnabledPolicies/', params).itervalues())196 def set_policy_attack_strength(self, id, attackstrength, scanpolicyname=None, apikey=''):197 params = {'id' : id, 'attackStrength' : attackstrength, 'apikey' : apikey}198 if scanpolicyname is not None:199 params['scanPolicyName'] = scanpolicyname200 return next(self.zap._request(self.zap.base + 'ascan/action/setPolicyAttackStrength/', params).itervalues())201 def set_policy_alert_threshold(self, id, alertthreshold, scanpolicyname=None, apikey=''):202 params = {'id' : id, 'alertThreshold' : alertthreshold, 'apikey' : apikey}203 if scanpolicyname is not None:204 params['scanPolicyName'] = scanpolicyname205 return next(self.zap._request(self.zap.base + 'ascan/action/setPolicyAlertThreshold/', params).itervalues())206 def set_scanner_attack_strength(self, id, attackstrength, scanpolicyname=None, apikey=''):207 params = {'id' : id, 'attackStrength' : attackstrength, 'apikey' : apikey}208 if scanpolicyname is not None:209 params['scanPolicyName'] = scanpolicyname210 return next(self.zap._request(self.zap.base + 'ascan/action/setScannerAttackStrength/', params).itervalues())211 def set_scanner_alert_threshold(self, id, alertthreshold, scanpolicyname=None, apikey=''):212 params = {'id' : id, 'alertThreshold' : alertthreshold, 'apikey' : apikey}213 if scanpolicyname is not None:214 params['scanPolicyName'] = scanpolicyname215 return next(self.zap._request(self.zap.base + 'ascan/action/setScannerAlertThreshold/', params).itervalues())216 def add_scan_policy(self, scanpolicyname, apikey=''):217 return next(self.zap._request(self.zap.base + 'ascan/action/addScanPolicy/', {'scanPolicyName' : scanpolicyname, 'apikey' : apikey}).itervalues())218 def remove_scan_policy(self, scanpolicyname, apikey=''):219 return next(self.zap._request(self.zap.base + 'ascan/action/removeScanPolicy/', {'scanPolicyName' : scanpolicyname, 'apikey' : apikey}).itervalues())220 def set_option_attack_policy(self, string, apikey=''):221 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionAttackPolicy/', {'String' : string, 'apikey' : apikey}).itervalues())222 def set_option_default_policy(self, string, apikey=''):223 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionDefaultPolicy/', {'String' : string, 'apikey' : apikey}).itervalues())224 def set_option_allow_attack_on_start(self, boolean, apikey=''):225 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionAllowAttackOnStart/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())226 def set_option_delay_in_ms(self, integer, apikey=''):227 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionDelayInMs/', {'Integer' : integer, 'apikey' : apikey}).itervalues())228 def set_option_handle_anti_csrf_tokens(self, boolean, apikey=''):229 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionHandleAntiCSRFTokens/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())230 def set_option_host_per_scan(self, integer, apikey=''):231 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionHostPerScan/', {'Integer' : integer, 'apikey' : apikey}).itervalues())232 def set_option_inject_plugin_id_in_header(self, boolean, apikey=''):233 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionInjectPluginIdInHeader/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())234 def set_option_max_chart_time_in_mins(self, integer, apikey=''):235 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionMaxChartTimeInMins/', {'Integer' : integer, 'apikey' : apikey}).itervalues())236 def set_option_max_results_to_list(self, integer, apikey=''):237 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionMaxResultsToList/', {'Integer' : integer, 'apikey' : apikey}).itervalues())238 def set_option_max_scans_in_ui(self, integer, apikey=''):239 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionMaxScansInUI/', {'Integer' : integer, 'apikey' : apikey}).itervalues())240 def set_option_prompt_in_attack_mode(self, boolean, apikey=''):241 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionPromptInAttackMode/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())242 def set_option_prompt_to_clear_finished_scans(self, boolean, apikey=''):243 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionPromptToClearFinishedScans/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())244 def set_option_rescan_in_attack_mode(self, boolean, apikey=''):245 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionRescanInAttackMode/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())246 def set_option_scan_headers_all_requests(self, boolean, apikey=''):247 """248 Sets whether or not the HTTP Headers of all requests should be scanned. Not just requests that send parameters, through the query or request body.249 """250 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionScanHeadersAllRequests/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())251 def set_option_show_advanced_dialog(self, boolean, apikey=''):252 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionShowAdvancedDialog/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())253 def set_option_target_params_enabled_rpc(self, integer, apikey=''):254 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionTargetParamsEnabledRPC/', {'Integer' : integer, 'apikey' : apikey}).itervalues())255 def set_option_target_params_injectable(self, integer, apikey=''):256 return next(self.zap._request(self.zap.base + 'ascan/action/setOptionTargetParamsInjectable/', {'Integer' : integer, 'apikey' : apikey}).itervalues())257 def set_option_thread_per_host(self, integer, apikey=''):...

Full Screen

Full Screen

core.py

Source:core.py Github

copy

Full Screen

...24 def alert(self, id):25 """26 Gets the alert with the given ID, the corresponding HTTP message can be obtained with the 'messageId' field and 'message' API method27 """28 return next(self.zap._request(self.zap.base + 'core/view/alert/', {'id' : id}).itervalues())29 def alerts(self, baseurl=None, start=None, count=None):30 """31 Gets the alerts raised by ZAP, optionally filtering by URL and paginating with 'start' position and 'count' of alerts32 """33 params = {}34 if baseurl is not None:35 params['baseurl'] = baseurl36 if start is not None:37 params['start'] = start38 if count is not None:39 params['count'] = count40 return next(self.zap._request(self.zap.base + 'core/view/alerts/', params).itervalues())41 def number_of_alerts(self, baseurl=None):42 """43 Gets the number of alerts, optionally filtering by URL44 """45 params = {}46 if baseurl is not None:47 params['baseurl'] = baseurl48 return next(self.zap._request(self.zap.base + 'core/view/numberOfAlerts/', params).itervalues())49 @property50 def hosts(self):51 """52 Gets the name of the hosts accessed through/by ZAP53 """54 return next(self.zap._request(self.zap.base + 'core/view/hosts/').itervalues())55 @property56 def sites(self):57 """58 Gets the sites accessed through/by ZAP (scheme and domain)59 """60 return next(self.zap._request(self.zap.base + 'core/view/sites/').itervalues())61 @property62 def urls(self):63 """64 Gets the URLs accessed through/by ZAP65 """66 return next(self.zap._request(self.zap.base + 'core/view/urls/').itervalues())67 def message(self, id):68 """69 Gets the HTTP message with the given ID. Returns the ID, request/response headers and bodies, cookies and note.70 """71 return next(self.zap._request(self.zap.base + 'core/view/message/', {'id' : id}).itervalues())72 def messages(self, baseurl=None, start=None, count=None):73 """74 Gets the HTTP messages sent by ZAP, request and response, optionally filtered by URL and paginated with 'start' position and 'count' of messages75 """76 params = {}77 if baseurl is not None:78 params['baseurl'] = baseurl79 if start is not None:80 params['start'] = start81 if count is not None:82 params['count'] = count83 return next(self.zap._request(self.zap.base + 'core/view/messages/', params).itervalues())84 def number_of_messages(self, baseurl=None):85 """86 Gets the number of messages, optionally filtering by URL87 """88 params = {}89 if baseurl is not None:90 params['baseurl'] = baseurl91 return next(self.zap._request(self.zap.base + 'core/view/numberOfMessages/', params).itervalues())92 @property93 def mode(self):94 """95 Gets the mode96 """97 return next(self.zap._request(self.zap.base + 'core/view/mode/').itervalues())98 @property99 def version(self):100 """101 Gets ZAP version102 """103 return next(self.zap._request(self.zap.base + 'core/view/version/').itervalues())104 @property105 def excluded_from_proxy(self):106 """107 Gets the regular expressions, applied to URLs, to exclude from the Proxy108 """109 return next(self.zap._request(self.zap.base + 'core/view/excludedFromProxy/').itervalues())110 @property111 def home_directory(self):112 return next(self.zap._request(self.zap.base + 'core/view/homeDirectory/').itervalues())113 @property114 def option_default_user_agent(self):115 return next(self.zap._request(self.zap.base + 'core/view/optionDefaultUserAgent/').itervalues())116 @property117 def option_http_state(self):118 return next(self.zap._request(self.zap.base + 'core/view/optionHttpState/').itervalues())119 @property120 def option_proxy_chain_name(self):121 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainName/').itervalues())122 @property123 def option_proxy_chain_password(self):124 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainPassword/').itervalues())125 @property126 def option_proxy_chain_port(self):127 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainPort/').itervalues())128 @property129 def option_proxy_chain_realm(self):130 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainRealm/').itervalues())131 @property132 def option_proxy_chain_skip_name(self):133 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainSkipName/').itervalues())134 @property135 def option_proxy_chain_user_name(self):136 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainUserName/').itervalues())137 @property138 def option_proxy_excluded_domains(self):139 return next(self.zap._request(self.zap.base + 'core/view/optionProxyExcludedDomains/').itervalues())140 @property141 def option_proxy_excluded_domains_enabled(self):142 return next(self.zap._request(self.zap.base + 'core/view/optionProxyExcludedDomainsEnabled/').itervalues())143 @property144 def option_timeout_in_secs(self):145 return next(self.zap._request(self.zap.base + 'core/view/optionTimeoutInSecs/').itervalues())146 @property147 def option_http_state_enabled(self):148 return next(self.zap._request(self.zap.base + 'core/view/optionHttpStateEnabled/').itervalues())149 @property150 def option_proxy_chain_prompt(self):151 return next(self.zap._request(self.zap.base + 'core/view/optionProxyChainPrompt/').itervalues())152 @property153 def option_single_cookie_request_header(self):154 return next(self.zap._request(self.zap.base + 'core/view/optionSingleCookieRequestHeader/').itervalues())155 @property156 def option_use_proxy_chain(self):157 return next(self.zap._request(self.zap.base + 'core/view/optionUseProxyChain/').itervalues())158 @property159 def option_use_proxy_chain_auth(self):160 return next(self.zap._request(self.zap.base + 'core/view/optionUseProxyChainAuth/').itervalues())161 def access_url(self, url, followredirects=None, apikey=''):162 """163 Convenient and simple action to access a URL, optionally following redirections. Returns the request sent and response received and followed redirections, if any. Other actions are available which offer more control on what is sent, like, 'sendRequest' or 'sendHarRequest'.164 """165 params = {'url' : url, 'apikey' : apikey}166 if followredirects is not None:167 params['followRedirects'] = followredirects168 return next(self.zap._request(self.zap.base + 'core/action/accessUrl/', params).itervalues())169 def shutdown(self, apikey=''):170 """171 Shuts down ZAP172 """173 return next(self.zap._request(self.zap.base + 'core/action/shutdown/', {'apikey' : apikey}).itervalues())174 def new_session(self, name=None, overwrite=None, apikey=''):175 """176 Creates a new session, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir.177 """178 params = {'apikey' : apikey}179 if name is not None:180 params['name'] = name181 if overwrite is not None:182 params['overwrite'] = overwrite183 return next(self.zap._request(self.zap.base + 'core/action/newSession/', params).itervalues())184 def load_session(self, name, apikey=''):185 """186 Loads the session with the given name. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir.187 """188 return next(self.zap._request(self.zap.base + 'core/action/loadSession/', {'name' : name, 'apikey' : apikey}).itervalues())189 def save_session(self, name, overwrite=None, apikey=''):190 """191 Saves the session with the name supplied, optionally overwriting existing files. If a relative path is specified it will be resolved against the "session" directory in ZAP "home" dir.192 """193 params = {'name' : name, 'apikey' : apikey}194 if overwrite is not None:195 params['overwrite'] = overwrite196 return next(self.zap._request(self.zap.base + 'core/action/saveSession/', params).itervalues())197 def snapshot_session(self, apikey=''):198 return next(self.zap._request(self.zap.base + 'core/action/snapshotSession/', {'apikey' : apikey}).itervalues())199 def clear_excluded_from_proxy(self, apikey=''):200 return next(self.zap._request(self.zap.base + 'core/action/clearExcludedFromProxy/', {'apikey' : apikey}).itervalues())201 def exclude_from_proxy(self, regex, apikey=''):202 return next(self.zap._request(self.zap.base + 'core/action/excludeFromProxy/', {'regex' : regex, 'apikey' : apikey}).itervalues())203 def set_home_directory(self, dir, apikey=''):204 return next(self.zap._request(self.zap.base + 'core/action/setHomeDirectory/', {'dir' : dir, 'apikey' : apikey}).itervalues())205 def set_mode(self, mode, apikey=''):206 """207 Sets the mode, which may be one of [safe, protect, standard, attack]208 """209 return next(self.zap._request(self.zap.base + 'core/action/setMode/', {'mode' : mode, 'apikey' : apikey}).itervalues())210 def generate_root_ca(self, apikey=''):211 return next(self.zap._request(self.zap.base + 'core/action/generateRootCA/', {'apikey' : apikey}).itervalues())212 def send_request(self, request, followredirects=None, apikey=''):213 """214 Sends the HTTP request, optionally following redirections. Returns the request sent and response received and followed redirections, if any.215 """216 params = {'request' : request, 'apikey' : apikey}217 if followredirects is not None:218 params['followRedirects'] = followredirects219 return next(self.zap._request(self.zap.base + 'core/action/sendRequest/', params).itervalues())220 def delete_all_alerts(self, apikey=''):221 return next(self.zap._request(self.zap.base + 'core/action/deleteAllAlerts/', {'apikey' : apikey}).itervalues())222 def run_garbage_collection(self, apikey=''):223 return next(self.zap._request(self.zap.base + 'core/action/runGarbageCollection/', {'apikey' : apikey}).itervalues())224 def delete_site_node(self, url, method=None, postdata=None, apikey=''):225 """226 Deletes the site node found in the Sites Tree on the basis of the URL, HTTP method, and post data (if applicable and specified). 227 """228 params = {'url' : url, 'apikey' : apikey}229 if method is not None:230 params['method'] = method231 if postdata is not None:232 params['postData'] = postdata233 return next(self.zap._request(self.zap.base + 'core/action/deleteSiteNode/', params).itervalues())234 def set_option_default_user_agent(self, string, apikey=''):235 return next(self.zap._request(self.zap.base + 'core/action/setOptionDefaultUserAgent/', {'String' : string, 'apikey' : apikey}).itervalues())236 def set_option_proxy_chain_name(self, string, apikey=''):237 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainName/', {'String' : string, 'apikey' : apikey}).itervalues())238 def set_option_proxy_chain_password(self, string, apikey=''):239 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainPassword/', {'String' : string, 'apikey' : apikey}).itervalues())240 def set_option_proxy_chain_realm(self, string, apikey=''):241 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainRealm/', {'String' : string, 'apikey' : apikey}).itervalues())242 def set_option_proxy_chain_skip_name(self, string, apikey=''):243 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainSkipName/', {'String' : string, 'apikey' : apikey}).itervalues())244 def set_option_proxy_chain_user_name(self, string, apikey=''):245 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainUserName/', {'String' : string, 'apikey' : apikey}).itervalues())246 def set_option_http_state_enabled(self, boolean, apikey=''):247 return next(self.zap._request(self.zap.base + 'core/action/setOptionHttpStateEnabled/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())248 def set_option_proxy_chain_port(self, integer, apikey=''):249 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainPort/', {'Integer' : integer, 'apikey' : apikey}).itervalues())250 def set_option_proxy_chain_prompt(self, boolean, apikey=''):251 return next(self.zap._request(self.zap.base + 'core/action/setOptionProxyChainPrompt/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())252 def set_option_single_cookie_request_header(self, boolean, apikey=''):253 return next(self.zap._request(self.zap.base + 'core/action/setOptionSingleCookieRequestHeader/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())254 def set_option_timeout_in_secs(self, integer, apikey=''):255 return next(self.zap._request(self.zap.base + 'core/action/setOptionTimeoutInSecs/', {'Integer' : integer, 'apikey' : apikey}).itervalues())256 def set_option_use_proxy_chain(self, boolean, apikey=''):257 return next(self.zap._request(self.zap.base + 'core/action/setOptionUseProxyChain/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())258 def set_option_use_proxy_chain_auth(self, boolean, apikey=''):259 return next(self.zap._request(self.zap.base + 'core/action/setOptionUseProxyChainAuth/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())260 def proxy_pac(self, apikey=''):261 return (self.zap._request_other(self.zap.base_other + 'core/other/proxy.pac/', {'apikey' : apikey}))262 def rootcert(self, apikey=''):263 return (self.zap._request_other(self.zap.base_other + 'core/other/rootcert/', {'apikey' : apikey}))264 def setproxy(self, proxy, apikey=''):265 return (self.zap._request_other(self.zap.base_other + 'core/other/setproxy/', {'proxy' : proxy, 'apikey' : apikey}))266 def xmlreport(self, apikey=''):267 """268 Generates a report in XML format269 """270 return (self.zap._request_other(self.zap.base_other + 'core/other/xmlreport/', {'apikey' : apikey}))271 def htmlreport(self, apikey=''):272 """273 Generates a report in HTML format...

Full Screen

Full Screen

spider.py

Source:spider.py Github

copy

Full Screen

...24 def status(self, scanid=None):25 params = {}26 if scanid is not None:27 params['scanId'] = scanid28 return next(self.zap._request(self.zap.base + 'spider/view/status/', params).itervalues())29 def results(self, scanid=None):30 params = {}31 if scanid is not None:32 params['scanId'] = scanid33 return next(self.zap._request(self.zap.base + 'spider/view/results/', params).itervalues())34 def full_results(self, scanid):35 return next(self.zap._request(self.zap.base + 'spider/view/fullResults/', {'scanId' : scanid}).itervalues())36 @property37 def scans(self):38 return next(self.zap._request(self.zap.base + 'spider/view/scans/').itervalues())39 @property40 def excluded_from_scan(self):41 return next(self.zap._request(self.zap.base + 'spider/view/excludedFromScan/').itervalues())42 @property43 def option_domains_always_in_scope(self):44 return next(self.zap._request(self.zap.base + 'spider/view/optionDomainsAlwaysInScope/').itervalues())45 @property46 def option_domains_always_in_scope_enabled(self):47 return next(self.zap._request(self.zap.base + 'spider/view/optionDomainsAlwaysInScopeEnabled/').itervalues())48 @property49 def option_handle_parameters(self):50 return next(self.zap._request(self.zap.base + 'spider/view/optionHandleParameters/').itervalues())51 @property52 def option_max_depth(self):53 return next(self.zap._request(self.zap.base + 'spider/view/optionMaxDepth/').itervalues())54 @property55 def option_max_duration(self):56 return next(self.zap._request(self.zap.base + 'spider/view/optionMaxDuration/').itervalues())57 @property58 def option_max_scans_in_ui(self):59 return next(self.zap._request(self.zap.base + 'spider/view/optionMaxScansInUI/').itervalues())60 @property61 def option_request_wait_time(self):62 return next(self.zap._request(self.zap.base + 'spider/view/optionRequestWaitTime/').itervalues())63 @property64 def option_scope(self):65 return next(self.zap._request(self.zap.base + 'spider/view/optionScope/').itervalues())66 @property67 def option_scope_text(self):68 return next(self.zap._request(self.zap.base + 'spider/view/optionScopeText/').itervalues())69 @property70 def option_skip_url_string(self):71 return next(self.zap._request(self.zap.base + 'spider/view/optionSkipURLString/').itervalues())72 @property73 def option_thread_count(self):74 return next(self.zap._request(self.zap.base + 'spider/view/optionThreadCount/').itervalues())75 @property76 def option_user_agent(self):77 return next(self.zap._request(self.zap.base + 'spider/view/optionUserAgent/').itervalues())78 @property79 def option_handle_o_data_parameters_visited(self):80 return next(self.zap._request(self.zap.base + 'spider/view/optionHandleODataParametersVisited/').itervalues())81 @property82 def option_parse_comments(self):83 return next(self.zap._request(self.zap.base + 'spider/view/optionParseComments/').itervalues())84 @property85 def option_parse_git(self):86 return next(self.zap._request(self.zap.base + 'spider/view/optionParseGit/').itervalues())87 @property88 def option_parse_robots_txt(self):89 return next(self.zap._request(self.zap.base + 'spider/view/optionParseRobotsTxt/').itervalues())90 @property91 def option_parse_svn_entries(self):92 return next(self.zap._request(self.zap.base + 'spider/view/optionParseSVNEntries/').itervalues())93 @property94 def option_parse_sitemap_xml(self):95 return next(self.zap._request(self.zap.base + 'spider/view/optionParseSitemapXml/').itervalues())96 @property97 def option_post_form(self):98 return next(self.zap._request(self.zap.base + 'spider/view/optionPostForm/').itervalues())99 @property100 def option_process_form(self):101 return next(self.zap._request(self.zap.base + 'spider/view/optionProcessForm/').itervalues())102 @property103 def option_send_referer_header(self):104 """105 Sets whether or not the 'Referer' header should be sent while spidering106 """107 return next(self.zap._request(self.zap.base + 'spider/view/optionSendRefererHeader/').itervalues())108 @property109 def option_show_advanced_dialog(self):110 return next(self.zap._request(self.zap.base + 'spider/view/optionShowAdvancedDialog/').itervalues())111 def scan(self, url=None, maxchildren=None, recurse=None, contextname=None, subtreeonly=None, apikey=''):112 """113 Runs the spider against the given URL (or context). Optionally, the 'maxChildren' parameter can be set to limit the number of children scanned, the 'recurse' parameter can be used to prevent the spider from seeding recursively, the parameter 'contextName' can be used to constrain the scan to a Context and the parameter 'subtreeOnly' allows to restrict the spider under a site's subtree (using the specified 'url').114 """115 params = {'apikey' : apikey}116 if url is not None:117 params['url'] = url118 if maxchildren is not None:119 params['maxChildren'] = maxchildren120 if recurse is not None:121 params['recurse'] = recurse122 if contextname is not None:123 params['contextName'] = contextname124 if subtreeonly is not None:125 params['subtreeOnly'] = subtreeonly126 return next(self.zap._request(self.zap.base + 'spider/action/scan/', params).itervalues())127 def scan_as_user(self, contextid, userid, url=None, maxchildren=None, recurse=None, subtreeonly=None, apikey=''):128 """129 Runs the spider from the perspective of a User, obtained using the given Context ID and User ID. See 'scan' action for more details.130 """131 params = {'contextId' : contextid, 'userId' : userid, 'apikey' : apikey}132 if url is not None:133 params['url'] = url134 if maxchildren is not None:135 params['maxChildren'] = maxchildren136 if recurse is not None:137 params['recurse'] = recurse138 if subtreeonly is not None:139 params['subtreeOnly'] = subtreeonly140 return next(self.zap._request(self.zap.base + 'spider/action/scanAsUser/', params).itervalues())141 def pause(self, scanid, apikey=''):142 return next(self.zap._request(self.zap.base + 'spider/action/pause/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())143 def resume(self, scanid, apikey=''):144 return next(self.zap._request(self.zap.base + 'spider/action/resume/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())145 def stop(self, scanid=None, apikey=''):146 params = {'apikey' : apikey}147 if scanid is not None:148 params['scanId'] = scanid149 return next(self.zap._request(self.zap.base + 'spider/action/stop/', params).itervalues())150 def remove_scan(self, scanid, apikey=''):151 return next(self.zap._request(self.zap.base + 'spider/action/removeScan/', {'scanId' : scanid, 'apikey' : apikey}).itervalues())152 def pause_all_scans(self, apikey=''):153 return next(self.zap._request(self.zap.base + 'spider/action/pauseAllScans/', {'apikey' : apikey}).itervalues())154 def resume_all_scans(self, apikey=''):155 return next(self.zap._request(self.zap.base + 'spider/action/resumeAllScans/', {'apikey' : apikey}).itervalues())156 def stop_all_scans(self, apikey=''):157 return next(self.zap._request(self.zap.base + 'spider/action/stopAllScans/', {'apikey' : apikey}).itervalues())158 def remove_all_scans(self, apikey=''):159 return next(self.zap._request(self.zap.base + 'spider/action/removeAllScans/', {'apikey' : apikey}).itervalues())160 def clear_excluded_from_scan(self, apikey=''):161 return next(self.zap._request(self.zap.base + 'spider/action/clearExcludedFromScan/', {'apikey' : apikey}).itervalues())162 def exclude_from_scan(self, regex, apikey=''):163 return next(self.zap._request(self.zap.base + 'spider/action/excludeFromScan/', {'regex' : regex, 'apikey' : apikey}).itervalues())164 def set_option_handle_parameters(self, string, apikey=''):165 return next(self.zap._request(self.zap.base + 'spider/action/setOptionHandleParameters/', {'String' : string, 'apikey' : apikey}).itervalues())166 def set_option_scope_string(self, string, apikey=''):167 return next(self.zap._request(self.zap.base + 'spider/action/setOptionScopeString/', {'String' : string, 'apikey' : apikey}).itervalues())168 def set_option_skip_url_string(self, string, apikey=''):169 return next(self.zap._request(self.zap.base + 'spider/action/setOptionSkipURLString/', {'String' : string, 'apikey' : apikey}).itervalues())170 def set_option_user_agent(self, string, apikey=''):171 return next(self.zap._request(self.zap.base + 'spider/action/setOptionUserAgent/', {'String' : string, 'apikey' : apikey}).itervalues())172 def set_option_handle_o_data_parameters_visited(self, boolean, apikey=''):173 return next(self.zap._request(self.zap.base + 'spider/action/setOptionHandleODataParametersVisited/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())174 def set_option_max_depth(self, integer, apikey=''):175 return next(self.zap._request(self.zap.base + 'spider/action/setOptionMaxDepth/', {'Integer' : integer, 'apikey' : apikey}).itervalues())176 def set_option_max_duration(self, integer, apikey=''):177 return next(self.zap._request(self.zap.base + 'spider/action/setOptionMaxDuration/', {'Integer' : integer, 'apikey' : apikey}).itervalues())178 def set_option_max_scans_in_ui(self, integer, apikey=''):179 return next(self.zap._request(self.zap.base + 'spider/action/setOptionMaxScansInUI/', {'Integer' : integer, 'apikey' : apikey}).itervalues())180 def set_option_parse_comments(self, boolean, apikey=''):181 return next(self.zap._request(self.zap.base + 'spider/action/setOptionParseComments/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())182 def set_option_parse_git(self, boolean, apikey=''):183 return next(self.zap._request(self.zap.base + 'spider/action/setOptionParseGit/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())184 def set_option_parse_robots_txt(self, boolean, apikey=''):185 return next(self.zap._request(self.zap.base + 'spider/action/setOptionParseRobotsTxt/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())186 def set_option_parse_svn_entries(self, boolean, apikey=''):187 return next(self.zap._request(self.zap.base + 'spider/action/setOptionParseSVNEntries/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())188 def set_option_parse_sitemap_xml(self, boolean, apikey=''):189 return next(self.zap._request(self.zap.base + 'spider/action/setOptionParseSitemapXml/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())190 def set_option_post_form(self, boolean, apikey=''):191 return next(self.zap._request(self.zap.base + 'spider/action/setOptionPostForm/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())192 def set_option_process_form(self, boolean, apikey=''):193 return next(self.zap._request(self.zap.base + 'spider/action/setOptionProcessForm/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())194 def set_option_request_wait_time(self, integer, apikey=''):195 return next(self.zap._request(self.zap.base + 'spider/action/setOptionRequestWaitTime/', {'Integer' : integer, 'apikey' : apikey}).itervalues())196 def set_option_send_referer_header(self, boolean, apikey=''):197 return next(self.zap._request(self.zap.base + 'spider/action/setOptionSendRefererHeader/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())198 def set_option_show_advanced_dialog(self, boolean, apikey=''):199 return next(self.zap._request(self.zap.base + 'spider/action/setOptionShowAdvancedDialog/', {'Boolean' : boolean, 'apikey' : apikey}).itervalues())200 def set_option_thread_count(self, integer, apikey=''):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful