This library can be used to automate penetration testing of your website using Beagle Security
Beagle Security is a web application & API penetration testing tool that helps you to identify vulnerabilities on your website before hackers exploit them. There are two mechanisms available for automating the process.
- Using REST APIs
- Using SDK
You can find the complete set of REST APIs in the Beagle Security API documentation page.
Maven:
<dependencies>
<dependency>
<groupId>com.beaglesecurity</groupId>
<artifactId>beagle-java-sdk</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
Once you have resolved the dependencies, you can start using the SDK by creating BeagleSecurityClient to communicate with the Beagle Security platform. The below code will fetch all the projects available under a user.
public static void main(String[] args) throws IOException {
// Beagle Security client for communicating with platform
BeagleSecurityClient client=
BeagleSecurityClientBuilder.instance()
// This token will be generated from beagle security settings->Access Token
.withAPIToken("j69czobljo3ozp2knze4v1554eekp3r9")
.build();
// Gets all the projects and its applications under a user
List<ProjectWithApplication> projects = client.getAllProjects();
}
The below code snippet can be used to trigger a new penetration test.
public static void main(String[] args) throws IOException {
// Beagle Security client for communicating with platform
BeagleSecurityClient client=
BeagleSecurityClientBuilder.instance()
// This token will be generated from beagle security settings->Access Token
.withAPIToken("j69czobljo3ozp2knze4v1554eekp3r9")
.build();
// The application token will be available in the application settings page
String applicationToken = "6mkakhiyhxlonol42v87e9cs2gbyarpg";
// Start a test
StartTest startTestResult = client.startTest(applicationToken);
// If started, return a result token
System.out.println(startTestResult.getResultToken());
}
The below code snippet can be used to get the status of a running test.
public static void main(String[] args) throws IOException {
// Beagle Security client for communicating with platform
BeagleSecurityClient client=
BeagleSecurityClientBuilder.instance()
// This token will be generated from beagle security settings->Access Token
.withAPIToken("j69czobljo3ozp2knze4v1554eekp3r9")
.build();
// The application token will be available in the application settings page
String applicationToken = "6mkakhiyhxlonol42v87e9cs2gbyarpg";
// This will be available from the start test API or getTestSessions() or
// getTestRunningSessions() APIs
String resultToken = "wagywiof6m76j1jwgzt8wgjtkuhiuxnv";
// Start a test
TestStatus testStatus = client.getTestStatus(applicationToken, resultToken);
System.out.println("Test Status : " + testStatus.getStatus());
System.out.println("Test Progress : " + testStatus.getProgress());
}
The below code snippet can be used to get the test result once a penetration test is completed.
public static void main(String[] args) throws IOException {
// Beagle Security client for communicating with platform
BeagleSecurityClient client=
BeagleSecurityClientBuilder.instance()
// This token will be generated from beagle security settings->Access Token
.withAPIToken("j69czobljo3ozp2knze4v1554eekp3r9")
.build();
// The application token will be available in the application settings page
String applicationToken = "6mkakhiyhxlonol42v87e9cs2gbyarpg";
// This will be available from the start test API or getTestSessions() or
// getTestRunningSessions() APIs
String resultToken = "wagywiof6m76j1jwgzt8wgjtkuhiuxnv";
// Gets the test result
String jsonResult = client.getTestResultJson(applicationToken, resultToken);
}
This library is Licensed under the MIT License.