Browse Source

Finished HWID support

pull/3/head
Jessica James 9 years ago
parent
commit
15130c502e
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 45
      RenX.Commands/RenX_Commands.cpp
  3. 18
      RenX.Core/RenX_BanDatabase.cpp
  4. 5
      RenX.Core/RenX_BanDatabase.h
  5. 52
      RenX.Core/RenX_Server.cpp
  6. 1
      RenX.Core/RenX_Server.h
  7. 8
      RenX.Core/RenX_Tags.cpp
  8. 4
      RenX.Core/RenX_Tags.h
  9. 4
      RenX.Logging/RenX_Logging.cpp

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

45
RenX.Commands/RenX_Commands.cpp

@ -68,7 +68,7 @@ int RenX_CommandsPlugin::OnRehash()
{
RenX_CommandsPlugin::_defaultTempBanTime = std::chrono::seconds(Jupiter::IRC::Client::Config->getLongLong(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("TBanTime"), 86400));
RenX_CommandsPlugin::playerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("PlayerInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR "03[Player Info]" IRCCOLOR "{TCOLOR} Name: " IRCBOLD "{RNAME}" IRCBOLD " - ID: {ID} - Team: " IRCBOLD "{TEAML}" IRCBOLD " - Vehicle Kills: {VEHICLEKILLS} - Building Kills {BUILDINGKILLS} - Kills {KILLS} - Deaths: {DEATHS} - KDR: {KDR} - Access: {ACCESS}"));
RenX_CommandsPlugin::adminPlayerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminPlayerInfoFormat"), Jupiter::StringS::Format("%.*s - IP: " IRCBOLD "{IP}" IRCBOLD " - RDNS: " IRCBOLD "{RDNS}" IRCBOLD " - Steam ID: " IRCBOLD "{STEAM}", RenX_CommandsPlugin::playerInfoFormat.size(), RenX_CommandsPlugin::playerInfoFormat.ptr()));
RenX_CommandsPlugin::adminPlayerInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("AdminPlayerInfoFormat"), Jupiter::StringS::Format("%.*s - IP: " IRCBOLD "{IP}" IRCBOLD " - HWID: " IRCBOLD "{HWID}" IRCBOLD " - RDNS: " IRCBOLD "{RDNS}" IRCBOLD " - Steam ID: " IRCBOLD "{STEAM}", RenX_CommandsPlugin::playerInfoFormat.size(), RenX_CommandsPlugin::playerInfoFormat.ptr()));
RenX_CommandsPlugin::buildingInfoFormat = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("BuildingInfoFormat"), STRING_LITERAL_AS_REFERENCE(IRCCOLOR) + RenX::tags->buildingTeamColorTag + RenX::tags->buildingNameTag + STRING_LITERAL_AS_REFERENCE(IRCCOLOR " - " IRCCOLOR "07") + RenX::tags->buildingHealthPercentageTag + STRING_LITERAL_AS_REFERENCE("%"));
RenX_CommandsPlugin::staffTitle = Jupiter::IRC::Client::Config->get(RenX_CommandsPlugin::getName(), STRING_LITERAL_AS_REFERENCE("StaffTitle"), STRING_LITERAL_AS_REFERENCE("Moderator"));
@ -1865,15 +1865,17 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
return true;
case 2: // IP
return entry->ip == params.asUnsignedInt();
case 3: // RDNS
case 3: // HWID
return entry->hwid.equals(params);
case 4: // RDNS
return entry->rdns.equals(params);
case 4: // STEAM
case 5: // STEAM
return entry->steamid == params.asUnsignedLongLong();
case 5: // NAME
case 6: // NAME
return entry->name.equalsi(params);
case 6: // BANNER
case 7: // BANNER
return entry->banner.equalsi(params);
case 7: // ACTIVE
case 8: // ACTIVE
return params.asBool() == entry->is_active();
}
};
@ -1884,16 +1886,18 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
type = 1;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("ip")))
type = 2;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("rdns")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("hwid")))
type = 3;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("steam")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("rdns")))
type = 4;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("name")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("steam")))
type = 5;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("banner")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("name")))
type = 6;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("active")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("banner")))
type = 7;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("active")))
type = 8;
else
{
type = 0;
@ -1935,9 +1939,9 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
types += ";"_jrs;
}
out.format("ID: %lu (" IRCCOLOR "%sactive" IRCCOLOR "); Date: %s; IP: %.*s/%u; Steam: %llu; Types:%.*s Name: %.*s; Banner: %.*s",
i, entry->is_active() ? "12" : "04in", timeStr, ip_str.size(), ip_str.ptr(), entry->prefix_length, entry->steamid, types.size(), types.ptr(),
entry->name.size(), entry->name.ptr(), entry->banner.size(), entry->banner.ptr());
out.format("ID: %lu (" IRCCOLOR "%sactive" IRCCOLOR "); Date: %s; IP: %.*s/%u; HWID: %.*s; Steam: %llu; Types:%.*s Name: %.*s; Banner: %.*s",
i, entry->is_active() ? "12" : "04in", timeStr, ip_str.size(), ip_str.ptr(), entry->prefix_length, entry->hwid.size(), entry->hwid.ptr(), entry->steamid,
types.size(), types.ptr(), entry->name.size(), entry->name.ptr(), entry->banner.size(), entry->banner.ptr());
if (entry->rdns.isNotEmpty())
{
@ -2119,6 +2123,7 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
uint32_t ip = 0U;
uint8_t prefix_length = 32U;
uint64_t steamid = 0U;
Jupiter::ReferenceString hwid;
Jupiter::StringS rdns;
Jupiter::String banner = nick + "@IRC"_jrs;
Jupiter::ReferenceString reason = "No reason"_jrs;
@ -2160,6 +2165,16 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
steamid = Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE).asUnsignedLongLong();
}
else if (word.equalsi("HWID"_jrs) || word.equalsi("HardwareID"_jrs))
{
if (index == words)
{
source->sendNotice(nick, "ERROR: No value specified for token: "_jrs + word);
return;
}
hwid = Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE);
}
else if (word.equalsi("RDNS"_jrs) || word.equalsi("DNS"_jrs))
{
if (index == words)
@ -2232,7 +2247,7 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
else
flags |= RenX::BanDatabase::Entry::FLAG_USE_RDNS;
RenX::banDatabase->add(name, ip, prefix_length, steamid, rdns, banner, reason, duration, flags);
RenX::banDatabase->add(name, ip, prefix_length, steamid, hwid, rdns, banner, reason, duration, flags);
RenX::getCore()->banCheck();
source->sendMessage(channel, Jupiter::StringS::Format("Ban added to the database with ID #%u", RenX::banDatabase->getEntries().size() - 1));
}

