-
Notifications
You must be signed in to change notification settings - Fork 44
/
index.php
executable file
·58 lines (50 loc) · 1.22 KB
/
index.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
<?php
/**
*
* phpipam-agent
*
* phpipam scan agent to scan selected subnets and report back
* to main phpipam server.
*
* Script must be called with update/discover argument
*
* Documentation available here :
*
*/
/* require classes */
require('functions/functions.php');
# start phpipam-agent class
try {
// for database connections
if ($config['type']=="mysql") {
// open db connection
$Database = new Database_PDO ();
// test connection, will throw exception if it fails
$Database->connect ();
// new scan object
$Scan = new Scan ($Database);
$Scan->ping_set_exit(true);
$Scan->set_debugging( Config::ValueOf('debugging', false) );
}
else {
// scan without DB connection
$Database = false;
}
// initialize and make default checks
$phpipam_agent = new phpipamAgent ($Database);
// set scan type - status update (update) or discover, must be provided via argv[1]
$phpipam_agent->set_scan_type ($argv[1]);
// execute
$phpipam_agent->execute ();
// update scan time
$phpipam_agent->update_agent_scantime ();
}
//catch any exceptions and report the problem
catch ( Exception $e ) {
print "--------------------\n";
print $e->getMessage()."\n";
print "--------------------\n";
// die
die();
}
?>