From 262a91eb357e6b31cdf46a6500635a4e6a9c5cd4 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Thu, 18 Sep 2014 08:24:51 +0200 Subject: [PATCH] tor monitoring added --- web/Obj/brisk.phh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 2efb2ff..fe6d484 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -1053,6 +1053,12 @@ class Brisk return ($thiz); } + function tor_chk_postprocess($user_idx, $user_sess, $conn_ip, $is_auth, $is_tor) + { + log_cds(sprintf("user_idx: %d, user_sess: %s, conn_ip: %s, is_auth: %s, is_tor: %s", + $user_idx, $user_sess, $conn_ip, ($is_auth ? "YES" : "NO"), ($is_tor ? "YES" : "NO"))); + } + function ipclass_update($ip_out_s, $ip_in) { fprintf(STDERR, "N_IN: %d\n", count($ip_in)); @@ -1078,6 +1084,24 @@ class Brisk { fprintf(STDERR, "RELOAD STUFF (%d)(%d)\n", count($ban_list), count($black_list)); + if ($this->cds != NULL) { + $this->cds->cmd_cls_deregister_all(); + unset($this->cds); + $this->cds = NULL; + } + // create cds + $this->cds = new Curl_de_sac(); + + // create tor_chk_cls + $tor_chk_cls = new tor_chk_cmd_cls(); + + // registrer tor_chk_cls + printf("MAIN: Register 'tor_chk_cls'\n"); + if (($this->cds->cmd_cls_register($tor_chk_cls)) == FALSE) { + fprintf(STDERR, "MAIN: 'tor_chk_cls' registration failed\n"); + exit(1); + } + $this->ipclass_update("ban_list", $ban_list); $this->ipclass_update("black_list", $black_list); @@ -2258,6 +2282,10 @@ class Brisk } $idx = $ghost; + if ($this->cds->execute("tor_chk", $this, $ghost, $sess, $ip, $authenticate != FALSE) == FALSE) { + log_main("cds_execute failed"); + } + return ($this->user[$ghost]); } else if ($idx != -1 && $i == MAX_PLAYERS) { @@ -2357,7 +2385,7 @@ class Brisk log_main(sprintf("TROVATO LIBERO A [%d] sess [%s] name [%s] count [%d] name [%s] code [%s]", $idx, $sess, $name_new, count($this->user),$this->user[$real_idx]->name, $this->user[$real_idx]->code)); $ret = $this->user[$real_idx]; - if ($this->cds->execute("tor_chk", $this, $real_idx, $sess, $ip) == FALSE) { + if ($this->cds->execute("tor_chk", $this, $real_idx, $sess, $ip, $authenticate != FALSE) == FALSE) { log_main("cds_execute failed"); } -- 2.17.1