|
Gostaria de saber se existe um tipo de proteзгo para ataques Shell. Um filter script ou uma forma de criar um.
Caso alguйm souber uma forma de criar uma defesa, por favor poste. Ou.. й a EMPRESA que tem de criar uma proteзгo ? |
//Anti DDoS Attack Filterscript by Jankingston. Feel free to modify ;)
#include <a_samp>
#include <FileFunctions>
#define ATTACK_TYPE_PLAYERID 1
#define ATTACK_TYPE_IP 2
new File:ServerLogFile;
new addostimer;
main()
{
print("|----------------------------------|");
print("| Anti DDOS filterscript v0.1 |");
print("|----------------------------------|");
}
public OnFilterScriptInit()
{
ServerLogFile = fileOpen("server_log.txt", io_Read);
addostimer = SetTimer("Anti-DDoS", 100, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(addostimer);
return 1;
}
forward AntiDDoS();
public AntiDDoS()
{
if(!ServerLogFile)
{
print("Error opening server_log.txt!");
KillTimer(addostimer);
}
else
{
new string[128];
new strarr[2][20];
fileSeek(ServerLogFile, -128, seek_End);
while(fileRead(ServerLogFile, string)){}
new pos = strfind(string, "Invalid client connecting from ", true, 10);
if(pos == 11)
{
OnDDosAttackAttempt(ATTACK_TYPE_IP, INVALID_PLAYER_ID, string[pos+31]);
}
pos = strfind(string, "Warning: /rcon command exploit from: ", true, 10);
if(pos == 11){
split(string[pos+37], strarr, ':');
OnDDosAttackAttempt(ATTACK_TYPE_PLAYERID, strval(strarr[0]), strarr[1]);
}
pos = strfind(string, "Warning: PlayerDialogResponse PlayerId: ", true, 10);
if(pos == 11){
new idx = 0;
new plid = strval(strtok(string[pos+39], idx));
SetPVarInt(plid, "dialogDDosAtt", GetPVarInt(plid, "dialogDDosAtt")+1);
print("");
if(GetPVarInt(plid, "dialogDDosAtt") > 2)OnDDosAttackAttempt(ATTACK_TYPE_PLAYERID, plid, " ");
}
pos = strfind(string, "Warning: PlayerDialogResponse crash exploit from PlayerId: ", true, 10);
if(pos == 11){
new idx = 0;
OnDDosAttackAttempt(ATTACK_TYPE_PLAYERID, strval(strtok(string[pos+59], idx)), " ");
}
pos = strfind(string, "Packet was modified, sent by id: ", true, 10);
if(pos == 11){
split(string[pos+33], strarr, ',');
OnDDosAttackAttempt(ATTACK_TYPE_PLAYERID, strval(strarr[0]), " ");
}
pos = strfind(string, "Remote Port Refused for Player: ", true, 10);
if(pos == 11){
new idx = 0;
OnDDosAttackAttempt(ATTACK_TYPE_PLAYERID, strval(strtok(string[pos+32], idx)), " ");
}
if(strfind(string, " due to a 'server full' attack") != -1)
{
pos = strfind(string, "Blocking ", true, 10);
if(pos == 12)
{
new idx = 0;
OnDDosAttackAttempt(ATTACK_TYPE_IP, INVALID_PLAYER_ID, strtok(string[pos+9], idx));
}
}
}
}
forward OnDDosAttackAttempt(type, playerid, ip[]);
public OnDDosAttackAttempt(type, playerid, ip[])
{
new string[128];
if(type == ATTACK_TYPE_PLAYERID)
{//block a playerid
BanEx(playerid, "DDOS protect");
printf("Blocked attack from playerid %d", playerid);
}else if(type == ATTACK_TYPE_IP)
{//block an ip address
format(string, sizeof(string), "banip %s", ip);
SendRconCommand(string);
printf("Blocked attack from ip: %s", ip);
}
}
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
stock split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
#include a_samp
#if !defined varGet
#define varGet(%0) getproperty(0,%0)
#endif
// https://sampforum.blast.hk/showthread.php?pid=1925909#pid1925909
#if !defined varSet
#define varSet(%0,%1) setproperty(0, %0, %1)
#endif
stock botGetIP[24];
#define IsPlayerBot(%0)\
GetPlayerPing(%0) == 65535 && (gettime() - varGet((GetPlayerIp(%0, botGetIP, sizeof botGetIP), botGetIP)) > 5)
public OnPlayerConnect(playerid) {
if(IsPlayerNPC(playerid)) return false;
static
playerip[24]
;
GetPlayerIp(playerid, playerip, 24);
if(gettime() - varGet(playerip) < 2) {
strcat(playerip, "di_S");
if(gettime() - varGet(playerip) < 3) {
return false;
}
printf("%d Entrou em menos de 2 segundos", playerid);
GetPlayerIp(playerid, playerip, 20);
varSet(playerip, gettime());
strcat(playerip, "x");
static timers ;
timers = varGet(playerip);
varSet(playerip, 1+ timers);
if(timers > 2) {
playerip[strlen(playerip) - 2] = 0;
printf("BOT: ID -> %d IP -> %s", playerid, playerip);
BanEx(playerid, "Bot Connect");
}
}
return varSet(playerip, gettime());
}
public OnPlayerDisconnect(playerid, reason) {
if(reason == 2) {
static
playerip[20]
;
GetPlayerIp(playerid, playerip, 20);
strcat(playerip, "di_S");
varSet(playerip, gettime());
}
return false;
}
|
Nao cara eh serio, procura na internet.. Shell.
Primeiramente o cara cria um site acho num VPS ou Dedicado que pode atacar com DoS depois ele executa o comando no GNU e comeзa atacar. |
|
Te passei 2 fs. um para ddos de dentro do servidor "com o player conectado"
o segundo e se entrar 2 ips ao mesmo tempo ele vai banir os 2. ou se o mesmo ip conectar varias vezes ira ban tmb o segundo vai servir pra voce . 1 є um attack ddos pode ser executado de qualquer lugar que tenha uma conexao a rede . 2 є quem iria cria uma shell pra attack um servidor de samp ? que com um simples ddos um script basico em python cairia '--' , ou ate uma lagada basica com algum bot. ja ouviu fala em slowloris , t50 ,SynFlood,Slowhttptest , sao varios scripts simples mas que ja causam estragos. |
|
Ataques que sгo feitos com mбquinas dedicadas sу com uma mбquina com proteзгo fнsica ou muito bem embolada pra proteger.
Nгo vai ser um FilterScript ou Include ou Plugin que vai lhe livrar de atacks assim, acredite. Sу atacks que sгo feitos com ferramentas para atacar servidores SA-MP que se pode resolver com FS/Includes. Fora isso, melhor entrar com o suporte da empresa sobre o assunto, ou comprar uma VPS com uma proteзгo boa. :/ |

|
ddos и simplesmente ips conectando ao mesmo tempo e isso resulta em leg que o servidor/site/vps nao da conta de responder as conexao e cai
|
CLOSED