コード例 #1
0
function handle_client($ssock, $csock)
{
    global $__server_listening;
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pid = pcntl_fork();
    events("Fork pid {$pid}", __FUNCTION__, __LINE__);
    if ($pid > 0) {
        $__PROCESS_NUM = $__PROCESS_NUM + 1;
        @file_put_contents($pidfile, @getmypid());
    }
    if ($pid == -1) {
        events("fork failure!", __FUNCTION__, __LINE__);
        die;
    }
    if ($pid == 0) {
        /* child process */
        $__server_listening = false;
        events("child process -> socket close() -> interact(); ", __FUNCTION__, __LINE__);
        socket_close($ssock);
        interact($csock);
        events("Closing connection", __FUNCTION__, __LINE__);
        socket_close($csock);
    } else {
        socket_close($csock);
    }
}
コード例 #2
0
<?php

/*
*投票模块
*writer : ly
*/
header('content-type:text/json;charset=utf-8');
require_once '../../../common/php/dbaccess.php';
require_once '../../../common/php/uploadFiles.php';
session_start();
$db = new DB();
// 实例化
$first = "wx_";
$param = $_REQUEST;
if (!empty($param['id']) && !empty($param['user']) && !empty($param['voteId'])) {
    interact($param['user'], $param['voteId'], $param['id']);
}
if (!empty($param['voteSum'])) {
    voteSum($param['id']);
}
if (!empty($param['voteProjectSum'])) {
    voteProjectSum($param['id']);
}
//投票项统计
function voteSum($id)
{
    global $db;
    global $first;
    $d = $db->execsql("select id from " . $first . "vote_interact where optionId='" . $id . "';");
    echo count($d);
}
コード例 #3
0
ファイル: script_crx1.php プロジェクト: vgartner/gps-tracker
/**
* Handle a new client connection
*/
function handle_client($ssock, $csock)
{
    global $__server_listening;
    global $fh;
    global $firstInteraction;
    global $remip;
    global $remport;
    $pid = pcntl_fork();
    if ($pid == -1) {
        /* fork failed */
        //printLog($fh, "fork failure!");
        die;
    } elseif ($pid == 0) {
        /* child process */
        $__server_listening = false;
        socket_getpeername($csock, $remip, $remport);
        //printLog($fh, date("d-m-y h:i:sa") . " Connection from $remip:$remport");
        $firstInteraction = true;
        socket_close($ssock);
        interact($csock);
        socket_close($csock);
        printLog($fh, date("d-m-y h:i:sa") . " Connection to {$remip}:{$remport} closed");
        fecharArquivoLog();
    } else {
        socket_close($csock);
    }
}
コード例 #4
0
function handle_client($ssock, $csock){
    GLOBAL $__server_listening;

    $pid = pcntl_fork();
	events("Fork pid $pid",__FUNCTION__,__LINE__);
	if(!isset($GLOBALS["DebugArticaFilter"])){
		$sock=new sockets();
		$GLOBALS["DebugArticaFilter"]=$sock->GET_INFO("DebugArticaFilter");
		if($GLOBALS["DebugArticaFilter"]==null){$GLOBALS["DebugArticaFilter"]=0;}
	}
			
    if ($pid == -1){
        /* fork failed */
        events("fork failure!",__FUNCTION__,__LINE__);
        die;
    }elseif ($pid == 0){
        /* child process */
        $__server_listening = false;
        socket_close($ssock);
        interact($csock);
        events("Closing connection",__FUNCTION__,__LINE__);
        socket_close($csock);
    }else{
        socket_close($csock);
    }
} 
コード例 #5
0
/**
 * Handle a new client connection
 */
