Browse Source

RenX.Core:

* Moved player RDNS resolution to RenX.Core
* Added RDNS ban (disabled by default until a proper command and mask checking is added)
RenX.Logging:
* Added players' RDNS to player join logs
* Added {RDNS} and {VRDNS} tags
RenX.Commands:
* Added ban reason and rdns to "bsearch" command output
* Added player's RDNS to default adminPlayerInfoFormat.
* Added "rdns" search option to bsearch
* Fixed a bug in the "ban" IRC command which prevented specifying a ban reason
RenX.DNS:
* Deleted (obsolete)
pull/3/head
JustinAJ 9 years ago
parent
commit
f6dfaef422
  1. 13
      Config.ini
  2. 2
      Jupiter
  3. 41
      Jupiter Bot.sln
  4. BIN
      Release/Bot.lib
  5. BIN
      Release/Plugins/RenX.Core.lib
  6. 43
      RenX.Commands/RenX_Commands.cpp
  7. 33
      RenX.Core/RenX_BanDatabase.cpp
  8. 1
      RenX.Core/RenX_BanDatabase.h
  9. 1
      RenX.Core/RenX_PlayerInfo.h
  10. 14
      RenX.Core/RenX_Server.cpp
  11. 9
      RenX.Core/RenX_Server.h
  12. 8
      RenX.Core/RenX_Tags.cpp
  13. 4
      RenX.Core/RenX_Tags.h
  14. 78
      RenX.DNS/RenX_DNS.cpp
  15. 4
      RenX.Logging/RenX_Logging.cpp
  16. 4
      RenX.ModSystem/RenX_ModSystem.cpp

13
Config.ini

