-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.php
114 lines (87 loc) · 3.62 KB
/
init.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
// Defines our "lib" path where will hold any libraries we need
$lib = 'lib';
// Defines our "config" path where we will hold our configs
$config = 'config';
// Defines our "log" path where will store log messages
$log = "log";
// Defines our "reports" path where will store scan report and the such
$reports = "reports";
// Define our "modules" path where our modules are stored
$modules = "modules";
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
**/
define('EXT', '.php');
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
// Set the lib to the docroot
if ( ! is_dir($lib) AND is_dir(DOCROOT.$lib))
$lib = DOCROOT.$lib;
// Set the config dir to the docroot
if ( ! is_dir($config) AND is_dir(DOCROOT.$config))
$config = DOCROOT.$config;
// Set the config dir to the docroot
if ( ! is_dir($log) AND is_dir(DOCROOT.$log))
$log = DOCROOT.$log;
// Set the report dir to the docroot
if ( ! is_dir($reports) AND is_dir(DOCROOT.$reports))
$reports = DOCROOT.$reports;
// Set the module path to the docroot
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
define('LIBPATH', realpath($lib).DIRECTORY_SEPARATOR);
define('CONFIGPATH', realpath($config).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('LOGPATH', realpath($log).DIRECTORY_SEPARATOR);
define('REPORTPATH', realpath($reports).DIRECTORY_SEPARATOR);
// Load the main vulndb_core class
require(DOCROOT . "classes/vulndb/core" . EXT);
// Set our auto loader
spl_autoload_register(array('vulndb_core', 'auto_load'));
/**
* Enable modules. Modules are referenced by a relative or absolute path
* Define them in config/modules.php
*/
$modules = Config::load('modules');
/**
*
*
* DB Tables mappings/constants
*
* You can change the mapping names in config/db_tables.php, but do not change the CONSTANTS
*
*
*/
$db_tables = Config::load('db_tables');
// VulnDB Core tables
define("MAIN_SCAN_RUN_TABLE", $db_tables['vulndb']['scan_run']); // AKA the 'SCAN_LIST' table, details about every scan that has ran
define("MAIN_SCAN_RESULTS_TABLE", $db_tables['vulndb']['scan_results']); // All Data from a scan
define("MAIN_AG_TABLE", $db_tables['vulndb']['asset_groups']); // Asset Groups for Qualys Account
define("MAIN_QUALYS_KB_TABLE", $db_tables['vulndb']['qualys_kb']); // Qualys KB table
// Asset data report/report template tables
define("ADR_HOSTS_TABLE", $db_tables['vulndb']['adr_hosts']);
define("ADR_VULNS_TABLE", $db_tables['vulndb']['adr_vulns']);
define("ADR_AG_TABLE", $db_tables['vulndb']['adr_asset_groups']);
define("REPORT_TEMPLATE_TABLE", $db_tables['vulndb']['report_templates']);
// Scan Schedules
define("SCAN_SCHEDULES_TABLE", $db_tables['vulndb']['scan_schedules']);
define("SCANS_RUNNING_TABLE", $db_tables['vulndb']['running_scans']);
// Logins
define("LOGINS_TABLE", $db_tables['vulndb_users']['logins']);
// End DB Table mappings/constants