function handle_client($ssock, $csock)
{
    global $__server_listening;
    global $fh;
    global $firstInteraction;
    global $remip;
    global $remport;
    $pid = pcntl_fork();
    if ($pid == -1) {
        /* fork failed */
        //printLog($fh, "fork failure!");
        die;
    } elseif ($pid == 0) {
        /* child process */
        $__server_listening = false;
        socket_getpeername($csock, $remip, $remport);
        //printLog($fh, date("d-m-y h:i:sa") . " Connection from $remip:$remport");
        $firstInteraction = true;
        // $send_cmd = "#88#DCST##\r\n";
        // socket_send($csock, $send_cmd, strlen($send_cmd), 0);
        // error_log('ENVIOU O COMANDO DCST');
        // error_log('SOCKET: '.$csock);
        // error_log('SEND CMD: '.$send_cmd);
        // $send_cmd = "#88#DCCM#6660000#5D##\r\n";
        // socket_send($csock, $send_cmd, strlen($send_cmd), 0);
        // error_log('ENVIOU O COMANDO DCCM 666');
        socket_close($ssock);
        interact($csock);
        socket_close($csock);
        printLog($fh, date("d-m-y h:i:sa") . " Connection to {$remip}:{$remport} closed");
        fecharArquivoLog();
    } else {
        socket_close($csock);
    }
}
コード例 #6
0
            while (($line = fgets($handle)) !== false) {
                // process the line read.
                $line_number++;
                $patterns = array("source=base64_decode", "eval.*base64_decode", "POST.*execgate", "touch\\(\"wp-optionstmp.php\"", "file_put_contents.*wp-options", "touch.*wp-options\\.php", "code_inject_sape", "xmlrpc.php\".*mktime\\(", "jquery.php\".*mktime\\(", "exec\\(\"find\\ ", "exec\\(\\'find\\ ", "assert\\((\"|\\')e(\"|\\')\\.(\"|\\')v(\"|\\')", "\\(gzinflate\\(str_rot13\\(base64_decode", "preg_replace\\((\"|\\')\\/\\.\\*\\/e(\"|\\')\\,(\"|\\')", "\\b\\\\x61\\\\x73\\\\x65\\\\x36\\\\x34\\\\x5f\\\\x64\\\\x65\\\\x63\\\\x6f\\\\x64\\\\x65", "\\\\x65\\\\x76\\\\x61\\\\x6C\\\\x28\\\\x67\\\\x7A\\\\x69\\\\x6E\\\\x66\\\\x6C\\\\x61\\\\x74\\\\x65\\\\x28\\\\x62\\\\x61\\\\x73\\\\x65\\\\x36\\\\x34\\\\x5F\\\\x64\\\\x65\\\\x63\\\\x6F\\\\x64\\\\x65\\\\x28");
                $regex = '/(' . implode('|', $patterns) . ')/i';
                if (preg_match($regex, $line, $matches)) {
                    interact($line, $path, $filename, $line_number, $matches);
                }
                preg_match_all('/(\'[a-z0-9]\')\\=>(\'[a-z0-9]\')/i', $line, $foo) . "\n";
                //if($foo[1] == $foo[2]) {
                if (isset($foo[1][0])) {
                    if ($foo[1][0] != $foo[2][0]) {
                        if (count($foo[1]) > 5) {
                            //print_r($foo);
                            print "Detected ROT13 Suspect\n" . "instances: " . count($foo[1]) . "\n";
                            interact($line, $path, $filename, $line_number, null);
                        }
                    }
                }
            }
            fclose($handle);
        } else {
            // error opening the file.
            print "OPEN FAIL: {$path}/{$filename}\n\n";
        }
    }
}
print "\n";
$time_end = microtime(true);
$execution_time = ($time_end - $time_start) / 60;
$msg = 'Total Execution Time:' . $execution_time . ' Mins';
コード例 #7
0
*投票模块
*writer : ly
*/
header('content-type:text/json;charset=utf-8');
require_once '../../../common/php/dbaccess.php';
require_once '../../../common/php/uploadFiles.php';
// session_start();
// $openId=$_SESSION['openid'];
$db = new DB();
// 实例化
$first = "wx_";
$param = $_GET;
// $param['user']
$openId = $param['openid'];
if (!empty($param['id']) && !empty($param['openid']) && !empty($param['voteId'])) {
    interact($openId, $param['voteId'], $param['id']);
}
if (!empty($param['voteSum'])) {
    voteSum($param['id']);
}
if ($openId != "") {
    if (!empty($param['voteProjectSum'])) {
        voteProjectSum($param['id']);
    }
}
//投票项统计
function voteSum($id)
{
    global $db;
    global $first;
    $d = $db->execsql("select id from " . $first . "vote_interact where optionId='" . $id . "';");
コード例 #8
0
/**
 * Handle a new client connection
 */
function handle_client($ssock, $csock)
{
    global $__server_listening;
    $pid = pcntl_fork();
    if ($pid == -1) {
        /* fork failed */
        echo "fork failure!\n";
        die;
    } elseif ($pid == 0) {
        /* child process */
        $__server_listening = false;
        socket_close($ssock);
        interact($csock);
        socket_close($csock);
    } else {
        socket_close($csock);
    }
}