Skip to content

Commit

Permalink
Added new script to pull battle logs and put them on the webserver (t…
Browse files Browse the repository at this point in the history
…o investigate allegations of cheating).
  • Loading branch information
Antar1011 committed May 21, 2012
1 parent 7ddd4d0 commit 0842cfa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pullLogs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
cd /home/po/pokemon-online/bin/logs/battles
mkdir "/var/www/Admin/battleLogs/$1"
for (( n=0; n<=$2; n++ ))
do
x=$(date -d "$n days ago" +%Y-%m-%d)
for i in $(grep -lir "$1's team" $x)
do
cp $i "/var/www/Admin/battleLogs/$1/".
done
done
17 changes: 17 additions & 0 deletions scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ var help = [
"** ADMINISTRATOR COMMANDS",
"/resetLadder tier -- resets the ratings for the specified tier.",
"/resetPlayerRating name:tier -- resets the rating of the user in the tier to 1000.",
"/pullLogs name:num -- pull all battle logs for user for the past num days and put them on the web server.",
"/clearpass user -- Clear user's password.",
"/destroy channel -- Deletes a channel.",
"/stopBattles -- Prevents new battles from starting (useful if server needs to be restarted).",
Expand Down Expand Up @@ -941,6 +942,22 @@ addOwnerCommand("resetPlayerRating", function(player,tier) {
announce(this.name + " reset the rating of " + player + " in "+tier);
});

addOwnerCommand("pullLogs", function(playerName,days) {
if (sys.id(playerName) === undefined && sys.dbIp(playerName) === undefined) {//make sure user exists
announce(this.id, "Invalid user name.");
return;
}
days = parseInt(days); //sanitize
if (days < 0) {
announce(this.id, "Invalid date range.");
return;
}

sys.system("./pullLogs.sh \""+playerName+"\" "+days+" &");
announce(this.id, "Log pull for "+playerName+" initiated.");
announce(this.id, "Look for the logs in http://po.smogon.com/Admin/battleLogs/"+playerName);
});

addModCommand("wall", function() {
var message = toArray(arguments).join(":");
announce(this.name + ": " + message);
Expand Down

0 comments on commit 0842cfa

Please sign in to comment.