Issues (1626)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

phpsysinfo/includes/os/class.BSDCommon.inc.php (10 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * BSDCommon Class
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI BSDCommon OS class
9
 * @author    Michael Cramer <[email protected]>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
12
 * @version   SVN: $Id: class.BSDCommon.inc.php 621 2012-07-29 18:49:04Z namiltd $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * BSDCommon class
17
 * get all the required information for BSD Like systems
18
 * no need to implement in every class the same methods
19
 *
20
 * @category  PHP
21
 * @package   PSI BSDCommon OS class
22
 * @author    Michael Cramer <[email protected]>
23
 * @copyright 2009 phpSysInfo
24
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
25
 * @version   Release: 3.0
26
 * @link      http://phpsysinfo.sourceforge.net
27
 */
28
abstract class BSDCommon extends OS
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /**
31
     * content of the syslog
32
     *
33
     * @var array
34
     */
35
    private $_dmesg = array();
36
37
    /**
38
     * regexp1 for cpu information out of the syslog
39
     *
40
     * @var string
41
     */
42
    private $_CPURegExp1 = "//";
43
44
    /**
45
     * regexp2 for cpu information out of the syslog
46
     *
47
     * @var string
48
     */
49
    private $_CPURegExp2 = "//";
50
51
    /**
52
     * regexp1 for scsi information out of the syslog
53
     *
54
     * @var string
55
     */
56
    private $_SCSIRegExp1 = "//";
57
58
    /**
59
     * regexp2 for scsi information out of the syslog
60
     *
61
     * @var string
62
     */
63
    private $_SCSIRegExp2 = "//";
64
65
    /**
66
     * regexp1 for pci information out of the syslog
67
     *
68
     * @var string
69
     */
70
    private $_PCIRegExp1 = "//";
71
72
    /**
73
     * regexp1 for pci information out of the syslog
74
     *
75
     * @var string
76
     */
77
    private $_PCIRegExp2 = "//";
78
79
    /**
80
     * call parent constructor
81
     */
82
    public function __construct()
83
    {
84
        parent::__construct();
85
    }
86
87
    /**
88
     * setter for cpuregexp1
89
     *
90
     * @param string $value value to set
91
     *
92
     * @return void
93
     */
94
    protected function setCPURegExp1($value)
95
    {
96
        $this->_CPURegExp1 = $value;
97
    }
98
99
    /**
100
     * setter for cpuregexp2
101
     *
102
     * @param string $value value to set
103
     *
104
     * @return void
105
     */
106
    protected function setCPURegExp2($value)
107
    {
108
        $this->_CPURegExp2 = $value;
109
    }
110
111
    /**
112
     * setter for scsiregexp1
113
     *
114
     * @param string $value value to set
115
     *
116
     * @return void
117
     */
118
    protected function setSCSIRegExp1($value)
119
    {
120
        $this->_SCSIRegExp1 = $value;
121
    }
122
123
    /**
124
     * setter for scsiregexp2
125
     *
126
     * @param string $value value to set
127
     *
128
     * @return void
129
     */
130
    protected function setSCSIRegExp2($value)
131
    {
132
        $this->_SCSIRegExp2 = $value;
133
    }
134
135
    /**
136
     * setter for pciregexp1
137
     *
138
     * @param string $value value to set
139
     *
140
     * @return void
141
     */
142
    protected function setPCIRegExp1($value)
143
    {
144
        $this->_PCIRegExp1 = $value;
145
    }
146
147
    /**
148
     * setter for pciregexp2
149
     *
150
     * @param string $value value to set
151
     *
152
     * @return void
153
     */
154
    protected function setPCIRegExp2($value)
155
    {
156
        $this->_PCIRegExp2 = $value;
157
    }
158
159
    /**
160
     * read /var/run/dmesg.boot, but only if we haven't already
161
     *
162
     * @return array
163
     */
164
    protected function readdmesg()
165
    {
166
        if (count($this->_dmesg) === 0) {
167
            if (PSI_OS != "Darwin") {
168
                if (CommonFunctions::rfts('/var/run/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/log/dmesg.boot', $buf, 0, 4096, false) || CommonFunctions::rfts('/var/run/dmesg.boot', $buf)) {  // Once again but with debug
169
                    $parts = preg_split("/rebooting|Uptime/", $buf, -1, PREG_SPLIT_NO_EMPTY);
170
                    $this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
171
                }
172
            }
173
        }
174
175
        return $this->_dmesg;
176
    }
177
178
    /**
179
     * get a value from sysctl command
180
     *
181
     * @param string $key key for the value to get
182
     *
183
     * @return string
184
     */
185
    protected function grabkey($key)
186
    {
187
        $buf = "";
188
        if (CommonFunctions::executeProgram('sysctl', "-n $key", $buf, PSI_DEBUG)) {
189
            return $buf;
190
        } else {
191
            return '';
192
        }
193
    }
194
195
    /**
196
     * Virtual Host Name
197
     *
198
     * @return void
199
     */
200 View Code Duplication
    protected function hostname()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
201
    {
202
        if (PSI_USE_VHOST === true) {
203
            $this->sys->setHostname(getenv('SERVER_NAME'));
204
        } else {
205
            if (CommonFunctions::executeProgram('hostname', '', $buf, PSI_DEBUG)) {
206
                $this->sys->setHostname($buf);
207
            }
208
        }
209
    }
210
211
    /**
212
     * Kernel Version
213
     *
214
     * @return void
215
     */
216
    protected function kernel()
217
    {
218
        $s = $this->grabkey('kern.version');
219
        $a = preg_split('/:/', $s);
220
        if (isset($a[2])) {
221
            $this->sys->setKernel($a[0].$a[1].':'.$a[2]);
222
        } else {
223
            $this->sys->setKernel($s);
224
        }
225
    }
226
227
    /**
228
     * Processor Load
229
     * optionally create a loadbar
230
     *
231
     * @return void
232
     */
233
    protected function loadavg()
234
    {
235
        $s = $this->grabkey('vm.loadavg');
236
        $s = preg_replace('/{ /', '', $s);
237
        $s = preg_replace('/ }/', '', $s);
238
        $this->sys->setLoad($s);
239
        if (PSI_LOAD_BAR && (PSI_OS != "Darwin")) {
240
            if ($fd = $this->grabkey('kern.cp_time')) {
241
                // Find out the CPU load
242
                // user + sys = load
243
                // total = total
244
                preg_match($this->_CPURegExp2, $fd, $res);
245
                $load = $res[2] + $res[3] + $res[4]; // cpu.user + cpu.sys
246
                $total = $res[2] + $res[3] + $res[4] + $res[5]; // cpu.total
247
                // we need a second value, wait 1 second befor getting (< 1 second no good value will occour)
248
                sleep(1);
249
                $fd = $this->grabkey('kern.cp_time');
250
                preg_match($this->_CPURegExp2, $fd, $res);
251
                $load2 = $res[2] + $res[3] + $res[4];
252
                $total2 = $res[2] + $res[3] + $res[4] + $res[5];
253
                $this->sys->setLoadPercent((100 * ($load2 - $load)) / ($total2 - $total));
254
            }
255
        }
256
    }
257
258
    /**
259
     * CPU information
260
     *
261
     * @return void
262
     */
263
    protected function cpuinfo()
264
    {
265
        $dev = new CpuDevice();
266
267
        if (PSI_OS == "NetBSD") {
268
            if ($model = $this->grabkey('machdep.cpu_brand')) {
269
               $dev->setModel($model);
270
            }
271
            if ($cpuspeed = $this->grabkey('machdep.tsc_freq')) {
272
               $dev->setCpuSpeed(round($cpuspeed / 1000000));
273
            }
274
        }
275
276
        if ($dev->getModel() === "") {
277
            $dev->setModel($this->grabkey('hw.model'));
278
        }
279
        $notwas = true;
280
        foreach ($this->readdmesg() as $line) {
281
            if ($notwas) {
282
               if (preg_match($this->_CPURegExp1, $line, $ar_buf)) {
283
                    if ($dev->getCpuSpeed() === 0) {
284
                        $dev->setCpuSpeed(round($ar_buf[2]));
285
                    }
286
                    $notwas = false;
287
                }
288
            } else {
289
                if (preg_match("/ Origin| Features/", $line, $ar_buf)) {
290
                    if (preg_match("/ Features2[ ]*=.*<(.*)>/", $line, $ar_buf)) {
291
                        $feats = preg_split("/,/", strtolower(trim($ar_buf[1])), -1, PREG_SPLIT_NO_EMPTY);
292
                        foreach ($feats as $feat) {
293
                            if (($feat=="vmx") || ($feat=="svm")) {
294
                                $dev->setVirt($feat);
295
                                break 2;
296
                            }
297
                        }
298
                        break;
299
                    }
300
                } else break;
301
            }
302
        }
303
304
        $ncpu = $this->grabkey('hw.ncpu');
305 View Code Duplication
        if (is_null($ncpu) || (trim($ncpu) == "") || (!($ncpu >= 1)))
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
306
            $ncpu = 1;
307
        for ($ncpu ; $ncpu > 0 ; $ncpu--) {
308
            $this->sys->setCpus($dev);
0 ignored issues
show
$dev is of type object<CpuDevice>, but the function expects a object<Cpu>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
309
        }
310
    }
311
312
    /**
313
     * SCSI devices
314
     * get the scsi device information out of dmesg
315
     *
316
     * @return void
317
     */
318
    protected function scsi()
319
    {
320
        foreach ($this->readdmesg() as $line) {
321
            if (preg_match($this->_SCSIRegExp1, $line, $ar_buf)) {
322
                $dev = new HWDevice();
323
                $dev->setName($ar_buf[1].": ".$ar_buf[2]);
324
                $this->sys->setScsiDevices($dev);
325 View Code Duplication
            } elseif (preg_match($this->_SCSIRegExp2, $line, $ar_buf)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
326
                /* duplication security */
327
                $notwas = true;
328
                foreach ($this->sys->getScsiDevices() as $finddev) {
329
                    if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
330
                        $finddev->setCapacity($ar_buf[2] * 2048 * 1.049);
331
                        $notwas = false;
332
                        break;
333
                    }
334
                }
335
                if ($notwas) {
336
                    $dev = new HWDevice();
337
                    $dev->setName($ar_buf[1]);
338
                    $dev->setCapacity($ar_buf[2] * 2048 * 1.049);
339
                    $this->sys->setScsiDevices($dev);
340
                }
341
            }
342
        }
343
        /* cleaning */
344 View Code Duplication
        foreach ($this->sys->getScsiDevices() as $finddev) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
345
                    if (strpos($finddev->getName(), ': ') !== false)
346
                        $finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
347
        }
348
    }
349
350
    /**
351
     * parsing the output of pciconf command
352
     *
353
     * @return Array
354
     */
355
    protected function pciconf()
356
    {
357
        $arrResults = array();
358
        $intS = 0;
359
        if (CommonFunctions::executeProgram("pciconf", "-lv", $strBuf, PSI_DEBUG)) {
360
            $arrTemp = array();
361
            $arrBlocks = preg_split("/\n\S/", $strBuf, -1, PREG_SPLIT_NO_EMPTY);
362
            foreach ($arrBlocks as $strBlock) {
363
                $arrLines = preg_split("/\n/", $strBlock, -1, PREG_SPLIT_NO_EMPTY);
364
                $vend = null;
365
                foreach ($arrLines as $strLine) {
366
                    if (preg_match("/\sclass=0x([a-fA-F0-9]{4})[a-fA-F0-9]{2}\s.*\schip=0x([a-fA-F0-9]{4})([a-fA-F0-9]{4})\s/", $strLine, $arrParts)) {
367
                        $arrTemp[$intS] = 'Class '.$arrParts[1].': Device '.$arrParts[3].':'.$arrParts[2];
368
                        $vend = '';
369
                    } elseif (preg_match("/(.*) = '(.*)'/", $strLine, $arrParts)) {
370
                        if (trim($arrParts[1]) == "vendor") {
371
                            $vend = trim($arrParts[2]);
372
                        } elseif (trim($arrParts[1]) == "device") {
373
                            if (($vend !== null) && ($vend !== '')) {
374
                                $arrTemp[$intS] = $vend." - ".trim($arrParts[2]);
375
                            } else {
376
                                $arrTemp[$intS] = trim($arrParts[2]);
377
                                $vend = '';
378
                            }
379
                        }
380
                    }
381
                }
382
                if ($vend !== null) {
383
                    $intS++;
384
                }
385
            }
386
            foreach ($arrTemp as $name) {
387
                $dev = new HWDevice();
388
                $dev->setName($name);
389
                $arrResults[] = $dev;
390
            }
391
        }
392
393
        return $arrResults;
394
    }
395
396
    /**
397
     * PCI devices
398
     * get the pci device information out of dmesg
399
     *
400
     * @return void
401
     */
402
    protected function pci()
403
    {
404
        if ((!$results = Parser::lspci(false)) && (!$results = $this->pciconf())) {
405
            foreach ($this->readdmesg() as $line) {
406
                if (preg_match($this->_PCIRegExp1, $line, $ar_buf)) {
407
                    $dev = new HWDevice();
408
                    $dev->setName($ar_buf[1].": ".$ar_buf[2]);
409
                    $results[] = $dev;
410
                } elseif (preg_match($this->_PCIRegExp2, $line, $ar_buf)) {
411
                    $dev = new HWDevice();
412
                    $dev->setName($ar_buf[1].": ".$ar_buf[2]);
413
                    $results[] = $dev;
414
                }
415
            }
416
        }
417
        foreach ($results as $dev) {
418
            $this->sys->setPciDevices($dev);
419
        }
420
    }
421
422
    /**
423
     * IDE devices
424
     * get the ide device information out of dmesg
425
     *
426
     * @return void
427
     */
428
    protected function ide()
429
    {
430
        foreach ($this->readdmesg() as $line) {
431
            if (preg_match('/^(ad[0-9]+): (.*)MB <(.*)> (.*) (.*)/', $line, $ar_buf)) {
432
                $dev = new HWDevice();
433
                $dev->setName($ar_buf[1].": ".$ar_buf[3]);
434
                $dev->setCapacity($ar_buf[2] * 1024);
435
                $this->sys->setIdeDevices($dev);
436
            } elseif (preg_match('/^(acd[0-9]+): (.*) <(.*)> (.*)/', $line, $ar_buf)) {
437
                $dev = new HWDevice();
438
                $dev->setName($ar_buf[1].": ".$ar_buf[3]);
439
                $this->sys->setIdeDevices($dev);
440
            } elseif (preg_match('/^(ada[0-9]+): <(.*)> (.*)/', $line, $ar_buf)) {
441
                $dev = new HWDevice();
442
                $dev->setName($ar_buf[1].": ".$ar_buf[2]);
443
                $this->sys->setIdeDevices($dev);
444 View Code Duplication
            } elseif (preg_match('/^(ada[0-9]+): (.*)MB \((.*)\)/', $line, $ar_buf)) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
445
                /* duplication security */
446
                $notwas = true;
447
                foreach ($this->sys->getIdeDevices() as $finddev) {
448
                    if ($notwas && (substr($finddev->getName(), 0, strpos($finddev->getName(), ': ')) == $ar_buf[1])) {
449
                        $finddev->setCapacity($ar_buf[2] * 1024);
450
                        $notwas = false;
451
                        break;
452
                    }
453
                }
454
                if ($notwas) {
455
                    $dev = new HWDevice();
456
                    $dev->setName($ar_buf[1]);
457
                    $dev->setCapacity($ar_buf[2] * 1024);
458
                    $this->sys->setIdeDevices($dev);
459
                }
460
            }
461
        }
462
        /* cleaning */
463 View Code Duplication
        foreach ($this->sys->getIdeDevices() as $finddev) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
464
                    if (strpos($finddev->getName(), ': ') !== false)
465
                        $finddev->setName(substr(strstr($finddev->getName(), ': '), 2));
466
        }
467
    }
468
469
    /**
470
     * Physical memory information and Swap Space information
471
     *
472
     * @return void
473
     */
474
    protected function memory()
475
    {
476
        if (PSI_OS == 'FreeBSD' || PSI_OS == 'OpenBSD') {
477
            // vmstat on fbsd 4.4 or greater outputs kbytes not hw.pagesize
478
            // I should probably add some version checking here, but for now
479
            // we only support fbsd 4.4
480
            $pagesize = 1024;
481
        } else {
482
            $pagesize = $this->grabkey('hw.pagesize');
483
        }
484
        if (CommonFunctions::executeProgram('vmstat', '', $vmstat, PSI_DEBUG)) {
485
            $lines = preg_split("/\n/", $vmstat, -1, PREG_SPLIT_NO_EMPTY);
486
            $ar_buf = preg_split("/\s+/", trim($lines[2]), 19);
487
            if (PSI_OS == 'NetBSD' || PSI_OS == 'DragonFly') {
488
                $this->sys->setMemFree($ar_buf[4] * 1024);
489
            } else {
490
                $this->sys->setMemFree($ar_buf[4] * $pagesize);
491
            }
492
            $this->sys->setMemTotal($this->grabkey('hw.physmem'));
493
            $this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree());
494
495
            if (((PSI_OS == 'OpenBSD' || PSI_OS == 'NetBSD') && CommonFunctions::executeProgram('swapctl', '-l -k', $swapstat, PSI_DEBUG)) || CommonFunctions::executeProgram('swapinfo', '-k', $swapstat, PSI_DEBUG)) {
496
                $lines = preg_split("/\n/", $swapstat, -1, PREG_SPLIT_NO_EMPTY);
497
                foreach ($lines as $line) {
498
                    $ar_buf = preg_split("/\s+/", $line, 6);
499
                    if (($ar_buf[0] != 'Total') && ($ar_buf[0] != 'Device')) {
500
                        $dev = new DiskDevice();
501
                        $dev->setMountPoint($ar_buf[0]);
502
                        $dev->setName("SWAP");
503
                        $dev->setFsType('swap');
504
                        $dev->setTotal($ar_buf[1] * 1024);
505
                        $dev->setUsed($ar_buf[2] * 1024);
506
                        $dev->setFree($dev->getTotal() - $dev->getUsed());
507
                        $this->sys->setSwapDevices($dev);
508
                    }
509
                }
510
            }
511
        }
512
    }
513
514
    /**
515
     * USB devices
516
     * get the ide device information out of dmesg
517
     *
518
     * @return void
519
     */
520 View Code Duplication
    protected function usb()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
521
    {
522
        foreach ($this->readdmesg() as $line) {
523
//            if (preg_match('/^(ugen[0-9\.]+): <(.*)> (.*) (.*)/', $line, $ar_buf)) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
524
//                    $dev->setName($ar_buf[1].": ".$ar_buf[2]);
525
            if (preg_match('/^(u[a-z]+[0-9]+): <([^,]*)(.*)> on (usbus[0-9]+)/', $line, $ar_buf)) {
526
                    $dev = new HWDevice();
527
                    $dev->setName($ar_buf[2]);
528
                    $this->sys->setUSBDevices($dev);
529
            }
530
        }
531
    }
532
533
    /**
534
     * filesystem information
535
     *
536
     * @return void
537
     */
538
    protected function filesystems()
539
    {
540
        $arrResult = Parser::df();
541
        foreach ($arrResult as $dev) {
542
            $this->sys->setDiskDevices($dev);
543
        }
544
    }
545
546
    /**
547
     * Distribution
548
     *
549
     * @return void
550
     */
551
    protected function distro()
552
    {
553
        if (CommonFunctions::executeProgram('uname', '-s', $result, PSI_DEBUG)) {
554
            $this->sys->setDistribution($result);
555
        }
556
    }
557
558
    /**
559
     * get the information
560
     *
561
     * @see PSI_Interface_OS::build()
562
     *
563
     * @return Void
564
     */
565
    public function build()
566
    {
567
        $this->distro();
568
        $this->memory();
569
        $this->ide();
570
        $this->pci();
571
        $this->cpuinfo();
572
        $this->filesystems();
573
        $this->kernel();
574
        $this->loadavg();
575
        $this->hostname();
576
        $this->scsi();
577
        $this->usb();
578
        $this->_users();
579
    }
580
}
581