forked from jeremyvillanuevar/scripting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSendFileExploitFixV3.1.sp
More file actions
126 lines (108 loc) · 2.62 KB
/
Copy pathSendFileExploitFixV3.1.sp
File metadata and controls
126 lines (108 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "SendFile Exploit Fix (v3.1)",
author = "backwards",
description = "Prevents Clients From Exploiting The Un-Patched SRCDS SendFile Command, V3 Adds ReceiveFile Support.)",
version = "3.1",
url = "http://www.steamcommunity.com/id/mypassword"
}
#define MAX_FILES_ALLOWED_WHILE_ACTIVE_PER_MAP 256
#define MAX_FILES_ALLOWED_UPLOAD 32
bool InLevel[MAXPLAYERS+1] = {false, ...};
int RequestCount[MAXPLAYERS+1] = {0, ...};
int SendCount[MAXPLAYERS+1] = {0, ...};
public OnPluginStart()
{
CreateTimer(5.0, DecrementThread, _, TIMER_REPEAT);
if (GetEngineVersion() != Engine_CSGO)
return;
new Address:addy = GameConfGetAddress(LoadGameConfigFile("SendFileExploitFix_csgo_1_2_2021"), "CheckReceivingList");
new OS = LoadFromAddress(addy + Address:1, NumberType_Int8);
switch(OS)
{
case 0x89: //Linux
{
for(int i = 0;i<5;i++)
StoreToAddress((addy + Address:0x3B9 + view_as<Address>(i)), 0x90, NumberType_Int8);
}
case 0x8B: //Windows
{
for(int i = 0;i<2;i++)
StoreToAddress((addy + Address:0x270 + view_as<Address>(i)), 0x90, NumberType_Int8);
}
default:
{
SetFailState("CheckReceivingList Signature Incorrect. (0x%.2x)", OS);
}
}
}
public Action:DecrementThread(Handle:timer, any:unused)
{
for (new client = 0; client <= MaxClients; client++)
{
RequestCount[client] -= 32;
if(RequestCount[client] < 0)
RequestCount[client] = 0;
}
return Plugin_Continue;
}
public OnMapStart()
{
for (new client = 1; client <= MaxClients; client++)
{
if(IsClientConnected(client))
{
if(IsClientInGame(client))
{
InLevel[client] = true;
RequestCount[client] = 0;
SendCount[client] = 0;
}
}
}
}
public OnMapEnd()
{
for (new client = 1; client <= MaxClients; client++)
{
InLevel[client] = false;
RequestCount[client] = 0;
SendCount[client] = 0;
}
}
public OnClientPutInServer(client)
{
InLevel[client] = true;
RequestCount[client] = 0;
SendCount[client] = 0;
}
public OnClientDisconnect(client)
{
RequestCount[client] = 0;
SendCount[client] = 0;
}
public Action OnFileSend(int client, const char[] sFile)
{
if(InLevel[client])
{
RequestCount[client]++;
if(RequestCount[client] > MAX_FILES_ALLOWED_WHILE_ACTIVE_PER_MAP)
{
if(!IsClientInKickQueue(client))
KickClient(client, "ServerCrashExploitAttempt.");
return Plugin_Stop;
}
}
return Plugin_Continue;
}
public Action OnFileReceive(int client, const char[] sFile)
{
SendCount[client]++;
if(SendCount[client] > MAX_FILES_ALLOWED_UPLOAD)
{
if(!IsClientInKickQueue(client))
KickClient(client, "ServerCrashExploitAttempt.");
}
}