// Delete rows, iterating
if (DEBUG) {
    echo "Deleting current list from HBase\n";
}
try {
    while (true) {
        $row = $client->scannerGet($scanner);
        if (sizeof($row) == 0) {
            break;
        }
        if (DEBUG) {
            $values = $row[0]->columns;
            $ip = $values["rep:ip"]->value;
            echo "Deleting {$ip} from list {$listName}/{$listType}\n";
        }
        $client->deleteAllRow("hogzilla_reputation", $row[0]->row, array());
    }
    $client->scannerClose($scanner);
    // Iterate file
    while (($ip = fgets($fileHandle)) !== false) {
        // Parse
        preg_replace("/\r|\n/", "", $ip);
        $ip = trim($ip);
        // Create mutation
        $mutations = array();
        $dataIP = array('column' => "rep:ip", 'value' => $ip);
        $dataListName = array('column' => "rep:list", 'value' => $listName);
        $dataListType = array('column' => "rep:list_type", 'value' => $listType);
        $dataListDesc = array('column' => "rep:description", 'value' => "");
        $mutations[] = new Hbase\Mutation($dataIP);
        $mutations[] = new Hbase\Mutation($dataListName);
Esempio n. 2
0
     echo "Start row: {$startrow} \n";
 }
 $lastHBaseID = 0;
 // Get HBase pointer
 //$scanner = $client->scannerOpenWithStop("hogzilla_events",$startrow,"",
 $scanner = $client->scannerOpenWithStop("hogzilla_events", "", "", array("event:lower_ip", "event:upper_ip", "event:note", "event:signature_id", "event:lower_ip_str", "event:upper_ip_str", "event:ports", "event:title"), array());
 // Loop events to insert into MySQL/GrayLog
 while (true) {
     $row = $client->scannerGet($scanner);
     //if($lastHBaseID==0 and $startrow!=0) { $lastHBaseID=$startrow; continue; } /* dismiss the first */
     if (sizeof($row) == 0) {
         break;
     }
     saveEvent($row, $con, $cid++);
     $lastHBaseID = $row[0]->row;
     $client->deleteAllRow("hogzilla_events", $row[0]->row, array());
     if (DEBUG) {
         echo "Last HBaseID: {$lastHBaseID} \n";
     }
 }
 // Update last CID on MySQL, this counter will be used on last access
 if (MYSQL) {
     saveLastCID($sensorid, $cid, $con);
 }
 // Save last seen HBase event
 saveNextHBaseRow($lastHBaseID);
 // Close HBase scanner
 $client->scannerClose($scanner);
 /*
  * Add information about clustering
  *