forked from nimbusec-oss/nimbusec-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
57 lines (43 loc) · 1.69 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// -- PHP Example code demonstrating some method calls of the API client --
require_once ('lib/NimbusecAPI.php');
// -- Define credentials --
$NIMBUSEC_KEY = '--- YOUR KEY ---';
$NIMBUSEC_SECRET = '--- YOUR SECRET ---';
// -- Create a new instance of the API client --
$apiInstance = new NimbusecAPI ( $NIMBUSEC_KEY, $NIMBUSEC_SECRET );
// -- List all domains + Exception Handling--
try {
echo $apiInstance->findDomains ();
}catch (Exception $e){
echo $e->getMessage();
}
// -- Search for a specific domain --
$domains = $apiInstance->findDomains ( "name=\"www.nimbusec.com\"" );
$domainID = $domains[0]['id'];
// -- Find CMS concerned results for a specific domain --
echo $apiInstance->findResults( $domainID, "event=\cms-vulnerable\"");
// -- Create a new domain --
$newDomain = array (
"scheme" => "https",
"name" => "www.somedomain.com",
"deepScan" => "https://www.somedomain.com",
"fastScans" => array (
"https://www.somedomain.com"
),
"bundle" => "--- BUNDLE ID ---"
);
echo $apiInstance->createDomain ( $newDomain );
// -- Search for a specific user --
$users = $apiInstance->findUsers ( "login=\"[email protected]\"" );
$userID = $users[0]['id'];
// -- Update the fetched user --
$userUpdate = array (
"company" => "Cumulo",
"surname" => "Mustermann",
"forename" => "Max"
);
echo $apiInstance->updateUser ( $userID, $userUpdate );
// -- Delete the user --
$apiInstance->deleteUser ( $userID );
?>