18
RenX.Core/RenX_BanDatabase.cpp

@ -54,6 +54,8 @@ void RenX::BanDatabase::process_data(Jupiter::DataBuffer &buffer, FILE *file, fp
entry->steamid = buffer.pop<uint64_t>();
entry->ip = buffer.pop<uint32_t>();
entry->prefix_length = buffer.pop<uint8_t>();
if (this->read_version >= 5U)
entry->hwid = buffer.pop<Jupiter::String_Strict, char>();
entry->rdns = buffer.pop<Jupiter::String_Strict, char>();
entry->name = buffer.pop<Jupiter::String_Strict, char>();
entry->banner = buffer.pop<Jupiter::String_Strict, char>();
@ -93,6 +95,15 @@ void RenX::BanDatabase::process_file_finish(FILE *file)
}
return;
}
else if (RenX::BanDatabase::read_version < RenX::BanDatabase::write_version)
{
if (freopen(RenX::BanDatabase::filename.c_str(), "wb", file) != nullptr)
{
this->create_header(file);
for (size_t index = 0; index != RenX::BanDatabase::entries.size(); ++index)
RenX::BanDatabase::write(RenX::BanDatabase::entries.get(index), file);
}
}
fgetpos(file, std::addressof(RenX::BanDatabase::eof));
}
@ -103,7 +114,7 @@ void RenX::BanDatabase::upgrade_database()
if (file != nullptr)
{
this->create_header(file);
for (size_t index = 0; RenX::BanDatabase::entries.size(); ++index)
for (size_t index = 0; index != RenX::BanDatabase::entries.size(); ++index)
RenX::BanDatabase::write(RenX::BanDatabase::entries.get(index), file);
fclose(file);
@ -133,6 +144,7 @@ void RenX::BanDatabase::write(RenX::BanDatabase::Entry *entry, FILE *file)
buffer.push(entry->steamid);
buffer.push(entry->ip);
buffer.push(entry->prefix_length);
buffer.push(entry->hwid);
buffer.push(entry->rdns);
buffer.push(entry->name);
buffer.push(entry->banner);
@ -165,6 +177,7 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player
entry->steamid = player->steamid;
entry->ip = player->ip32;
entry->prefix_length = 32U;
entry->hwid = player->hwid;
if (player->rdns_thread.joinable())
player->rdns_thread.join();
entry->rdns = player->rdns;
@ -183,7 +196,7 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player
RenX::BanDatabase::write(entry);
}
void RenX::BanDatabase::add(const Jupiter::ReadableString &name, uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &rdns, const Jupiter::ReadableString &banner, Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags)
void RenX::BanDatabase::add(const Jupiter::ReadableString &name, uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &hwid, const Jupiter::ReadableString &rdns, const Jupiter::ReadableString &banner, Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags)
{
Entry *entry = new Entry();
entry->set_active();
@ -193,6 +206,7 @@ void RenX::BanDatabase::add(const Jupiter::ReadableString &name, uint32_t ip, ui
entry->steamid = steamid;
entry->ip = ip;
entry->prefix_length = prefix_length;
entry->hwid = hwid;
entry->rdns = rdns;
entry->name = name;
entry->banner = banner;

5
RenX.Core/RenX_BanDatabase.h

@ -86,6 +86,7 @@ namespace RenX
uint64_t steamid /** SteamID of the banned player */;
uint32_t ip /** IPv4 address of the banned player */;
uint8_t prefix_length /** Prefix length for the IPv4 address block */;
Jupiter::StringS hwid; /** Hardware ID of the banned player */
Jupiter::StringS rdns /** RDNS of the banned player */;
Jupiter::StringS name /** Name of the banned player */;
Jupiter::StringS banner /** Name of the user who initiated the ban */;
@ -155,7 +156,7 @@ namespace RenX
* @param reason Reason the player is getting banned
* @param length Duration of the ban
*/
void add(const Jupiter::ReadableString &name, uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &rdns, const Jupiter::ReadableString &banner, Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags = RenX::BanDatabase::Entry::FLAG_TYPE_GAME);
void add(const Jupiter::ReadableString &name, uint32_t ip, uint8_t prefix_length, uint64_t steamid, const Jupiter::ReadableString &hwid, const Jupiter::ReadableString &rdns, const Jupiter::ReadableString &banner, Jupiter::ReadableString &reason, std::chrono::seconds length, uint16_t flags = RenX::BanDatabase::Entry::FLAG_TYPE_GAME);
/**
* @brief Upgrades the ban database to the current write_version.
@ -211,7 +212,7 @@ namespace RenX
private:
/** Database version */
const uint8_t write_version = 3U;
const uint8_t write_version = 5U;
uint8_t read_version = write_version;
fpos_t eof;

52
RenX.Core/RenX_Server.cpp

@ -510,6 +510,7 @@ void RenX::Server::banCheck(RenX::PlayerInfo *player)
if ((this->localSteamBan && entry->steamid != 0 && entry->steamid == player->steamid)
|| (this->localIPBan && entry->ip != 0 && (entry->ip & netmask) == (player->ip32 & netmask))
|| (this->localHWIDBan && entry->hwid.isNotEmpty() && entry->hwid.equals(player->hwid))
|| (this->localRDNSBan && entry->rdns.isNotEmpty() && entry->is_rdns_ban() && player->rdns_thread.joinable() == false && player->rdns.match(entry->rdns))
|| (this->localNameBan && entry->name.isNotEmpty() && entry->name.equalsi(player->name)))
{
@ -700,7 +701,7 @@ bool RenX::Server::fetchClientList()
{
RenX::Server::lastClientListUpdate = std::chrono::steady_clock::now();
if (this->rconVersion >= 4)
return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("cclientvarlist KILLS DEATHS SCORE CREDITS CHARACTER VEHICLE PING ADMIN STEAM IP PLAYERLOG\n")) > 0
return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("cclientvarlist KILLS DEATHS SCORE CREDITS CHARACTER VEHICLE PING ADMIN STEAM IP HWID PLAYERLOG\n")) > 0
&& RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("cbotvarlist KILLS DEATHS SCORE CREDITS CHARACTER VEHICLE PLAYERLOG\n")) > 0;
else
return RenX::Server::sock.send(STRING_LITERAL_AS_REFERENCE("cclientvarlist KILLS\xA0""DEATHS\xA0""SCORE\xA0""CREDITS\xA0""CHARACTER\xA0""VEHICLE\xA0""PING\xA0""ADMIN\xA0""STEAM\xA0""IP\xA0""PLAYERLOG\n")) > 0
@ -1396,7 +1397,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
isBot = false;
id = idToken.asInt(10);
};
auto getPlayerOrAdd = [&](const Jupiter::ReadableString &name, int id, RenX::TeamType team, bool isBot, uint64_t steamid, const Jupiter::ReadableString &ip)
auto getPlayerOrAdd = [&](const Jupiter::ReadableString &name, int id, RenX::TeamType team, bool isBot, uint64_t steamid, const Jupiter::ReadableString &ip, const Jupiter::ReadableString &hwid)
{
RenX::PlayerInfo *r = this->getPlayer(id);
if (r == nullptr)
@ -1407,6 +1408,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
r->team = team;
r->ip = ip;
r->ip32 = Jupiter::Socket::pton4(Jupiter::CStringS(r->ip).c_str());
r->hwid = hwid;
if (this->resolvesRDNS() && r->ip32 != 0)
{
r->rdns_thread = std::thread(resolve_rdns, r);
@ -1447,6 +1449,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
}
recalcUUID = true;
}
if (r->hwid.isEmpty() && hwid.isNotEmpty())
{
r->hwid = hwid;
recalcUUID = true;
}
if (r->steamid == 0U && steamid != 0U)
{
r->steamid = steamid;
@ -1472,18 +1479,24 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
auto parseGetPlayerOrAdd = [&parsePlayerData, &getPlayerOrAdd](const Jupiter::ReadableString &token)
{
PARSE_PLAYER_DATA_P(token);
return getPlayerOrAdd(name, id, team, isBot, 0U, Jupiter::ReferenceString::empty);
return getPlayerOrAdd(name, id, team, isBot, 0U, Jupiter::ReferenceString::empty, Jupiter::ReferenceString::empty);
};
auto gotoToken = [&line, &tokens](size_t index)
auto gotoToken = [&line, &tokens, this](size_t index)
{
if (index >= tokens.token_count)
return Jupiter::ReferenceString::empty;
size_t offset = index;
const char delim = this->getVersion() >= 4 ? RenX::DelimC : RenX::DelimC3;
const char *itr = line.ptr();
while (index != 0)
offset += tokens.tokens[--index].size() + 1;
{
if (*itr == delim)
--index;
++itr;
}
return Jupiter::ReferenceString::substring(line, offset);
return Jupiter::ReferenceString::substring(line, itr - line.ptr());
};
auto finished_connecting = [this, &xPlugins]()
{
@ -1527,9 +1540,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
team = RenX::getTeam(teamToken);
if (adminToken.equalsi("None"_jrs))
getPlayerOrAdd(tokens.getToken(5), id, team, isBot, steamid, tokens.getToken(1));
getPlayerOrAdd(tokens.getToken(5), id, team, isBot, steamid, tokens.getToken(1), Jupiter::ReferenceString::empty);
else
getPlayerOrAdd(tokens.getToken(5), id, team, isBot, steamid, tokens.getToken(1))->adminType = adminToken;
getPlayerOrAdd(tokens.getToken(5), id, team, isBot, steamid, tokens.getToken(1), Jupiter::ReferenceString::empty)->adminType = adminToken;
}
}
else if (this->lastCommand.equalsi("clientvarlist"_jrs))
@ -1538,7 +1551,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
this->commandListFormat = tokens;
else
{
/*
/*e
lRCON Command; Conn4 executed: clientvarlist PlayerLog Kills PlayerKills BotKills Deaths Score Credits Character BoundVehicle Vehicle Spy RemoteC4 ATMine KDR Ping Admin Steam IP ID Name Team TeamNum
rPlayerLog Kills PlayerKills BotKills Deaths Score Credits Character BoundVehicle Vehicle Spy RemoteC4 ATMine KDR Ping Admin Steam IP ID Name Team TeamNum
rGDI,256,EKT-J 0 0 0 0 0 5217.9629 Rx_FamilyInfo_GDI_Soldier   False 0 0 0.0000 8 None 0x0110000104AE0666 127.0.0.1 256 EKT-J GDI 0
@ -1590,7 +1603,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
};
Jupiter::INIFile::Section::KeyValuePair *pair = table.getPair("PlayerLog"_jrs);
if (pair != nullptr)
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(pair->getValue(), 2, ','), Jupiter::ReferenceString::getToken(pair->getValue(), 1, ',').asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(pair->getValue(), 0, ',')), false, table.get("STEAM"_jrs).asUnsignedLongLong(), table.get("IP"_jrs)));
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(pair->getValue(), 2, ','), Jupiter::ReferenceString::getToken(pair->getValue(), 1, ',').asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(pair->getValue(), 0, ',')), false, table.get("STEAM"_jrs).asUnsignedLongLong(), table.get("IP"_jrs), table.get("HWID"_jrs)));
else
{
Jupiter::INIFile::Section::KeyValuePair *namePair = table.getPair("Name"_jrs);
@ -1608,6 +1621,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
}
if (player->ip.isEmpty())
player->ip = table.get("IP"_jrs);
if (player->hwid.isEmpty())
player->hwid = table.get("HWID"_jrs);
if (player->steamid == 0)
{
uint64_t steamid = table.get("STEAM"_jrs).asUnsignedLongLong();
@ -1640,6 +1655,8 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
if (player->ip.isEmpty())
player->ip = table.get("IP"_jrs);
if (player->hwid.isEmpty())
player->hwid = table.get("HWID"_jrs);
if (player->steamid == 0)
{
uint64_t steamid = table.get("STEAM"_jrs).asUnsignedLongLong();
@ -1720,7 +1737,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
};
Jupiter::INIFile::Section::KeyValuePair *pair = table.getPair("PlayerLog"_jrs);
if (pair != nullptr)
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(pair->getValue(), 2, ','), Jupiter::ReferenceString::getToken(pair->getValue(), 1, ',').substring(1).asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(pair->getValue(), 0, ',')), true, 0ULL, Jupiter::ReferenceString::empty));
parse(getPlayerOrAdd(Jupiter::ReferenceString::getToken(pair->getValue(), 2, ','), Jupiter::ReferenceString::getToken(pair->getValue(), 1, ',').substring(1).asInt(), RenX::getTeam(Jupiter::ReferenceString::getToken(pair->getValue(), 0, ',')), true, 0ULL, Jupiter::ReferenceString::empty, Jupiter::ReferenceString::empty));
else
{
Jupiter::INIFile::Section::KeyValuePair *namePair = table.getPair("Name"_jrs);
@ -2265,7 +2282,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
}
else
kID = kIDToken.asInt();
RenX::PlayerInfo *killer = getPlayerOrAdd(kName, kID, vTeam, kIsBot, 0, Jupiter::ReferenceString::empty);
RenX::PlayerInfo *killer = getPlayerOrAdd(kName, kID, vTeam, kIsBot, 0, Jupiter::ReferenceString::empty, Jupiter::ReferenceString::empty);
killer->kills++;
if (damageType.equals("Rx_DmgType_Headshot"))
killer->headshots++;
@ -2356,7 +2373,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
idToken.shiftRight(1);
}
id = idToken.asInt();
RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, 0, Jupiter::ReferenceString::empty);
RenX::PlayerInfo *player = getPlayerOrAdd(name, id, team, isBot, 0, Jupiter::ReferenceString::empty, Jupiter::ReferenceString::empty);
switch (type)
{
case RenX::ObjectType::Vehicle:
@ -2522,8 +2539,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (tokens.getToken(7).equals("steamid"))
steamid = tokens.getToken(8).asUnsignedLongLong();
player = getPlayerOrAdd(name, id, team, isBot, steamid, tokens.getToken(4));
player->hwid = tokens.getToken(6);
player = getPlayerOrAdd(name, id, team, isBot, steamid, tokens.getToken(4), tokens.getToken(6));
}
else
{
@ -2531,7 +2547,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
if (tokens.getToken(5).equals("steamid"))
steamid = tokens.getToken(6).asUnsignedLongLong();
player = getPlayerOrAdd(name, id, team, isBot, steamid, tokens.getToken(4));
player = getPlayerOrAdd(name, id, team, isBot, steamid, tokens.getToken(4), Jupiter::ReferenceString::empty);
}
if (steamid != 0ULL && default_ladder_database != nullptr && (player->ban_flags & RenX::BanDatabase::Entry::FLAG_TYPE_LADDER) == 0)
@ -2688,6 +2704,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
else
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnExecute(this, user, command);
if (this->rconUser.equals(user))
{
this->lastCommand = cmd;
@ -3332,6 +3349,7 @@ void RenX::Server::init()
RenX::Server::rconBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "RCONBan"_jrs, false);
RenX::Server::localSteamBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "LocalSteamBan"_jrs, true);
RenX::Server::localIPBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "LocalIPBan"_jrs, true);
RenX::Server::localHWIDBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "LocalHWIDBan"_jrs, true);
RenX::Server::localRDNSBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "LocalRDNSBan"_jrs, false);
RenX::Server::localNameBan = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "LocalNameBan"_jrs, false);
RenX::Server::localBan = RenX::Server::localIPBan || RenX::Server::localRDNSBan || RenX::Server::localSteamBan || RenX::Server::localNameBan;

1
RenX.Core/RenX_Server.h

@ -1044,6 +1044,7 @@ namespace RenX
bool localBan;
bool localSteamBan;
bool localIPBan;
bool localHWIDBan;
bool localRDNSBan;
bool localNameBan;
bool neverSay;

8
RenX.Core/RenX_Tags.cpp

@ -89,6 +89,7 @@ TagsImp::TagsImp()
this->INTERNAL_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_RAW_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_IP_TAG = this->getUniqueInternalTag();
this->INTERNAL_HWID_TAG = this->getUniqueInternalTag();
this->INTERNAL_RDNS_TAG = this->getUniqueInternalTag();
this->INTERNAL_STEAM_TAG = this->getUniqueInternalTag();
this->INTERNAL_UUID_TAG = this->getUniqueInternalTag();
@ -141,6 +142,7 @@ TagsImp::TagsImp()
this->INTERNAL_VICTIM_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_RAW_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_IP_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_HWID_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_RDNS_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_STEAM_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_UUID_TAG = this->getUniqueInternalTag();
@ -273,6 +275,7 @@ TagsImp::TagsImp()
this->nameTag = Jupiter::IRC::Client::Config->get(configSection, "NameTag"_jrs, "{NAME}"_jrs);
this->rawNameTag = Jupiter::IRC::Client::Config->get(configSection, "RawNameTag"_jrs, "{RNAME}"_jrs);
this->ipTag = Jupiter::IRC::Client::Config->get(configSection, "IPTag"_jrs, "{IP}"_jrs);
this->hwidTag = Jupiter::IRC::Client::Config->get(configSection, "HWIDTag"_jrs, "{HWID}"_jrs);
this->rdnsTag = Jupiter::IRC::Client::Config->get(configSection, "RDNSTag"_jrs, "{RDNS}"_jrs);
this->steamTag = Jupiter::IRC::Client::Config->get(configSection, "SteamTag"_jrs, "{STEAM}"_jrs);
this->uuidTag = Jupiter::IRC::Client::Config->get(configSection, "UUIDTag"_jrs, "{UUID}"_jrs);
@ -325,6 +328,7 @@ TagsImp::TagsImp()
this->victimNameTag = Jupiter::IRC::Client::Config->get(configSection, "VictimNameTag"_jrs, "{VNAME}"_jrs);
this->victimRawNameTag = Jupiter::IRC::Client::Config->get(configSection, "VictimRawNameTag"_jrs, "{VRNAME}"_jrs);
this->victimIPTag = Jupiter::IRC::Client::Config->get(configSection, "VictimIPTag"_jrs, "{VIP}"_jrs);
this->victimHWIDTag = Jupiter::IRC::Client::Config->get(configSection, "VictimHWIDTag"_jrs, "{VHWID}"_jrs);
this->victimRDNSTag = Jupiter::IRC::Client::Config->get(configSection, "VictimRDNSTag"_jrs, "{VRDNS}"_jrs);
this->victimSteamTag = Jupiter::IRC::Client::Config->get(configSection, "VictimSteamTag"_jrs, "{VSTEAM}"_jrs);
this->victimUUIDTag = Jupiter::IRC::Client::Config->get(configSection, "VictimUUIDTag"_jrs, "{VUUID}"_jrs);
@ -474,6 +478,7 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
PROCESS_TAG(this->INTERNAL_NAME_TAG, RenX::getFormattedPlayerName(player));
PROCESS_TAG(this->INTERNAL_RAW_NAME_TAG, player->name);
PROCESS_TAG(this->INTERNAL_IP_TAG, player->ip);
PROCESS_TAG(this->INTERNAL_HWID_TAG, player->hwid);
if (player->rdns_thread.joinable())
{
PROCESS_TAG(this->INTERNAL_RDNS_TAG, RenX::rdns_pending);
@ -519,6 +524,7 @@ void TagsImp::processTags(Jupiter::StringType &msg, const RenX::Server *server,
PROCESS_TAG(this->INTERNAL_VICTIM_NAME_TAG, RenX::getFormattedPlayerName(victim));
PROCESS_TAG(this->INTERNAL_VICTIM_RAW_NAME_TAG, victim->name);
PROCESS_TAG(this->INTERNAL_VICTIM_IP_TAG, victim->ip);
PROCESS_TAG(this->INTERNAL_VICTIM_HWID_TAG, victim->hwid);
if (victim->rdns_thread.joinable())
{
PROCESS_TAG(this->INTERNAL_VICTIM_RDNS_TAG, RenX::rdns_pending);
@ -701,6 +707,7 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt)
fmt.replace(this->nameTag, this->INTERNAL_NAME_TAG);
fmt.replace(this->rawNameTag, this->INTERNAL_RAW_NAME_TAG);
fmt.replace(this->ipTag, this->INTERNAL_IP_TAG);
fmt.replace(this->hwidTag, this->INTERNAL_HWID_TAG);
fmt.replace(this->rdnsTag, this->INTERNAL_RDNS_TAG);
fmt.replace(this->steamTag, this->INTERNAL_STEAM_TAG);
fmt.replace(this->uuidTag, this->INTERNAL_UUID_TAG);
@ -753,6 +760,7 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt)
fmt.replace(this->victimNameTag, this->INTERNAL_VICTIM_NAME_TAG);
fmt.replace(this->victimRawNameTag, this->INTERNAL_VICTIM_RAW_NAME_TAG);
fmt.replace(this->victimIPTag, this->INTERNAL_VICTIM_IP_TAG);
fmt.replace(this->victimHWIDTag, this->INTERNAL_VICTIM_HWID_TAG);
fmt.replace(this->victimRDNSTag, this->INTERNAL_VICTIM_RDNS_TAG);
fmt.replace(this->victimSteamTag, this->INTERNAL_VICTIM_STEAM_TAG);
fmt.replace(this->victimUUIDTag, this->INTERNAL_VICTIM_UUID_TAG);

4
RenX.Core/RenX_Tags.h

@ -75,6 +75,7 @@ namespace RenX
Jupiter::StringS INTERNAL_NAME_TAG;
Jupiter::StringS INTERNAL_RAW_NAME_TAG;
Jupiter::StringS INTERNAL_IP_TAG;
Jupiter::StringS INTERNAL_HWID_TAG;
Jupiter::StringS INTERNAL_RDNS_TAG;
Jupiter::StringS INTERNAL_STEAM_TAG;
Jupiter::StringS INTERNAL_UUID_TAG;
@ -127,6 +128,7 @@ namespace RenX
Jupiter::StringS INTERNAL_VICTIM_NAME_TAG;
Jupiter::StringS INTERNAL_VICTIM_RAW_NAME_TAG;
Jupiter::StringS INTERNAL_VICTIM_IP_TAG;
Jupiter::StringS INTERNAL_VICTIM_HWID_TAG;
Jupiter::StringS INTERNAL_VICTIM_RDNS_TAG;
Jupiter::StringS INTERNAL_VICTIM_STEAM_TAG;
Jupiter::StringS INTERNAL_VICTIM_UUID_TAG;
@ -259,6 +261,7 @@ namespace RenX
Jupiter::StringS nameTag;
Jupiter::StringS rawNameTag;
Jupiter::StringS ipTag;
Jupiter::StringS hwidTag;
Jupiter::StringS rdnsTag;
Jupiter::StringS steamTag;
Jupiter::StringS uuidTag;
@ -311,6 +314,7 @@ namespace RenX
Jupiter::StringS victimNameTag;
Jupiter::StringS victimRawNameTag;
Jupiter::StringS victimIPTag;
Jupiter::StringS victimHWIDTag;
Jupiter::StringS victimRDNSTag;
Jupiter::StringS victimSteamTag;
Jupiter::StringS victimUUIDTag;

4
RenX.Logging/RenX_Logging.cpp

@ -115,10 +115,10 @@ void RenX_LoggingPlugin::init()
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s!", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr()));
RenX_LoggingPlugin::joinAdminFmt = Jupiter::IRC::Client::Config->get(this->getName(), "JoinAdminFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD " using Steam ID " IRCBOLD "%.*s" IRCBOLD ".", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->steamTag.size(), RenX::tags->steamTag.ptr()));
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD " using Steam ID " IRCBOLD "%.*s" IRCBOLD ". HWID: \"" IRCBOLD "%.*s" IRCBOLD "\"", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->steamTag.size(), RenX::tags->steamTag.ptr(), RenX::tags->hwidTag.size(), RenX::tags->hwidTag.ptr()));
RenX_LoggingPlugin::joinNoSteamAdminFmt = Jupiter::IRC::Client::Config->get(this->getName(), "JoinNoSteamAdminFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD ", but is " IRCBOLD "not" IRCBOLD " using Steam.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr()));
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD ", but is " IRCBOLD "not" IRCBOLD " using Steam. HWID: \"" IRCBOLD "%.*s" IRCBOLD "\"", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr(), RenX::tags->ipTag.size(), RenX::tags->ipTag.ptr(), RenX::tags->hwidTag.size(), RenX::tags->hwidTag.ptr()));
RenX_LoggingPlugin::partFmt = Jupiter::IRC::Client::Config->get(this->getName(), "PartFormat"_jrs,
Jupiter::StringS::Format(IRCCOLOR "12[Part] " IRCBOLD "%.*s" IRCBOLD " left the %.*s.", RenX::tags->nameTag.size(), RenX::tags->nameTag.ptr(), RenX::tags->teamLongTag.size(), RenX::tags->teamLongTag.ptr()));

Loading…
Cancel
Save