From 4bbe4c7c65184638375470502a7e0c183c255acc Mon Sep 17 00:00:00 2001 From: Tom Homer Date: Sat, 16 Feb 2019 09:40:06 -0500 Subject: [PATCH] Removed Spam Link Verification Module (SLV) Removed Spam Link Verification Module (SLV) from Spam-X due to it being shutdown. For issue #926 --- plugins/spamx/SLV.Examine.class.php | 65 ------- plugins/spamx/SLVbase.class.php | 194 --------------------- plugins/spamx/SLVreport.Action.class.php | 67 ------- plugins/spamx/SLVwhitelist.Admin.class.php | 38 ---- public_html/docs/english/spamx.html | 36 ---- public_html/docs/japanese/spamx.html | 24 --- 6 files changed, 424 deletions(-) delete mode 100644 plugins/spamx/SLV.Examine.class.php delete mode 100644 plugins/spamx/SLVbase.class.php delete mode 100644 plugins/spamx/SLVreport.Action.class.php delete mode 100644 plugins/spamx/SLVwhitelist.Admin.class.php diff --git a/plugins/spamx/SLV.Examine.class.php b/plugins/spamx/SLV.Examine.class.php deleted file mode 100644 index eed542648..000000000 --- a/plugins/spamx/SLV.Examine.class.php +++ /dev/null @@ -1,65 +0,0 @@ -getUid(); - - $slv = new SLVbase(); - if ($slv->CheckForSpam($comment)) { - $answer = PLG_SPAM_FOUND; - SPAMX_log($LANG_SX00['foundspam'] . 'Spam Link Verification (SLV)' . - $LANG_SX00['foundspam2'] . $uid . - $LANG_SX00['foundspam3'] . $_SERVER['REMOTE_ADDR'] - ); - } - - // tell the Action module that we've already been triggered - $GLOBALS['slv_triggered'] = true; - - return $answer; - } -} diff --git a/plugins/spamx/SLVbase.class.php b/plugins/spamx/SLVbase.class.php deleted file mode 100644 index a840e8763..000000000 --- a/plugins/spamx/SLVbase.class.php +++ /dev/null @@ -1,194 +0,0 @@ -_debug = false; - $this->_verbose = false; - } - - /** - * Check for spam links - * - * @param string $post post to check for spam - * @return boolean true = spam found, false = no spam - * Note: Also returns 'false' in case of problems communicating with SLV. - * Error messages are logged in Geeklog's error.log - */ - public function CheckForSpam($post) - { - global $_SPX_CONF; - - $retval = false; - - if (empty($post)) { - return $retval; - } - - $links = $this->prepareLinks($post); - if (empty($links)) { - return $retval; - } - - if (!isset($_SPX_CONF['timeout'])) { - $_SPX_CONF['timeout'] = 5; // seconds - } - - if ($this->_verbose) { - SPAMX_log("Sending to SLV: $links"); - } - - $params = array(new XML_RPC_Value($links, 'string')); - $msg = new XML_RPC_Message('slv', $params); - $cli = new XML_RPC_Client('/slv.php', 'http://www.linksleeve.org'); - - if ($this->_debug) { - $cli->setDebug(1); - } - - $resp = $cli->send($msg, $_SPX_CONF['timeout']); - if (!$resp) { - COM_errorLog('Error communicating with SLV: ' . $cli->getErrorString() - . '; Message was ' . $msg->serialize()); - } else if ($resp->faultCode()) { - COM_errorLog('Error communicating with SLV. Fault code: ' - . $resp->faultCode() . ', Fault reason: ' - . $resp->faultString() . '; Message was ' - . $msg->serialize()); - } else { - $val = $resp->value(); - // note that SLV returns '1' for acceptable posts and '0' for spam - if ($val->scalarval() != '1') { - $retval = true; - SPAMX_log("SLV: spam detected"); - } else if ($this->_verbose) { - SPAMX_log("SLV: no spam detected"); - } - } - - return $retval; - } - - /** - * Check whitelist - * Check against our whitelist of sites not to report to SLV. Note that - * URLs starting with $_CONF['site_url'] have already been removed earlier. - * - * @param array &$links array of URLs from a post - * @return void ($links is passed by reference and modified in place) - */ - public function checkWhitelist(&$links) - { - global $_TABLES; - - $timestamp = DB_escapeString(date('Y-m-d H:i:s')); - - $result = DB_query("SELECT value FROM {$_TABLES['spamx']} WHERE name='SLVwhitelist'", 1); - $nrows = DB_numRows($result); - - for ($i = 0; $i < $nrows; $i++) { - $A = DB_fetchArray($result); - $val = $A['value']; - $pattern = '#' . preg_quote($val, '#') . '#i'; - - foreach ($links as $key => $link) { - if (!empty($link)) { - if (preg_match($pattern, $link)) { - $links[$key] = ''; - DB_query("UPDATE {$_TABLES['spamx']} SET counter = counter + 1, regdate = '$timestamp' WHERE name='SLVwhitelist' AND value='" . DB_escapeString($A['value']) . "'", 1); - } - } - } - } - } - - /** - * Extract links - * Extracts all the links from a post; expects HTML links, i.e. tags - * - * @param string $comment The post to check - * @return array All the URLs in the post - */ - public function getLinks($comment) - { - global $_CONF; - - $links = array(); - - preg_match_all("|]*href=[\"']([^\"']*)[\"'][^>]*>(.*?)|i", $comment, $matches); - for ($i = 0; $i < count($matches[0]); $i++) { - $url = $matches[1][$i]; - if (empty($_CONF['site_url']) || stripos($url, $_CONF['site_url']) !== 0) { - $links[] = $url; - } - } - - return $links; - } - - /** - * Extract only the links from the post - * SLV has a problem with non-ASCII character sets, so we feed it the URLs - * only. We also remove all URLs containing our site's URL. - * Since we don't know if the post is in HTML or plain ASCII, we run it - * through getLinks() twice. - * - * @param string $comment The post to check - * @return string All the URLs in the post, sep. by line feeds - */ - public function prepareLinks($comment) - { - $linkList = ''; - - // some spam posts have extra backslashes - $comment = stripslashes($comment); - - // some spammers have yet to realize that we're not supporting BBcode - // but since we want the URLs, convert it here ... - $comment = preg_replace('/\[url=([^\]]*)\]/i', '', $comment); - $comment = str_ireplace('[/url]', '', $comment); - - // get all links from tags - $links = $this->getLinks($comment); - - // strip all HTML, then get all the plain text links - $comment = COM_makeClickableLinks(GLText::stripTags($comment)); - $links += $this->getLinks($comment); - - if (count($links) > 0) { - $this->checkWhitelist($links); - $linkList = implode("\n", $links); - } - - return trim($linkList); - } -} diff --git a/plugins/spamx/SLVreport.Action.class.php b/plugins/spamx/SLVreport.Action.class.php deleted file mode 100644 index 79aab0c8b..000000000 --- a/plugins/spamx/SLVreport.Action.class.php +++ /dev/null @@ -1,67 +0,0 @@ -actionCode = PLG_SPAM_ACTION_DELETE; - } - - /** - * Here we do the work - * - * @param string $comment - * @param string $permanentLink (since GL 2.2.0) - * @param string $commentType (since GL 2.2.0) - * @param string $commentAuthor (since GL 2.2.0) - * @param string $commentAuthorEmail (since GL 2.2.0) - * @param string $commentAuthorURL (since GL 2.2.0) - * @return int either PLG_SPAM_NOT_FOUND, PLG_SPAM_FOUND or PLG_SPAM_UNSURE - * @note As for valid value for $commentType, see system/classes/Akismet.php - */ - public function execute($comment, $permanentLink = null, $commentType = Geeklog\Akismet::COMMENT_TYPE_COMMENT, - $commentAuthor = null, $commentAuthorEmail = null, $commentAuthorURL = null) - { - $this->result = PLG_SPAM_ACTION_DELETE; - - if (isset($GLOBALS['slv_triggered']) && $GLOBALS['slv_triggered']) { - // the Examine class already reported these to SLV - return PLG_SPAM_FOUND; - } - - $slv = new SLVbase(); - $slv->CheckForSpam($comment); - - return PLG_SPAM_FOUND; - } -} diff --git a/plugins/spamx/SLVwhitelist.Admin.class.php b/plugins/spamx/SLVwhitelist.Admin.class.php deleted file mode 100644 index e2f2a0a6a..000000000 --- a/plugins/spamx/SLVwhitelist.Admin.class.php +++ /dev/null @@ -1,38 +0,0 @@ -moduleName = 'SLVwhitelist'; - $this->command = 'SLVwhitelist'; - $this->titleText = $LANG_SX00['slvwhitelist']; - $this->linkText = $LANG_SX00['edit_slv_whitelist']; - } -} diff --git a/public_html/docs/english/spamx.html b/public_html/docs/english/spamx.html index 8a8546f97..e7295f70c 100644 --- a/public_html/docs/english/spamx.html +++ b/public_html/docs/english/spamx.html @@ -54,7 +54,6 @@

