make.auswertungen.msql

来自「sifi-0.1.6.tar.gz 出自http://www.ifi.unizh」· MSQL 代码 · 共 79 行

MSQL
79
字号
#!/home/fwadmin/database/bin/litefunct fill_A(int $sock, char $table, char $varname){          echo("Filling up $table\n");          msqlQuery($sock, "delete FROM $table");          msqlQuery($sock, "select DISTINCT $varname FROM F_LOG");          $res = msqlStoreResult();          $row = msqlFetchRow($res);          while (#$row > 0)          {              $anz = msqlQuery($sock,"select $varname FROM F_LOG where $varname = '$row[0]'");              if (0 > msqlQuery($sock,"insert into $table (name,anz)                               values ('$row[0]',$anz)"))              {                  echo("insertERROR $row[0]:$anz\nTABLE: $table\n   $ERRMSG\n");              }              echo("$row[0]       $anz\n");              $row = msqlFetchRow($res);          }          msqlFreeResult($res);}funct update(int $sock, char $fromtable, char $varname, char $dest1, char $dest2){          msqlQuery($sock, "select name FROM $fromtable");          $res = msqlStoreResult();          $row = msqlFetchRow($res);          while (#$row > 0)          {              $name = gethostbyaddr($row[0]);              $help = split($name[0],".");              $dom = $help[#$help - 2] + "." + $help[#$help -1];              sleep(3);                            $anz =  msqlQuery($sock,"update F_LOG set $dest1='$name[0]', $dest2='$dom'                        where $varname='$row[0]'");               echo("$anz update $row[0] -> $name[0] -> $dom\n");              $row = msqlFetchRow($res);          }          msqlFreeResult($res);}/* -------------------------Hier beginnt das Hauptprogramm -------------*/       $sock = msqlConnect();        if ($sock < 0)        {                echo("connect Error : $ERRMSG\n");                exit(1);        }        if (msqlSelectDB($sock,"firewall") < 0)        {                echo("select Error : $ERRMSG\n");                exit(1);        }fill_A($sock, "A_SOURCEIP", "source_ip");fill_A($sock, "A_DESTIP", "destination_ip");update($sock, "A_SOURCEIP", "source_ip", "source_name", "source_dom");update($sock, "A_DESTIP", "destination_ip", "destination_name", "destination_dom");fill_A($sock, "A_SOURCEDOM", "source_dom");fill_A($sock, "A_SOURCENAME", "source_name");fill_A($sock, "A_SOURCENET", "source_net");fill_A($sock, "A_DESTNET", "destination_net");fill_A($sock, "A_DESTDOM", "destination_dom");fill_A($sock, "A_DESTNAME", "destination_name");fill_A($sock, "A_DESTPORT", "destination_port");fill_A($sock, "A_RULETYPE", "rule_type");fill_A($sock, "A_RULENUMBER", "rule_number");fill_A($sock, "A_ACTION", "action");fill_A($sock, "A_PROTOCOL", "protocol");

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?