介绍
介绍由机器翻译自 CurseForge 原页面,仅供参考。
你是否运营着一个服务器,偶尔会遇到一些你想赶走的玩家,但他们却不断用备用账号和 VPN 回来?那么,现在你有机会根据硬件 ID 而不是不可靠的 IP、皮肤或行为来识别他们的账号了!
这个模组做什么
- 这个模组注册了一个空参数,如果你的服务器安装了这个模组,客户端就必须安装它。试图从整合包中移除它的玩家将无法加入你的服务器。
- 当玩家加入你的服务器时,客户端会根据玩家的硬件计算出一个半唯一的哈希值,然后由服务器存储(<服务器根目录>/config/hwid),同时存储账号 UUID。
这个模组不做什么
- 根据硬件 ID 自动封禁玩家
- 提供一种简单的方法来在游戏内查找拥有多个玩家的硬件 ID
那该怎么使用呢?
请查看下方的一些示例脚本,我不想把下面两点埋在代码块下面,因为它们非常重要,值得一读。
隐私
虽然硬件 ID 听起来很有侵入性,但它比 IP 地址的机密性要低得多。硬件 ID 是在客户端使用 SHA-256 算法计算出来的,该算法不可逆,因此不会向服务器管理员提供任何关于所用硬件的信息。硬件 ID 只能用于区分不同的硬件配置。
局限性
- 硬件 ID 是半唯一的。如果玩家升级了电脑或完全更换了电脑,硬件 ID 就会改变。如果玩家碰巧拥有相同的电脑,例如常见的预装机型,他们也可能会拥有相同的硬件 ID。哈希计算过程中包含了序列号(如果存在),以尽量减少这种情况的发生。
- 了解 Java 的专门捣乱者可以反编译这个模组并创建一个恶意版本,在他们每次加入时发送随机或特定的硬件 ID。
Bash
#!/bin/bash
destination_path="/home/minecraftserver/config/hwid"
for file in "$destination_path"/*
do
line_count=$(wc -l <"$file") # Count the number of lines in the file
if [ "$line_count" -gt 1 ] # Check if the line count is greater than 1
then
echo ""; echo "$(basename "$file")" # Print an empty line and the filename
while IFS= read -r line # Read each line from the file
do
uuid=${line} # Assign the line to the variable 'uuid'
response=$(curl -s https://sessionserver.mojang.com/session/minecraft/profile/${uuid}) # Send a request to the Mojang API to get the profile information
name=$(echo "$response" | jq -r '.name') # Extract the 'name' field from the API response using jq
echo "${uuid} - ${name}" # Print the UUID and the corresponding name
done < "$file" # Read from the file
fi
done
Python 3
import os, json, requests
search = "" # 设置搜索词,例如用户名、UUID 或其中一部分
for filename in os.listdir("/home/minecraftserver/config/hwid"): # 遍历指定目录中的每个文件
with open(f"/home/minecraftserver/config/hwid/{filename}", "r") as file: # 以读取模式打开每个文件
lines = file.readlines() # 读取文件中的所有行
if len(lines) > 1: # 检查文件中是否有多于一行
result = "" # 初始化结果字符串
for line in lines:
uuid = line.strip() # 从每一行获取 UUID
response = requests.get(f"https://sessionserver.mojang.com/session/minecraft/profile/{uuid}") # 向 Mojang API 发送 GET 请求以获取玩家档案
name = json.loads(response.text)['name'] # 从响应中提取玩家名称
result += f"{uuid} - {name}\n" # 将 UUID 和名称追加到结果字符串
if search in result: # 检查搜索结果中是否存在搜索字符串
print(result) # 打印结果
常见问题
HWID (Anti-Alts) 支持哪些 Minecraft 版本?
HWID (Anti-Alts) 支持 Minecraft Java 版 1.20.1–1.21.11,共 12 个版本,可用的加载器:Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。
HWID (Anti-Alts) 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
lunofe 的其他作品
查看全部 →Xray Snitch
by lunofe
在你的服务器上举报使用Xray材质包的玩家
311.2万
10 个月前
Modrinth · CurseForge
Vampirism.co
by lunofe
欢迎来到这款 SMP:吸血鬼、狼人、猎人和人类将在不断变化的世界中书写属于自己的命运,开启专属于你的故事与冒险。
27.3万
8 个月前
Modrinth · CurseForge
Farmer’s Bliss
by lunofe
为 Vampirism 打造的农夫乐事分支版本
11.3万
2 年前
CurseForge
Vampirism.co Peculiarities
by lunofe
This mod is a tiny add-on for Vampirism.co that adds a few quirks here and there, nothing too special.
7万
1 年前
CurseForge
评论
登录后评论和评分