Examine Modules

Geeklog ships with the following examine modules:

-

Spam Link Verification (SLV)

- -

SLV is a centralized, server-based service that examines posts made on - websites and detects when certain links show up in unusually high numbers. In - other words, when a spammer starts spamming a lot of sites with the same URLs - and those sites all report to SLV, the system will recognize this as a spam - wave and will flag posts containing these URLs as spam.

- -

In other words still, it's a dynamic blacklist that automatically updates - itself when a spammer starts spamming for their site. And it can only get - better (in terms of accuracy and reaction speed) the more sites use it.

- -

SLV is a free service run by Russ Jones at www.linksleeve.org.

- -

Privacy Notice: - It should be stressed that using SLV means that information from your site - is being sent to a third party's site. In some legislations you may have to - inform your users about this fact - please check with your local privacy - laws.

- -

Sending information to an external site may also be undesirable on some - setups, e.g. on a company intranet. You can disable SLV support by removing the - four files SLV.Examine.class.php, SLVbase.class.php, - SLVreport.Action.class.php, and SLVwhitelist.Admin.class.php - from your Spam-X directory (/path/to/geeklog/plugins/spamx). Or you - can simply disable the Spam-X plugin entirely (or uninstall it).

- -

The SLV Examine and Action modules will extract all URLs from a post and - only send those to SLV (i.e. the rest of the post's content is not being sent). - They also remove any links that contain your Geeklog site's URL. In case a post - does not contain any external links, the modules simply do not contact SLV at - all.

- -

Personal Blacklist

The Personal Blacklist module lets you add keywords and URLs that typically diff --git a/public_html/docs/japanese/spamx.html b/public_html/docs/japanese/spamx.html index fa337e8a5..75932ed72 100644 --- a/public_html/docs/japanese/spamx.html +++ b/public_html/docs/japanese/spamx.html @@ -50,7 +50,6 @@

検出モジュール

Geeklogには次の検出モジュールが同梱されています。

-

スパムリンク検証(SLV: Spam Link Verification)

- -

- SLVは集約されたサーバを拠点としたサービスで、Webサイトに投稿されたものを検証し、特定のリンクが異常なほど多く見られる場合にそれを検出します。言い換えれば、スパム送信者が多くのサイトに同一URLを含むスパムを送信し始め、これらのサイトすべてがSLVに報告した場合、SLVシステムはこの傾向をスパムと認識し、該当URLを含む投稿をスパムと判定します。

- -

- さらに言い換えると、SLVは、スパム送信者がサイトにスパムを送信し始めたときに、自動的に更新されるブラックリストであると言えます。SLVを使用するサイトが増えれば増えるほど(正確さと反応速度という点では)、ますますその質が高まります。

- -

SLVはRuss Jonesがwww.linksleeve.orgで運営している無料のサービスです。

- -

プライバシーポリシーの表示
- SLVを使用しているということは、自分のサイトから第三者のサイトに情報を送信していることになるということを強調しておいた方がよいでしょう。法体系によっては、ユーザーにこの事実を告知する必要があるかもしれません。ご自分の地域のプライバシーに関する法律を確認してください。 -

- -

運用している状況によっては(たとえば、企業のイントラネットなど)、情報を外部のサイトに送信することが望ましくない場合もあるでしょう。その場合は、 SLV.Examine.class.php, SLVbase.class.php, SLVreport.Action.class.php, - SLVwhitelist.Admin.class.php の4つのファイルをSpam-Xのディレクトリ(/path/to/geeklog/plugins/spamx)から削除すれば、SLVを無効にできます。単にSpam-Xプラグインを無効にする(または、アンインストールする)だけでもよいです。 -

- -

- SLV検証モジュールとアクションモジュールは、投稿されたデータからすべてのURLを抽出し、SLVへ送信するだけです(つまり、投稿されたデータのURL以外の部分は送信されません。)。また、自分のGeeklogサイトのURLを含むリンクはすべて除外します。投稿されたデータに外部リンクが含まれていない場合、これらのモジュールはSLVと通信を行いません。

- -

パーソナルブラックリスト(Personal Blacklist)