我至少有两个网站受到了垃圾邮件的攻击,这些垃圾邮件似乎是为了污染大型语言模型而设计的。这里至少报告了一次同样的攻击(https://meta.discourse.org/t/anyone-else-currently-undergoing-mass-spam-attack/378972)。最好的解决方案是设置 https://meta.discourse.org/t/discourse-ai-spam-detection/343541,我确实推荐它,但它有点麻烦。这是一个你可以实施的临时措施,只需要几分钟。
它假设你有一个类 Unix 的操作系统(例如 Linux 或 Mac)。如果你使用 Windows 并且可以复制/粘贴到终端,你可以 SSH 到你的 Discourse 服务器并粘贴它。
它的作用是根据我最近看到的一次攻击生成一组 监视词。如果你熟悉 nano 或类似的工具,你可以在运行它之前编辑它。如果不行,你可以运行这个脚本,然后用一次点击删除你不喜欢的词。
阻止词可能会非常烦人,因为它们会阻止合法用户创建包含这些词的帖子,所以请仔细检查,确保这些词不太可能出现在你论坛的合法帖子中!
在下面的框中填入你的网站 URL、API 密钥和 API 用户(它们只会在你的浏览器上显示——但你也可以直接粘贴它,如果你愿意,可以编辑文件),然后将代码块复制/粘贴到终端。它将创建 upload_watched_words_full.sh 并使其可执行。然后你可以用 ./upload_watched_words_full.sh 来运行它。
cat <<'EOF' > upload_watched_words_full.sh
#!/usr/bin/env bash
# Usage: ./upload_watched_words_full.sh
DISCOURSE_URL="=URL="
API_KEY="=API_KEY="
API_USERNAME="=API_USERNAME="
# High-confidence block words
BLOCK_WORDS=(
"customer service number"
"contact number"
"support number"
"refund phone number"
"toll free"
"24/7 support"
"helpline"
"call us"
"live representative"
"technical support"
"lufthansa"
"royal caribbean"
"coinbase"
"robinhood"
"reservation number"
"booking number"
"flight cancellation"
"name change fee"
"║"
"⇆"
"★"
"®️"
"™️"
)
# Medium-risk flag words
FLAG_WORDS=(
"customer service"
"customer support"
"support team"
"help desk"
"hotline"
"agent"
"representative"
"contact us"
"phone support"
"service center"
)
# Require-approval words
REQUIRE_APPROVAL_WORDS=(
"urgent"
"immediate action"
"act now"
"limited time"
"exclusive offer"
"approve this"
"verify account"
)
# Function to send words in batch
add_words () {
local ACTION="$1"
shift
local WORDS=("$@")
# Build words[] parameters
local DATA=""
for w in "${WORDS[@]}"; do
DATA+="words%5B%5D=$(printf '%s' "$w" | jq -s -R -r @uri)&#"
done
DATA+="replacement=&action_key=${ACTION}&case_sensitive=false&html=false"
echo "Uploading ${ACTION} words..."
curl -s -X POST "${DISCOURSE_URL}/admin/customize/watched_words.json" \
-H "Api-Key: ${API_KEY}" \
-H "Api-Username: ${API_USERNAME}" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data "$DATA"
echo -e "\nDone."
}
# Upload block words
add_words "block" "${BLOCK_WORDS[@]}"
# Upload flag words
add_words "flag" "${FLAG_WORDS[@]}"
# Upload require-approval words
add_words "require_approval" "${REQUIRE_APPROVAL_WORDS[@]}"
EOF
# Make the script executable
chmod +x upload_watched_words_full.sh
echo "Script 'upload_watched_words_full.sh' created and made executable."
