Skip to content

Commit

Permalink
Merge pull request #101 from thc202/update-apis
Browse files Browse the repository at this point in the history
Add/update APIs of add-ons and core
  • Loading branch information
psiinon committed Oct 31, 2022
2 parents 16a48fa + 921569f commit 079b5d2
Show file tree
Hide file tree
Showing 17 changed files with 1,219 additions and 127 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add the APIs of the following add-ons:
- Import/Export version 0.3.0;
- Network version 0.3.0;
- Spider version 0.1.0.

### Changed
- Update core APIs for 2.12.
- Update the APIs of the following add-ons:
- Automation Framework version 0.15.0;
- Selenium version 15.8.0;
- Replacer version 11.

### Deprecated
- The following APIs were deprecated:
- `ImportLogFiles`;
- `Importurls`;
- `LocalProxies`.

### Fixed
- Add a graphql object to ClientApi.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@
import org.zaproxy.clientapi.gen.Break;
import org.zaproxy.clientapi.gen.Context;
import org.zaproxy.clientapi.gen.Core;
import org.zaproxy.clientapi.gen.Exim;
import org.zaproxy.clientapi.gen.Exportreport;
import org.zaproxy.clientapi.gen.ForcedUser;
import org.zaproxy.clientapi.gen.Graphql;
import org.zaproxy.clientapi.gen.HttpSessions;
import org.zaproxy.clientapi.gen.ImportLogFiles;
import org.zaproxy.clientapi.gen.Importurls;
import org.zaproxy.clientapi.gen.LocalProxies;
import org.zaproxy.clientapi.gen.Network;
import org.zaproxy.clientapi.gen.Openapi;
import org.zaproxy.clientapi.gen.Params;
import org.zaproxy.clientapi.gen.Pnh;
Expand Down Expand Up @@ -119,13 +118,25 @@ public class ClientApi {
public Break brk = new Break(this);
public Context context = new Context(this);
public Core core = new Core(this);
public Exim exim = new Exim(this);
public Exportreport exportreport = new Exportreport(this);
public ForcedUser forcedUser = new ForcedUser(this);
public Graphql graphql = new Graphql(this);
public HttpSessions httpSessions = new HttpSessions(this);
public ImportLogFiles logImportFiles = new ImportLogFiles(this);
public Importurls importurls = new Importurls(this);
public LocalProxies localProxies = new LocalProxies(this);

@SuppressWarnings("deprecation")
public org.zaproxy.clientapi.gen.ImportLogFiles logImportFiles =
new org.zaproxy.clientapi.gen.ImportLogFiles(this);

@SuppressWarnings("deprecation")
public org.zaproxy.clientapi.gen.Importurls importurls =
new org.zaproxy.clientapi.gen.Importurls(this);

@SuppressWarnings("deprecation")
public org.zaproxy.clientapi.gen.LocalProxies localProxies =
new org.zaproxy.clientapi.gen.LocalProxies(this);

public Network network = new Network(this);
public Openapi openapi = new Openapi(this);
public Params params = new Params(this);
public Pnh pnh = new Pnh(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ public ApiResponse excludedFromScan() throws ClientApiException {
return api.callApi("ascan", "view", "excludedFromScan", null);
}

/**
* Gets the scanners, optionally, of the given scan policy and/or scanner policy/category ID.
*/
/** Gets the scan rules, optionally, of the given scan policy or scanner policy/category ID. */
public ApiResponse scanners(String scanpolicyname, String policyid) throws ClientApiException {
Map<String, String> map = new HashMap<>();
if (scanpolicyname != null) {
Expand Down Expand Up @@ -253,9 +251,9 @@ public ApiResponse scan(
}

/**
* Runs the active scanner against the given URL and/or Context. Optionally, the 'recurse'
* parameter can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be
* used to constrain the scan to URLs that are in scope (ignored if a Context is specified), the
* Runs the active scanner against the given URL or Context. Optionally, the 'recurse' parameter
* can be used to scan URLs under the given URL, the parameter 'inScopeOnly' can be used to
* constrain the scan to URLs that are in scope (ignored if a Context is specified), the
* parameter 'scanPolicyName' allows to specify the scan policy (if none is given it uses the
* default scan policy), the parameters 'method' and 'postData' allow to select a given request
* in conjunction with the given URL.
Expand Down Expand Up @@ -385,7 +383,7 @@ public ApiResponse excludeFromScan(String regex) throws ClientApiException {
}

/**
* Enables all scanners of the scan policy with the given name, or the default if none given.
* Enables all scan rules of the scan policy with the given name, or the default if none given.
*/
public ApiResponse enableAllScanners(String scanpolicyname) throws ClientApiException {
Map<String, String> map = new HashMap<>();
Expand All @@ -396,7 +394,7 @@ public ApiResponse enableAllScanners(String scanpolicyname) throws ClientApiExce
}

/**
* Disables all scanners of the scan policy with the given name, or the default if none given.
* Disables all scan rules of the scan policy with the given name, or the default if none given.
*/
public ApiResponse disableAllScanners(String scanpolicyname) throws ClientApiException {
Map<String, String> map = new HashMap<>();
Expand All @@ -407,8 +405,8 @@ public ApiResponse disableAllScanners(String scanpolicyname) throws ClientApiExc
}

/**
* Enables the scanners with the given IDs (comma separated list of IDs) of the scan policy with
* the given name, or the default if none given.
* Enables the scan rules with the given IDs (comma separated list of IDs) of the scan policy
* with the given name, or the default if none given.
*/
public ApiResponse enableScanners(String ids, String scanpolicyname) throws ClientApiException {
Map<String, String> map = new HashMap<>();
Expand All @@ -420,7 +418,7 @@ public ApiResponse enableScanners(String ids, String scanpolicyname) throws Clie
}

/**
* Disables the scanners with the given IDs (comma separated list of IDs) of the scan policy
* Disables the scan rules with the given IDs (comma separated list of IDs) of the scan policy
* with the given name, or the default if none given.
*/
public ApiResponse disableScanners(String ids, String scanpolicyname)
Expand Down Expand Up @@ -487,10 +485,6 @@ public ApiResponse setScannerAlertThreshold(
return api.callApi("ascan", "action", "setScannerAlertThreshold", map);
}

public ApiResponse addScanPolicy(String scanpolicyname) throws ClientApiException {
return addScanPolicy(scanpolicyname, null, null);
}

public ApiResponse addScanPolicy(
String scanpolicyname, String alertthreshold, String attackstrength)
throws ClientApiException {
Expand Down
Loading

0 comments on commit 079b5d2

Please sign in to comment.