@ -115,12 +115,20 @@ Channel.2.Type=2
SASL.Password=your_NickServ_Password
LogFile=CnCIRC.txt
[CT]
Hostname=irc.ConstructiveTyranny.com
Nick=RenXBot
Channel.1=#RenX-IRC
Channel.1.Type=1
RawData.1=PRIVMSG NickServ :IDENTIFY your_NickServ_Password
LogFile=CT.txt
[EKT]
Hostname=irc.EliteKamikazeTeam.com
Nick=RenXBot
Channel.1=#RenX-IRC
Channel.1.Type=1
SASL.Password=your_NickServ_Password
RawData.1=PRIVMSG NickServ :IDENTIFY your_NickServ_Password
LogFile=EKT.txt
[St0rm]
@ -129,9 +137,8 @@ Nick=RenXBot
AltNick=RXBot`
Channel.1=#RenX-IRC
Channel.1.Type=1
SASL.Password=your_NickServ_Password
RawData.1=PRIVMSG NickServ :IDENTIFY your_NickServ_Password
LogFile=St0rm.txt
Prefix=!
; [DefaultCommands]
; You can modify the access requirements for any command here.

2
Jupiter

@ -1 +1 @@
Subproject commit 87ca784d1ee5fb9468672ddda8d34b2f6c293433
Subproject commit 5338777b91ca98bfcd4aea3620a69071d42701f0

41
Jupiter Bot.sln

@ -103,12 +103,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UserInterface", "UserInterf
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.DNS", "RenX.DNS\RenX.DNS.vcxproj", "{812E9781-A9CB-43C6-8C40-87908D50B363}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
{9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.Greetings", "RenX.Greetings\RenX.Greetings.vcxproj", "{8709993F-B08A-4156-BD93-581F297FE0A4}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
@ -168,6 +162,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.MinPlayers", "RenX.Min
{9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.AlwaysRecord", "RenX.AlwaysRecord\RenX.AlwaysRecord.vcxproj", "{C5CDEDF5-BAFB-4D5B-A4DB-4331E13DBD58}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
{9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPServer", "HTTPServer\HTTPServer.vcxproj", "{BB048D6F-F001-4E9B-95F4-886081E0807A}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.Ladder.Web", "RenX.Ladder.Web\RenX.Ladder.Web.vcxproj", "{57661A2A-EE94-4E9C-B792-AB756533DEFA}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
{9103DF3D-8B4A-48E5-A6B3-CBE2554630E2} = {9103DF3D-8B4A-48E5-A6B3-CBE2554630E2}
{BB048D6F-F001-4E9B-95F4-886081E0807A} = {BB048D6F-F001-4E9B-95F4-886081E0807A}
{B2846BD6-2332-4DA6-A13B-113318F76D5E} = {B2846BD6-2332-4DA6-A13B-113318F76D5E}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -246,10 +259,6 @@ Global
{BE8799E6-A0AC-4F29-AEC5-9EC5886868D7}.Debug|Win32.Build.0 = Debug|Win32
{BE8799E6-A0AC-4F29-AEC5-9EC5886868D7}.Release|Win32.ActiveCfg = Release|Win32
{BE8799E6-A0AC-4F29-AEC5-9EC5886868D7}.Release|Win32.Build.0 = Release|Win32
{812E9781-A9CB-43C6-8C40-87908D50B363}.Debug|Win32.ActiveCfg = Debug|Win32
{812E9781-A9CB-43C6-8C40-87908D50B363}.Debug|Win32.Build.0 = Debug|Win32
{812E9781-A9CB-43C6-8C40-87908D50B363}.Release|Win32.ActiveCfg = Release|Win32
{812E9781-A9CB-43C6-8C40-87908D50B363}.Release|Win32.Build.0 = Release|Win32
{8709993F-B08A-4156-BD93-581F297FE0A4}.Debug|Win32.ActiveCfg = Debug|Win32
{8709993F-B08A-4156-BD93-581F297FE0A4}.Debug|Win32.Build.0 = Debug|Win32
{8709993F-B08A-4156-BD93-581F297FE0A4}.Release|Win32.ActiveCfg = Release|Win32
@ -290,6 +299,18 @@ Global
{99D34DCB-A484-437C-9FC5-D4051FEDC18C}.Debug|Win32.Build.0 = Debug|Win32
{99D34DCB-A484-437C-9FC5-D4051FEDC18C}.Release|Win32.ActiveCfg = Release|Win32
{99D34DCB-A484-437C-9FC5-D4051FEDC18C}.Release|Win32.Build.0 = Release|Win32
{C5CDEDF5-BAFB-4D5B-A4DB-4331E13DBD58}.Debug|Win32.ActiveCfg = Debug|Win32
{C5CDEDF5-BAFB-4D5B-A4DB-4331E13DBD58}.Debug|Win32.Build.0 = Debug|Win32
{C5CDEDF5-BAFB-4D5B-A4DB-4331E13DBD58}.Release|Win32.ActiveCfg = Release|Win32
{C5CDEDF5-BAFB-4D5B-A4DB-4331E13DBD58}.Release|Win32.Build.0 = Release|Win32
{BB048D6F-F001-4E9B-95F4-886081E0807A}.Debug|Win32.ActiveCfg = Debug|Win32
{BB048D6F-F001-4E9B-95F4-886081E0807A}.Debug|Win32.Build.0 = Debug|Win32
{BB048D6F-F001-4E9B-95F4-886081E0807A}.Release|Win32.ActiveCfg = Release|Win32
{BB048D6F-F001-4E9B-95F4-886081E0807A}.Release|Win32.Build.0 = Release|Win32
{57661A2A-EE94-4E9C-B792-AB756533DEFA}.Debug|Win32.ActiveCfg = Debug|Win32
{57661A2A-EE94-4E9C-B792-AB756533DEFA}.Debug|Win32.Build.0 = Debug|Win32
{57661A2A-EE94-4E9C-B792-AB756533DEFA}.Release|Win32.ActiveCfg = Release|Win32
{57661A2A-EE94-4E9C-B792-AB756533DEFA}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

BIN
Release/Bot.lib

Binary file not shown.

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

43
RenX.Commands/RenX_Commands.cpp

@ -73,7 +73,7 @@ int RenX_CommandsPlugin::OnRehash()
{
RenX_CommandsPlugin::_defaultTempBanTime = 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 " - 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 " - 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::sanitizeTags(RenX_CommandsPlugin::playerInfoFormat);
@ -1118,18 +1118,20 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
return isMatch(1) || isMatch(2) || isMatch(3) || isMatch(4);
case 1: // IP
return entry->ip == params.asUnsignedInt();
case 2: // STEAM
case 2: // RDNS
return entry->rdns.equals(params);
case 3: // STEAM
return entry->steamid == params.asUnsignedLongLong();
case 3: // NAME
case 4: // NAME
return entry->name.equalsi(params);
case 4: // BANNER
case 5: // BANNER
return entry->varData.get(pluginInstance.getName()).equalsi(params);
case 5: // ACTIVE
case 6: // ACTIVE
if (params.asBool()) // Got tired of seeing a compiler warning.
return entry->active == 1;
else
return entry->active == 0;
case 6: // ALL
case 7: // ALL
return true;
}
};
@ -1138,18 +1140,20 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
Jupiter::ReferenceString type_str = Jupiter::ReferenceString::getWord(parameters, 0, WHITESPACE);
if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("ip")))
type = 1;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("steam")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("rdns")))
type = 2;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("name")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("steam")))
type = 3;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("banner")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("name")))
type = 4;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("active")))
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("banner")))
type = 5;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("active")))
type = 6;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("any")))
type = 0;
else if (type_str.equalsi(STRING_LITERAL_AS_REFERENCE("all")) || type_str.equals('*'))
type = 6;
type = 7;
else
{
type = 0;
@ -1168,6 +1172,16 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
strftime(timeStr, sizeof(timeStr), "%b %d %Y; Time: %H:%M:%S", localtime(&(entry->timestamp)));
out.format("ID: %lu; Status: %sactive; Date: %s; IP: %.*s; Steam: %llu; Name: %.*s%s", i, entry->active ? "" : "in", timeStr, ip_str.size(), ip_str.ptr(), entry->steamid, entry->name.size(), entry->name.ptr(), banner.isEmpty() ? "" : "; Banner: ");
out.concat(banner);
if (entry->rdns.isNotEmpty())
{
out.concat("; RDNS: "_jrs);
out.concat(entry->rdns);
}
if (entry->reason.isNotEmpty())
{
out.concat("; Reason: "_jrs);
out.concat(entry->reason);
}
source->sendNotice(nick, out);
}
}
@ -1181,7 +1195,7 @@ void BanSearchIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
const Jupiter::ReadableString &BanSearchIRCCommand::getHelp(const Jupiter::ReadableString &)
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Searches the ban database for an entry. Syntax: bsearch [ip/steam/name/banner/active/any/all = any] <player ip/steam/name/banner>");
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Searches the ban database for an entry. Syntax: bsearch [ip/rdns/steam/name/banner/active/any/all = any] <player ip/steam/name/banner>");
return defaultHelp;
}
@ -1872,7 +1886,7 @@ void KickBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
server = servers.get(i);
if (server != nullptr)
{
player = server->getPlayerByPartName(parameters);
player = server->getPlayerByPartName(name);
if (player != nullptr)
{
player->varData.set(pluginInstance.getName(), STRING_LITERAL_AS_REFERENCE("banner"), nick);
@ -1881,6 +1895,9 @@ void KickBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &
}
}
}
if (kicks == 0)
source->sendMessage(channel, "Player \""_jrs + name + "\" not found."_jrs);
else
source->sendMessage(channel, Jupiter::StringS::Format("%u players kicked.", kicks));
}
else source->sendMessage(channel, STRING_LITERAL_AS_REFERENCE("Error: Channel not attached to any connected Renegade X servers."));

33
RenX.Core/RenX_BanDatabase.cpp

@ -31,7 +31,7 @@ RenX::BanDatabase *RenX::banDatabase = &_banDatabase;
RenX::BanDatabase &RenX::defaultBanDatabase = _banDatabase;
const Jupiter::ReferenceString DEFAULT_REASON = "(No reason information provided)";
const uint8_t write_version = 1;
const uint8_t write_version = 2U;
bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
{
@ -43,11 +43,12 @@ bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
while (!feof(file))
if (fgetc(file) == '\n')
break;
Jupiter::String rdns(128);
Jupiter::String playerName(16);
Jupiter::String key(32);
Jupiter::String value(32);
Jupiter::String reason(128);
if (RenX::BanDatabase::version < 1)
if (RenX::BanDatabase::version == 0)
reason = DEFAULT_REASON;
Entry *entry;
int c;
@ -66,6 +67,24 @@ bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
break;
}
// load rdns
if (RenX::BanDatabase::version >= 2)
{
rdns.truncate(rdns.size());
c = fgetc(file);
while (c != '\n' && c != '\0')
{
if (c == EOF)
{
fprintf(stderr, "ERROR: Unexpected EOF in %s at %lu", RenX::BanDatabase::filename.c_str(), ftell(file));
break;
}
rdns += c;
c = fgetc(file);
}
entry->rdns = rdns;
}
// load name
playerName.truncate(playerName.size());
c = fgetc(file);
@ -147,10 +166,10 @@ bool RenX::BanDatabase::load(const Jupiter::ReadableString &fname)
while (index != RenX::BanDatabase::entries.size())
RenX::BanDatabase::write(RenX::BanDatabase::entries.get(++index), file);
fclose(file);
fprintf(stdout, "Updated BanDatabase file \"%s\" from version %d to %d.", RenX::BanDatabase::filename.c_str(), RenX::BanDatabase::version, write_version);
fprintf(stdout, "Updated BanDatabase file \"%s\" from version %d to %d." ENDL, RenX::BanDatabase::filename.c_str(), RenX::BanDatabase::version, write_version);
}
else
fprintf(stdout, "CRITICAL ERROR: BanDatabase file \"%s\" failed to update from version %d to %d.", RenX::BanDatabase::filename.c_str(), RenX::BanDatabase::version, write_version);
fprintf(stdout, "CRITICAL ERROR: BanDatabase file \"%s\" failed to update from version %d to %d." ENDL, RenX::BanDatabase::filename.c_str(), RenX::BanDatabase::version, write_version);
RenX::BanDatabase::version = write_version;
}
return true;
@ -190,7 +209,11 @@ void RenX::BanDatabase::write(RenX::BanDatabase::Entry *entry, FILE *file)
fwrite(&entry->length, sizeof(time_t), 1, file);
fwrite(&entry->steamid, sizeof(uint64_t), 1, file);
fwrite(&entry->ip, sizeof(uint32_t), 1, file);
fwrite(entry->rdns.ptr(), sizeof(char), entry->rdns.size(), file);
fputc('\0', file);
fwrite(entry->name.ptr(), sizeof(char), entry->name.size(), file);
fputc('\0', file);
fwrite(entry->reason.ptr(), sizeof(char), entry->reason.size(), file);
for (size_t index = 0; index != entry->varData.size(); ++index)
{
@ -212,7 +235,9 @@ void RenX::BanDatabase::add(RenX::Server *server, const RenX::PlayerInfo *player
entry->length = length;
entry->steamid = player->steamid;
entry->ip = player->ip32;
entry->rdns = player->rdns;
entry->name = player->name;
entry->reason = reason;
// add plugin data
Jupiter::String pluginData;

1
RenX.Core/RenX_BanDatabase.h

@ -53,6 +53,7 @@ namespace RenX
time_t length /** Duration of the ban; 0 if permanent */;
uint64_t steamid /** SteamID of the banned player */;
uint32_t ip /** IPv4 address of the banned player */;
Jupiter::StringS rdns /** RDNS of the banned player */;
Jupiter::StringS name /** Name of the banned player */;
Jupiter::StringS reason /** Reason the player was banned */;
Jupiter::INIFile::Section varData; /** Variable entry data */

1
RenX.Core/RenX_PlayerInfo.h

@ -46,6 +46,7 @@ namespace RenX
// TODO: Add backpack
Jupiter::StringS name;
Jupiter::StringS ip;
Jupiter::StringS rdns;
Jupiter::StringS adminType;
Jupiter::StringS uuid;
Jupiter::StringS character;

14
RenX.Core/RenX_Server.cpp

@ -780,6 +780,11 @@ bool RenX::Server::setUUIDIfDifferent(RenX::PlayerInfo *player, const Jupiter::R
return true;
}
bool RenX::Server::resolvesRDNS()
{
return RenX::Server::resolve_player_rdns;
}
void RenX::Server::sendPubChan(const char *fmt, ...) const
{
va_list args;
@ -1026,6 +1031,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
banDatabase->deactivate(i);
else if ((this->localSteamBan && entry->steamid != 0 && entry->steamid == player->steamid)
|| (this->localIPBan && entry->ip != 0 && entry->ip == player->ip32)
|| (this->localRDNSBan && entry->rdns.isNotEmpty() && entry->rdns.equals(player->rdns))
|| (this->localNameBan && entry->name.isNotEmpty() && entry->name.equalsi(player->name)))
{
char timeStr[256];
@ -1055,6 +1061,8 @@ 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());
if (this->resolvesRDNS() && r->ip32 != 0)
r->rdns = Jupiter::Socket::resolveHostname(Jupiter::CStringS(r->ip).c_str(), 0);
r->steamid = steamid;
if (r->isBot = isBot)
r->formatNamePrefix = IRCCOLOR "05[B]";
@ -1063,6 +1071,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
this->players.add(r);
r->uuid = calc_uuid(r);
banCheck(r);
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnPlayerCreate(this, r);
@ -1075,6 +1084,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
r->ip = ip;
r->ip32 = Jupiter::Socket::pton4(Jupiter::CStringS(r->ip).c_str());
r->rdns = Jupiter::Socket::resolveHostname(Jupiter::CStringS(r->ip).c_str(), 0);
recalcUUID = true;
}
if (r->steamid == 0U && steamid != 0U)
@ -2644,10 +2654,12 @@ 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::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::localSteamBan || RenX::Server::localNameBan;
RenX::Server::localBan = RenX::Server::localIPBan || RenX::Server::localRDNSBan || RenX::Server::localSteamBan || RenX::Server::localNameBan;
RenX::Server::steamFormat = Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, "SteamFormat"_jrs, 16);
RenX::Server::neverSay = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "NeverSay"_jrs, false);
RenX::Server::resolve_player_rdns = Jupiter::IRC::Client::Config->getBool(RenX::Server::configSection, "ResolvePlayerRDNS"_jrs, true);
RenX::Server::clientUpdateRate = std::chrono::milliseconds(Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, "ClientUpdateRate"_jrs, 2500));
RenX::Server::buildingUpdateRate = std::chrono::milliseconds(Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, "BuildingUpdateRate"_jrs, 7500));
RenX::Server::pingRate = std::chrono::milliseconds(Jupiter::IRC::Client::Config->getInt(RenX::Server::configSection, "PingUpdateRate"_jrs, 60000));

9
RenX.Core/RenX_Server.h

@ -766,6 +766,13 @@ namespace RenX
*/
bool setUUIDIfDifferent(RenX::PlayerInfo *player, const Jupiter::ReadableString &uuid);
/**
* @brief Checks if reverse DNS resolution is occuring for players.
*
* @return True if this bot resolves RDNS, false otherwise.
*/
bool resolvesRDNS();
/**
* @brief Formats and sends a message to a server's corresponding public channels.
*
@ -917,8 +924,10 @@ namespace RenX
bool localBan;
bool localSteamBan;
bool localIPBan;
bool localRDNSBan;
bool localNameBan;
bool neverSay;
bool resolve_player_rdns;
unsigned short port;
int logChanType;
int adminLogChanType;

8
RenX.Core/RenX_Tags.cpp

@ -86,6 +86,7 @@ TagsImp::TagsImp()
this->INTERNAL_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_RAW_NAME_TAG = this->getUniqueInternalTag();
this->INTERNAL_IP_TAG = this->getUniqueInternalTag();
this->INTERNAL_RDNS_TAG = this->getUniqueInternalTag();
this->INTERNAL_STEAM_TAG = this->getUniqueInternalTag();
this->INTERNAL_UUID_TAG = this->getUniqueInternalTag();
this->INTERNAL_ID_TAG = this->getUniqueInternalTag();
@ -121,6 +122,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_RDNS_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_STEAM_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_UUID_TAG = this->getUniqueInternalTag();
this->INTERNAL_VICTIM_ID_TAG = this->getUniqueInternalTag();
@ -194,6 +196,7 @@ TagsImp::TagsImp()
this->nameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("NameTag"), STRING_LITERAL_AS_REFERENCE("{NAME}"));
this->rawNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("RawNameTag"), STRING_LITERAL_AS_REFERENCE("{RNAME}"));
this->ipTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("IPTag"), STRING_LITERAL_AS_REFERENCE("{IP}"));
this->rdnsTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("RDNSTag"), STRING_LITERAL_AS_REFERENCE("{RDNS}"));
this->steamTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("SteamTag"), STRING_LITERAL_AS_REFERENCE("{STEAM}"));
this->uuidTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("UUIDTag"), STRING_LITERAL_AS_REFERENCE("{UUID}"));
this->idTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("IDTag"), STRING_LITERAL_AS_REFERENCE("{ID}"));
@ -229,6 +232,7 @@ TagsImp::TagsImp()
this->victimNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimNameTag"), STRING_LITERAL_AS_REFERENCE("{VNAME}"));
this->victimRawNameTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimRawNameTag"), STRING_LITERAL_AS_REFERENCE("{VRNAME}"));
this->victimIPTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimIPTag"), STRING_LITERAL_AS_REFERENCE("{VIP}"));
this->victimRDNSTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimRDNSTag"), STRING_LITERAL_AS_REFERENCE("{VRDNS}"));
this->victimSteamTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimSteamTag"), STRING_LITERAL_AS_REFERENCE("{VSTEAM}"));
this->victimUUIDTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimUUIDTag"), STRING_LITERAL_AS_REFERENCE("{VUUID}"));
this->victimIDTag = Jupiter::IRC::Client::Config->get(configSection, STRING_LITERAL_AS_REFERENCE("VictimIDTag"), STRING_LITERAL_AS_REFERENCE("{VID}"));
@ -352,6 +356,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_RDNS_TAG, player->rdns);
PROCESS_TAG(this->INTERNAL_UUID_TAG, player->uuid);
PROCESS_TAG(this->INTERNAL_ID_TAG, Jupiter::StringS::Format("%d", player->id));
PROCESS_TAG(this->INTERNAL_CHARACTER_TAG, RenX::translateName(player->character));
@ -387,6 +392,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_RDNS_TAG, victim->rdns);
PROCESS_TAG(this->INTERNAL_VICTIM_UUID_TAG, victim->uuid);
PROCESS_TAG(this->INTERNAL_VICTIM_ID_TAG, Jupiter::StringS::Format("%d", victim->id));
PROCESS_TAG(this->INTERNAL_VICTIM_CHARACTER_TAG, RenX::translateName(victim->character));
@ -458,6 +464,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->rdnsTag, this->INTERNAL_RDNS_TAG);
fmt.replace(this->steamTag, this->INTERNAL_STEAM_TAG);
fmt.replace(this->uuidTag, this->INTERNAL_UUID_TAG);
fmt.replace(this->idTag, this->INTERNAL_ID_TAG);
@ -493,6 +500,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->victimRDNSTag, this->INTERNAL_VICTIM_RDNS_TAG);
fmt.replace(this->victimSteamTag, this->INTERNAL_VICTIM_STEAM_TAG);
fmt.replace(this->victimUUIDTag, this->INTERNAL_VICTIM_UUID_TAG);
fmt.replace(this->victimIDTag, this->INTERNAL_VICTIM_ID_TAG);

4
RenX.Core/RenX_Tags.h

@ -71,6 +71,7 @@ namespace RenX
Jupiter::StringS INTERNAL_NAME_TAG;
Jupiter::StringS INTERNAL_RAW_NAME_TAG;
Jupiter::StringS INTERNAL_IP_TAG;
Jupiter::StringS INTERNAL_RDNS_TAG;
Jupiter::StringS INTERNAL_STEAM_TAG;
Jupiter::StringS INTERNAL_UUID_TAG;
Jupiter::StringS INTERNAL_ID_TAG;
@ -106,6 +107,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_RDNS_TAG;
Jupiter::StringS INTERNAL_VICTIM_STEAM_TAG;
Jupiter::StringS INTERNAL_VICTIM_UUID_TAG;
Jupiter::StringS INTERNAL_VICTIM_ID_TAG;
@ -179,6 +181,7 @@ namespace RenX
Jupiter::StringS nameTag;
Jupiter::StringS rawNameTag;
Jupiter::StringS ipTag;
Jupiter::StringS rdnsTag;
Jupiter::StringS steamTag;
Jupiter::StringS uuidTag;
Jupiter::StringS idTag;
@ -214,6 +217,7 @@ namespace RenX
Jupiter::StringS victimNameTag;
Jupiter::StringS victimRawNameTag;
Jupiter::StringS victimIPTag;
Jupiter::StringS victimRDNSTag;
Jupiter::StringS victimSteamTag;
Jupiter::StringS victimUUIDTag;
Jupiter::StringS victimIDTag;

78
RenX.DNS/RenX_DNS.cpp

@ -1,78 +0,0 @@
/**
* Copyright (C) 2014-2015 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include <thread>
#include "Jupiter/Socket.h"
#include "Jupiter/CString.h"
#include "Jupiter/IRC_Client.h"
#include "RenX_PlayerInfo.h"
#include "RenX_Server.h"
#include "RenX_Functions.h"
#include "RenX_DNS.h"
typedef void(RenX::Server::*logFuncType)(const char *fmt, ...) const;
void RenX_DNSPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX::PlayerInfo *player)
{
if (player->isBot == false)
{
Jupiter::ReferenceString host = Jupiter::ReferenceString(Jupiter::Socket::resolveHostname(Jupiter::CStringS(player->ip).c_str(), 0));
player->varData.set(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("Host"), host);
}
}
void RenX_DNSPlugin::RenX_OnJoin(RenX::Server *server, const RenX::PlayerInfo *player)
{
if (player->isBot == false)
{
logFuncType func;
if (RenX_DNSPlugin::resolveAdmin)
{
if (RenX_DNSPlugin::resolvePublic)
func = &RenX::Server::sendLogChan;
else func = &RenX::Server::sendAdmChan;
}
else if (RenX_DNSPlugin::resolvePublic)
func = &RenX::Server::sendPubChan;
else return;
const Jupiter::ReadableString &host = player->varData.get(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("Host"), Jupiter::ReferenceString::empty);
Jupiter::ReadableString &name = RenX::getFormattedPlayerName(player);
(server->*func)(IRCCOLOR "03[DNS] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR "'s hostname resolved to: " IRCBOLD IRCCOLOR "10%.*s" IRCBOLD, name.size(), name.ptr(), host.size(), host.ptr());
}
}
int RenX_DNSPlugin::OnRehash()
{
RenX_DNSPlugin::resolveAdmin = Jupiter::IRC::Client::Config->getBool(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("ResolveAdmin"), true);
RenX_DNSPlugin::resolvePublic = Jupiter::IRC::Client::Config->getBool(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("ResolvePublic"), false);
return 0;
}
RenX_DNSPlugin::RenX_DNSPlugin()
{
RenX_DNSPlugin::OnRehash();
}
// Plugin instantiation and entry point.
RenX_DNSPlugin pluginInstance;
extern "C" __declspec(dllexport) Jupiter::Plugin *getPlugin()
{
return &pluginInstance;
}

4
RenX.Logging/RenX_Logging.cpp

@ -107,10 +107,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(), STRING_LITERAL_AS_REFERENCE("JoinAdminFormat"),
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 ". Their hostname is: " IRCBOLD "%.*s", 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->rdnsTag.size(), RenX::tags->rdnsTag.ptr()));
RenX_LoggingPlugin::joinNoSteamAdminFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("JoinNoSteamAdminFormat"),
Jupiter::StringS::Format(IRCCOLOR "12[Join] " IRCBOLD "%.*s" IRCBOLD " joined the game fighting for the %.*s from " IRCBOLD "%.*s" IRCBOLD ", but is not 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 not using Steam. Their hostname is: " IRCBOLD "%.*s", 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->rdnsTag.size(), RenX::tags->rdnsTag.ptr()));
RenX_LoggingPlugin::partFmt = Jupiter::IRC::Client::Config->get(this->getName(), STRING_LITERAL_AS_REFERENCE("PartFormat"),
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()));

4
RenX.ModSystem/RenX_ModSystem.cpp

@ -24,6 +24,8 @@
#include "RenX_Core.h"
#include "RenX_Functions.h"
using namespace Jupiter::literals;
void RenX_ModSystemPlugin::init()
{
RenX_ModSystemPlugin::modsFile.readFile(Jupiter::IRC::Client::Config->get(RenX_ModSystemPlugin::getName(), STRING_LITERAL_AS_REFERENCE("ModsFile"), STRING_LITERAL_AS_REFERENCE("Mods.ini")));
@ -172,6 +174,8 @@ int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *pla
player->access = section->getInt(STRING_LITERAL_AS_REFERENCE("Access"), group->access);
if (player->access != 0)
server->sendMessage(player, Jupiter::StringS::Format("You are now authenticated with access level %d; group: %.*s.", player->access, group->name.size(), group->name.ptr()));
if (server->getRCONUsername().equals("DevBot"_jrs))
server->sendData(Jupiter::StringS::Format("d%d\n", player->id));
Jupiter::String playerName = RenX::getFormattedPlayerName(player);
server->sendLogChan(IRCCOLOR "03[Authentication] " IRCBOLD "%.*s" IRCBOLD IRCCOLOR " is now authenticated with access level %d; group: %.*s.", playerName.size(), playerName.ptr(), player->access, group->name.size(), group->name.ptr());
return player->access;

Loading…
Cancel
Save