1. There is no such thing as a "pending" ban or Steam admin. Anyone threatening your account is a scammer trying to scare you. Read more.

SteamRep Plugin SourceBans Modification

Discussion in 'SteamRep General Discussion' started by Enstage, Apr 23, 2015.

  1. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    A couple of days ago I made a bit of a modification to my servers SourceBans so that all bans that are made by the SteamRep plugin seem to be from the admin 'STEAMREP', you can see them here: bans.smexy-trading.net.

    I decided to release it, I have fully automated the installation since I only just threw it together for myself. Anyone with even the slightest PHP knowledge could have done this by the way. I have only tested this on SourceBans 1.4.11.

    Installation:

    1. Navigate to your SourceBans database and execute this:

    INSERT INTO sb_admins(`aid` , `user`) VALUES(`1000` , 'STEAMREP');
    2. Put this code in a text editor:

    <?php

    // ENSTAGE 2015
    // http://steamcommunity.com/profiles/76561198065405581
    //
    // v1.0.0
    // 24/04/2015


    /* ------- INSTALLATION -------
    * 1. Input your database details below and save them
    * 2. Place this file in your sourcebans installion's /pages/ folder
    * 3. Navigate to this script in your browser
    * 4. Uncomment (Remove the //), from the next line: */

    //if(!defined("IN_SB")){echo "You should not be here. Only follow links!";die();}


    //Input your servers address here
    $servername = "[SERVERNAME HERE]";

    //The suername used to access your database
    $username = "[USERNAME HERE]";

    //The password for this user
    $password = "[PASSWORD HERE]";

    //The name of your database
    $database = "[DATABASE NAME HERE]";

    //Choose the name of the SteamRep user. Default: SteamRep
    $sruser = "SteamRep";

    // This is the Admin ID of the SteamRep user in the SourceBans database, set to 1000 by default
    // If for some reason you have more than 1000 admins, or that value is taken, make it larger
    $aid = "1000";




    /* ------------------- DONT TOUCH ANYTHING BELOW HERE ------------------- */

    $conn = new mysqli($servername, $username, $password, $database);

    if ($IS_SET_INCLUDE == "")
    {
    //The user is running the script manually


    $insert = "INSERT INTO sb_admins (`aid`, `user`) VALUES ($aid, '$sruser');";
    $conn->query($insert);

    // Insert the include info and variable to page.banlist.php
    $data="\$IS_SET_INCLUDE = 1; include 'steamrep.php';";
    $filecontent=file_get_contents('page.banlist.php');
    $pos=strpos($filecontent, 'function setPostKey()');
    $filecontent=substr($filecontent, 0, $pos)."\r\n".$data."\r\n".substr($filecontent, $pos);
    file_put_contents("page.banlist.php", $filecontent);

    echo "The script has successfully run, any issues report them to: http://steamcommunity.com/profiles/76561198065405581";

    }
    else if ($IS_SET_INCLUDE == "1")
    {
    //Someone is loading the bans page
    $sql = "UPDATE sb_bans SET aid=" . $aid . " WHERE reason LIKE '%Player is a reported scammer%' OR reason LIKE '%A scammer has connected from this IP.%'";
    $conn->query($sql);
    }

    $conn->close;

    ?>

    3. Put your database information between the quotes: " "
    4. Upload the script to the pages folder on your SourceBans installation.
    5. Open the page.banlist.php file in the ../pages/ folder.
    6. Place the following on line #20 (after the line "global $userbank;" and before the line "function setPostKey()":

    include_once('steamrep.php');
    7. Save and close. It should now work.

    Notes:

    - You can change the name of the STEAMREP user simply by modifying the SQL query in step 1.
    - You can also add other custom users, for example I also added one for our name hacking detector plugin.
    Last edited: Mar 30, 2016
  2. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    Use this query for 1. (It broke when I posted it for some reason)

    INSERT INTO sb_admins (`aid`, `user`) VALUES (1000 , 'STEAMREP');

    (It would be awesome if a staff member could modify it for me).
  3. SilentReaper(SR)

    SilentReaper(SR) Retired Staff

    Messages:
    11,991
    SteamRep Admin:
    STEAM_0:0:89705646
    I'll ping the ppl that look into this here: @jameless @Bottswana
    Might be an idea to combine it etc.
  4. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    I'll make a quick script that does the whole thing automatically.
  5. SilentReaper(SR)

    SilentReaper(SR) Retired Staff

    Messages:
    11,991
    SteamRep Admin:
    STEAM_0:0:89705646
    I meant with the plugin itself.
  6. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    Mmk,

    just create an admin with an admin id, and all bans added by the plugin should be by that admin id. Simple.

    enjoy
  7. Bottswana

    Bottswana Retired Staff Partner Community

    Messages:
    42
    Steam:
    STEAM_0:1:10230195
    I believe the current version of this plugin bans via ConsoleCommand so displaying the ban from another user would be problematic, without converting to using the SourceBans natives.
    Roudydogg1 and Enstage like this.
  8. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    I don't think it would be.

    Regardless, I'm 100% sure you can do it with an extra query or two, it's just whether or not you want that. Just put a CVar in for it.

    I highly doubt you need help, but if you want me to, I'm able to.
  9. Bottswana

    Bottswana Retired Staff Partner Community

    Messages:
    42
    Steam:
    STEAM_0:1:10230195
    The SteamRep plugin for SourceMod does not make SQL queries to create the bans, it fires sm_ban via the console session.
    Roudydogg1 and SilentReaper(SR) like this.
  10. Enstage

    Enstage SteamRep Admin Partner Community Donator - Tier V

    Messages:
    4,705
    Steam:
    STEAM_0:1:52569926
    Ah ok,

    My MALWARE-SUSPECTED-mediafire- link is apparently MalWare according to XenForo.

    Here it is again: http://www.MALWARE-SUSPECTED-mediafire-.com/view/43t471xem7pmk1i/steamrep.php

    Here is the source:

    PHP:
    <?php

    //   ENSTAGE 2015
    //   http://steamcommunity.com/profiles/76561198065405581
    //  
    //   v1.0.0
    //   24/04/2015


    /* ------- INSTALLATION -------
    *  1. Input your database details below and save them
    *  2. Navigate to this script in your browser
    *  3. Uncomment (Remove the //), from the next line: */

    //if(!defined("IN_SB")){echo "You should not be here. Only follow links!";die();}


    //Input your servers address here
    $servername "[SERVERNAME HERE]";

    //The suername used to access your database
    $username "[USERNAME HERE]";

    //The password for this user
    $password "[PASSWORD HERE]";

    //The name of your database
    $database "[DATABASE NAME HERE]";

    //Choose the name of the SteamRep user. Default: SteamRep
    $sruser "SteamRep";

    // This is the Admin ID of the SteamRep user in the SourceBans database, set to 1000 by default
    // If for some reason you have more than 1000 admins, or that value is taken, make it larger
    $aid "1000";




    /*    ------------------- DONT TOUCH ANYTHING BELOW HERE ------------------- */

    $conn = new mysqli($servername$username$password$database);

    if (
    $IS_SET_INCLUDE == "")
    {
        
    //The user is running the script manually


        
    $insert "INSERT INTO sb_admins (`aid`, `user`) VALUES ($aid, '$sruser');";
        
    $conn->query($insert);

        
    // Insert the include info and variable to page.banlist.php
          
    $data="\$IS_SET_INCLUDE = 1; include 'steamrep.php';";
        
    $filecontent=file_get_contents('page.banlist.php');
        
    $pos=strpos($filecontent'function setPostKey()');
        
    $filecontent=substr($filecontent0$pos)."\r\n".$data."\r\n".substr($filecontent$pos);
        
    file_put_contents("page.banlist.php"$filecontent);
       
        echo 
    "The script has successfully run, any issues report them to: http://steamcommunity.com/profiles/76561198065405581";

    }
    else if (
    $IS_SET_INCLUDE == "1")
    {
        
    //Someone is loading the bans page
        
    $sql "UPDATE sb_bans SET aid=" $aid " WHERE reason LIKE '%Player is a reported scammer%' OR reason LIKE '%A scammer has connected from this IP.%'";
        
    $conn->query($sql);
    }

    $conn->close;

    ?>
    (Could I pretty please get someone to either delete this thread entirely, or edit the main post to include this source and delete the old installation...
  11. SilentReaper(SR)

    SilentReaper(SR) Retired Staff

    Messages:
    11,991
    SteamRep Admin:
    STEAM_0:0:89705646
    There where various hijackers active on the forum, abusing MALWARE-SUSPECTED-mediafire- as a host for their malware, we break these links automatically.