Skip to content

Commit

Permalink
Removed Kill Detection/Added Knife Wound Detection
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisAlienus committed Jan 15, 2024
1 parent a668dbb commit d11a27b
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ For More info on what each line means in the Output, please visit: https://www.g
- `Explosions`: it's possible for someone to be a false positive on explosions particularly if they're driving around an armor piece such as a BTR spamming HE.
- `ServerMoveTimeStampExpired`: it's possible for someone to be a false positive on this if they lag a lot or have high ping.
- `ClientNetSpeed`: Unknown if tied to Cheaters yet. Set Threshold to `0` to Disable.
- `Kills`: This one it's obviously possible for false positives on good players. Set to `0` by Default to Disable
- `KnifeWounds`: Detects the Total Amount of Knife Kills in a Player's Session. Set Threshold to `0` to Disable.
- `FOBHits`: Damage to a FOB Radio. Restricted to only what is logged currently in the logs.

## What in the world is `ServerMoveTimeStampExpired`???
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"explosionThreshold": 200,
"serverMoveTimeStampExpiredThreshold": 1000,
"clientNetSpeedThreshold": 18000,
"killsThreshold": 0,
"knifeWoundsThreshold": 15,
"fobHitsThreshold": 100,
"liveThreshold": 50,
"seedingMinThreshold": 5
Expand Down
42 changes: 18 additions & 24 deletions squad-server/plugins/discord-cheaters.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export default class DiscordCheaters extends DiscordBasePlugin {
clientNetSpeedThreshold: {
required: true,
description: 'Client Net Speed Threshold.',
example: 1800
example: 18000
},
killsThreshold: {
knifeWoundsThreshold: {
required: true,
description: 'Kills Detection Threshold.',
example: 200
description: 'Knife Wounds Detection Threshold.',
example: 15
},
fobHitsThreshold: {
required: true,
Expand Down Expand Up @@ -104,7 +104,7 @@ export default class DiscordCheaters extends DiscordBasePlugin {
async checkVersion() {
const owner = 'IgnisAlienus';
const repo = 'SquadJS-Cheater-Detection';
const currentVersion = 'v1.1.2';
const currentVersion = 'v1.2.0';

try {
const latestVersion = await getLatestVersion(owner, repo);
Expand Down Expand Up @@ -311,7 +311,7 @@ export default class DiscordCheaters extends DiscordBasePlugin {
Explosions: data.getVar('explosionCountersPerController'),
ServerMoveTimeStampExpired: data.getVar('serverMoveTimestampExpiredPerController'),
ClientNetSpeed: data.getVar('playerControllerToNetspeed'),
Kills: data.getVar('killsPerPlayerController'),
KnifeWounds: data.getVar('knifeWoundsPerPlayerController'),
FOBHits: data.getVar('fobHitsPerController')
};

Expand Down Expand Up @@ -340,11 +340,11 @@ export default class DiscordCheaters extends DiscordBasePlugin {
minCount = this.options.clientNetSpeedThreshold;
break;
}
case 'Kills':
if (this.options.killsThreshold === 0) {
case 'KnifeWounds':
if (this.options.knifeWoundsThreshold === 0) {
break;
} else {
minCount = this.options.killsThreshold;
minCount = this.options.knifeWoundsThreshold;
break;
}
case 'FOBHits':
Expand Down Expand Up @@ -422,6 +422,7 @@ export default class DiscordCheaters extends DiscordBasePlugin {
);
const playerControllerToNetspeed = data.getVar('playerControllerToNetspeed');
const killsPerPlayerController = data.getVar('killsPerPlayerController');
const knifeWoundsPerPlayerController = data.getVar('knifeWoundsPerPlayerController');
const fobHitsPerController = data.getVar('fobHitsPerController');
const steamIDToPlayerController = data.getVar('steamIDToPlayerController');
const playerControllerHistory = steamIDToPlayerController.get(playerSteamID);
Expand All @@ -446,28 +447,21 @@ export default class DiscordCheaters extends DiscordBasePlugin {
row: `# > ${playerController}: (${stringifiedConnectionTime} - ${stringifiedDisconnectionTime})`
});
contentBuilding.push({
row: `# >>>>>${explosionCountersPerController[playerController] || 0} Explosions, ${
serverMoveTimestampExpiredPerController[playerController] || 0
} ServerMoveTimeStampExpired, ${
playerControllerToNetspeed[playerController] || 0
} ClientNetSpeed, ${killsPerPlayerController[playerController] || 0} Kills, ${
fobHitsPerController[playerController] || 0
} FOB Hits`
row: `# >>>>>${explosionCountersPerController[playerController] || 0} Explosions, ${serverMoveTimestampExpiredPerController[playerController] || 0
} ServerMoveTimeStampExpired, ${playerControllerToNetspeed[playerController] || 0
} ClientNetSpeed, ${killsPerPlayerController[playerController] || 0} Kills, ${knifeWoundsPerPlayerController[playerController] || 0} Knife Wounds, ${fobHitsPerController[playerController] || 0
} FOB Hits`
});
this.verbose(
1,
`\x1b[1m\x1b[34m#\x1b[0m > \x1b[90m ${playerController}\x1b[90m: \x1b[37m(${stringifiedConnectionTime} - ${stringifiedDisconnectionTime})\x1b[90m`
);
this.verbose(
1,
`\x1b[1m\x1b[34m#\x1b[0m >>>>> \x1b[91m${
explosionCountersPerController[playerController] || 0
} Explosions, ${
serverMoveTimestampExpiredPerController[playerController] || 0
} ServerMoveTimeStampExpired, ${
playerControllerToNetspeed[playerController] || 0
} ClientNetSpeed, ${killsPerPlayerController[playerController] || 0} Kills, ${
fobHitsPerController[playerController] || 0
`\x1b[1m\x1b[34m#\x1b[0m >>>>> \x1b[91m${explosionCountersPerController[playerController] || 0
} Explosions, ${serverMoveTimestampExpiredPerController[playerController] || 0
} ServerMoveTimeStampExpired, ${playerControllerToNetspeed[playerController] || 0
} ClientNetSpeed, ${killsPerPlayerController[playerController] || 0} Kills, ${knifeWoundsPerPlayerController[playerController] || 0} Knife Wounds, ${fobHitsPerController[playerController] || 0
} FOB Hits\x1b[0m`
);
}
Expand Down
45 changes: 45 additions & 0 deletions squad-server/utils/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class Analyzer extends EventEmitter {
data.setVar('playerControllerToSteamID', [])
data.setVar('steamIDToPlayerController', new Map())
data.setVar('killsPerPlayerController', [])
data.setVar('knifeWoundsPerPlayerController', [])
data.setVar('connectionTimesByPlayerController', [])
data.setVar('disconnectionTimesByPlayerController', [])
data.setVar('playerControllerToNetspeed', [])
Expand Down Expand Up @@ -284,6 +285,30 @@ export default class Analyzer extends EventEmitter {
killsPerPlayerController[playerController]++;
return;
}

regex = /Wound\(\): Player:.+from (.+) caused by (.+)/;
res = regex.exec(line);
if (res) {
let playerController = res[1]
if (!playerController || playerController == 'nullptr') {
const playerNameToPlayerController = data.getVar('playerNameToPlayerController')
const pawnsToPlayerNames = data.getVar('pawnsToPlayerNames')
playerController = playerNameToPlayerController[pawnsToPlayerNames[res[2]]]
}
let weaponUsed = res[2]
let knives = ['BP_AK74Bayonet', 'BP_AKMBayonet', 'BP_Bayonet2000', 'BP_G3Bayonet', 'BP_M9Bayonet', 'BP_OKC-3S', 'BP_QNL-95_Bayonet', 'BP_SA80Bayonet', 'BP_SKS_Bayonet', 'BP_SKS_Optic_Bayonet', 'BP_SOCP_Knife_AUS'];
// If weaponUsed is any of the knives
if (!knives.includes(weaponUsed)) {
return;
}
if (this.options.PLAYER_CONTROLLER_FILTER == "" || this.options.PLAYER_CONTROLLER_FILTER == playerController)
data.incrementFrequencyCounter('PlayerKnifeWounds', 1)

const knifeWoundsPerPlayerController = data.getVar('knifeWoundsPerPlayerController')
if (!knifeWoundsPerPlayerController[playerController]) knifeWoundsPerPlayerController[playerController] = 0;
knifeWoundsPerPlayerController[playerController]++;
return;
}
} else {
regex = /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquad: PostLogin: NewPlayer: BP_PlayerController_C .+PersistentLevel\.(.+) \(IP: ([\d\.]+) \| Online IDs: EOS: (.+) steam: (\d+)\)/;
res = regex.exec(line);
Expand Down Expand Up @@ -328,6 +353,26 @@ export default class Analyzer extends EventEmitter {
killsPerPlayerController[playerController]++;
return;
}

regex = /^\[([0-9.:-]+)]\[([ 0-9]*)]LogSquadTrace: \[DedicatedServer](?:ASQSoldier::)?Wound\(\): Player:(.+) KillingDamage=(?:-)*([0-9.]+) from ([A-z_0-9]+) \(Online IDs: EOS: ([\w\d]{32}) steam: (\d{17}) \| Controller ID: ([\w\d]+)\) caused by ([A-z_0-9-]+)_C/;
res = regex.exec(line);
if (res) {
let playerController = res[5]

let weaponUsed = res[9]
let knives = ['BP_AK74Bayonet', 'BP_AKMBayonet', 'BP_Bayonet2000', 'BP_G3Bayonet', 'BP_M9Bayonet', 'BP_OKC-3S', 'BP_QNL-95_Bayonet', 'BP_SA80Bayonet', 'BP_SKS_Bayonet', 'BP_SKS_Optic_Bayonet', 'BP_SOCP_Knife_AUS'];
// If weaponUsed is any of the knives
if (!knives.includes(weaponUsed)) {
return;
}
if (this.options.PLAYER_CONTROLLER_FILTER == "" || this.options.PLAYER_CONTROLLER_FILTER == playerController)
data.incrementFrequencyCounter('PlayerKnifeWounds', 1)

const knifeWoundsPerPlayerController = data.getVar('knifeWoundsPerPlayerController')
if (!knifeWoundsPerPlayerController[playerController]) knifeWoundsPerPlayerController[playerController] = 0;
knifeWoundsPerPlayerController[playerController]++;
return;
}
}

// regex = /\[.+\]\[([\s\d]+)\]LogSquad: Player (.+) has been added to Team/;
Expand Down

0 comments on commit d11a27b

Please sign in to comment.