1 | #!/usr/bin/env php |
||||
2 | <?php |
||||
3 | |||||
4 | /* |
||||
5 | * LibreNMS |
||||
6 | * |
||||
7 | * This file is part of LibreNMS. |
||||
8 | * |
||||
9 | * @package LibreNMS |
||||
10 | * @subpackage discovery |
||||
11 | * @copyright (C) 2006 - 2012 Adam Armstrong |
||||
12 | */ |
||||
13 | |||||
14 | $init_modules = array(); |
||||
15 | require realpath(__DIR__ . '/..') . '/includes/init.php'; |
||||
16 | |||||
17 | include_once 'Net/IPv4.php'; |
||||
18 | |||||
19 | $handle = fopen('ips.txt', 'w'); |
||||
20 | |||||
21 | foreach (dbFetchRows('SELECT * FROM `ipv4_networks`') as $data) { |
||||
22 | $cidr = $data['ipv4_network']; |
||||
23 | list ($network, $bits) = explode('/', $cidr); |
||||
24 | if ($bits != '32' && $bits != '32' && $bits > '22') { |
||||
25 | $addr = Net_IPv4::parseAddress($cidr); |
||||
0 ignored issues
–
show
|
|||||
26 | $broadcast = $addr->broadcast; |
||||
27 | $ip = ip2long($network) + 1; |
||||
28 | $end = ip2long($broadcast); |
||||
29 | while ($ip < $end) { |
||||
30 | $ipdotted = long2ip($ip); |
||||
31 | if (dbFetchCell('SELECT COUNT(ipv4_address_id) FROM `ipv4_addresses` WHERE `ipv4_address` = ?', array($ipdotted)) == '0' && match_network($config['nets'], $ipdotted)) { |
||||
32 | fputs($handle, $ipdotted."\n"); |
||||
0 ignored issues
–
show
It seems like
$handle can also be of type false ; however, parameter $handle of fputs() does only seem to accept resource , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
33 | } |
||||
34 | |||||
35 | $ip++; |
||||
36 | } |
||||
37 | } |
||||
38 | } |
||||
39 | |||||
40 | fclose($handle); |
||||
41 | |||||
42 | shell_exec($config['fping'] . ' -t 100 -f ips.txt > ips-scanned.txt'); |
||||
43 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths