foist
[fingerprinter.git] / include / FingerPrinter.php
1 <?php
2
3 require_once('Config.php');
4 require_once('syslog.php');
5
6 class FingerPrinter extends Config {
7
8         protected $_data;
9         protected $_syslog;
10
11         function __construct() {
12                 $this->_data = "";
13                 $this->_syslog = new Syslog();
14
15                 $this->_syslog->SetFacility($this->facility);
16                 $this->_syslog->SetSeverity($this->severity);
17                 $this->_syslog->SetHostname($this->hostname);
18                 $this->_syslog->SetFqdn($this->hostname);
19                 $this->_syslog->SetServer($this->host);
20                 $this->_syslog->SetPort($this->port);
21                 $this->_syslog->SetIpFrom($this->ipaddress);
22                 $this->_syslog->SetProcess($this->process);
23         }
24
25         public function ProcessRequest() {
26
27                 $this->_data = "SourceAddress:" . $_SERVER["REMOTE_ADDR"];
28
29                 foreach($this->params as $param) {
30                         $this->_data = implode(
31                                 ",", 
32                                 Array(
33                                         $this->_data,
34                                         $param . ':' . $this->_GenerateHash($_REQUEST[$param])
35                                 )
36                         );
37                 }
38                 $this->_SendData();
39         }
40
41         private function _GenerateHash($input) {
42                 return sha1($input);
43         }
44
45         public function getData() {
46                 return $this->_data;
47         }
48
49         private function _SendData() {
50                 if ($this->debug) {
51                         echo "Debug:".$this->_data;
52                 }
53                 $this->_syslog->SetContent($this->_data);
54                 $this->_syslog->Send();
55
56         }
57 }
58
59 ?>