War2.ru Slogan
News: All hail our wise & benevolent admins!


Welcome, Guest. Please login or register.

Login with username, password and session length
Welcome to the forums! We're glad to have you here! :) You can register your account here, then feel free to introduce yourself in the Server.War2.ru board & let us know who you are on the server.

Automatic ss implemented on the server 1118  29

Grunt Posts: 153 Karma: +8/-0 ***

eleison

  • Grunt
  • ***
  • Posts: 153
    • View Profile
Re: Automatic ss implemented on the server
« Reply #15 on: May 19, 2021, 02:13:53 AM »
Here is some PHP that will find map hack of the screenshots. Like you said Mistral it might give false positive if ss is not from start of game. But even for small maps I think it's very rare that you scout every black pixel on map...

Code: [Select]
$image_name = '041658_L45.png';
$image_src = '/ss/May14/12349_chopppppppppp/'.$image_name;
$image = imagecreatefrompng($image_src);
$totalBlack = 0;
$area = array(
    array(26, 27),
    array(153, 27),
    array(26, 154),
    array(153, 154)
);

// 26 and 153 is one pixel in to avoid first black pixel in row.
// x and y + 2 to count every second pixel, to avoid counting fog of war.

for ($y = $area[0][1]; $y < $area[2][1]; $y = $y + 2 ) {
    for($x = $area[0][0]; $x < $area[3][0]; $x = $x + 2 ) {
        $value = imagecolorat($image, $x, $y);
        if($value == 0){
            $totalBlack++;
        }

    }
}

// Found map hack
if($totalBlack != 0){
    copy($image_src, '/ss/suspected/'.$image_name);
}
Administrator Ogre Mage Posts: 1532 Karma: +149/-11 *****

iL

  • Administrator
  • Ogre Mage
  • *****
  • *
  • Posts: 1532
    • View Profile
*

iL

Re: Automatic ss implemented on the server
« Reply #16 on: May 19, 2021, 06:04:40 AM »
eleison, thx for your script!
I think that is a great way of communication:
you are posting script, i am copying it.

Modified it a little:
Code: [Select]
<?php
// [url]https://forum.war2.ru/index.php?topic=6261.msg95452[/url]
// code by eleison

$shortopts="";
$longopts=array(
    
"img:"
);
$cmdlineoptions getopt($shortopts$longopts);

isset(
$cmdlineoptions["img"]) || die("usage: file --img=filename<br>\n");

$image_src=$cmdlineoptions["img"];
$image_url=substr($image_src,strpos($image_src,"/ss/"));

$image = @imagecreatefrompng($image_src);
if(
$image === false)die("error opening file <a href=$image_url>$image_url</a><br>\n");

$totalBlack 0;
$area = array(
    array(
2627),
    array(
15327),
    array(
26154),
    array(
153154)
);

// 26 and 153 is one pixel in to avoid first black pixel in row.
// x and y + 2 to count every second pixel, to avoid counting fog of war.

for ($y $area[0][1]; $y $area[2][1]; $y $y ) {
    for(
$x $area[0][0]; $x $area[3][0]; $x $x ) {
        
$value imagecolorat($image$x$y);
        if(
$value == 0){
            
$totalBlack++;
        }

    }
}

// Found map hack
if($totalBlack != 0){
//    echo "copy($image_src, '/ss/suspected/'.$image_name);$totalBlack\n";
//    echo " <a href=$image_url>$image_url</a> totalBlack: $totalBlack<br>\n";
}
else echo 
"possible map hack for image: <a href=$image_url>$image_url</a><br>\n";
Log to read is here: http://server.war2.ru/ss/log.html
Grunt Posts: 153 Karma: +8/-0 ***

eleison

  • Grunt
  • ***
  • Posts: 153
    • View Profile
Re: Automatic ss implemented on the server
« Reply #17 on: May 19, 2021, 07:28:27 AM »
Nice : )
It was just an example. Thanks for implementing it! Sorry for my misstypo with if($totalBlack != 0){}, was ofc meant to be if($totalBlack == 0). Anyways good work :)
"The Architect" Global Moderator Dragon Posts: 5243 Karma: +208/-112 *****

Certified MENSA Genius Brain (smart)

  • "The Architect"
  • Global Moderator
  • Dragon
  • *****
  • *
  • Posts: 5243
    • View Profile
Re: Automatic ss implemented on the server
« Reply #18 on: May 19, 2021, 10:51:34 AM »
This is awesome!!
Axe Thrower Posts: 354 Karma: +47/-2 ****

Player

  • Axe Thrower
  • ****
  • Posts: 354
    • View Profile
Re: Automatic ss implemented on the server
« Reply #19 on: May 19, 2021, 01:11:27 PM »
Really nice!!!  Also want to thank Dellam for helping the community test the accuracy of these anti-hack efforts.
Berserker Posts: 689 Karma: +38/-2 LAWL! LICK MY RIPESTICKZ0R H0M0 :D *****

RipE[Eur0]

  • Berserker
  • *****
  • *
  • Posts: 689
  • LAWL! LICK MY RIPESTICKZ0R H0M0 :D
    • View Profile
Re: Automatic ss implemented on the server
« Reply #20 on: May 20, 2021, 05:39:41 AM »
very nice shit.

so i just write /ss ingame ? and can do it 3 times in one game. v nice. v nice indeed guys!!
Berserker Posts: 689 Karma: +38/-2 LAWL! LICK MY RIPESTICKZ0R H0M0 :D *****

RipE[Eur0]

  • Berserker
  • *****
  • *
  • Posts: 689
  • LAWL! LICK MY RIPESTICKZ0R H0M0 :D
    • View Profile
Re: Automatic ss implemented on the server
« Reply #21 on: May 20, 2021, 05:41:08 AM »
and v nice if u get anti map hack code too <3
Berserker Posts: 689 Karma: +38/-2 LAWL! LICK MY RIPESTICKZ0R H0M0 :D *****

RipE[Eur0]

  • Berserker
  • *****
  • *
  • Posts: 689
  • LAWL! LICK MY RIPESTICKZ0R H0M0 :D
    • View Profile
Re: Automatic ss implemented on the server
« Reply #22 on: May 20, 2021, 05:41:27 AM »
finally great things ppl. im really grateful! nice job guys
Server Admin Berserker Posts: 564 Karma: +56/-4 *****

woofy

  • Server Admin
  • Berserker
  • *****
  • Posts: 564
    • View Profile
Re: Automatic ss implemented on the server
« Reply #23 on: May 30, 2021, 06:30:44 PM »
hi iL, can you please re-enable this? tk[as] told me he's really bad and after losing so much he's thinking about h4xing!
Server Admin Death Knight Posts: 4462 Karma: +110/-13 *****

tk[as]

  • Server Admin
  • Death Knight
  • *****
  • *
  • Posts: 4462
    • View Profile
Re: Automatic ss implemented on the server
« Reply #24 on: May 30, 2021, 09:13:25 PM »
i've been hacking the last 5 years ... with my mind.

if im playing vs Slugs[anz] i enable the "hack against slugs mode"  and just send a few peons around my base occasionally waiting for him to do a horrible towering strategy.
Server Admin Death Knight Posts: 4462 Karma: +110/-13 *****

tk[as]

  • Server Admin
  • Death Knight
  • *****
  • *
  • Posts: 4462
    • View Profile
Re: Automatic ss implemented on the server
« Reply #25 on: May 30, 2021, 09:21:28 PM »
and after he fails.. i wait like 30 more seconds and start sending peons around again because his pride is hurt and he is hell bent on succeeding ... so he will try to do the horrible tower strat again.

i repeat this like 2 more times until he finally gives up.

ripe is just as persistent.
Administrator Ogre Mage Posts: 1532 Karma: +149/-11 *****

iL

  • Administrator
  • Ogre Mage
  • *****
  • *
  • Posts: 1532
    • View Profile
*

iL

Re: Automatic ss implemented on the server
« Reply #26 on: June 01, 2021, 03:59:54 AM »
hi iL, can you please re-enable this? tk[as] told me he's really bad and after losing so much he's thinking about h4xing!
Re-enabled.
Looks like the problem with crases is not related to that ss request mechanism. So going to fix crashes other ways...
Berserker Posts: 689 Karma: +38/-2 LAWL! LICK MY RIPESTICKZ0R H0M0 :D *****

RipE[Eur0]

  • Berserker
  • *****
  • *
  • Posts: 689
  • LAWL! LICK MY RIPESTICKZ0R H0M0 :D
    • View Profile
Re: Automatic ss implemented on the server
« Reply #27 on: June 02, 2021, 04:46:59 AM »
lately it hasnt worked for me. ive typed in several games , several days /ss.

is that cuz of the opponent has some old/odd version of war2??
Administrator Ogre Mage Posts: 1532 Karma: +149/-11 *****

iL

  • Administrator
  • Ogre Mage
  • *****
  • *
  • Posts: 1532
    • View Profile
*

iL

Re: Automatic ss implemented on the server
« Reply #28 on: June 02, 2021, 06:36:21 AM »
lately it hasnt worked for me. ive typed in several games , several days /ss.

is that cuz of the opponent has some old/odd version of war2??
Should work fine, at least for you. But for others also.
Some problems could (in theory) appear if they didn't restart war2 since last update (2 days ago), though should work fine also...

Try now plz, just restarted the backend...
Berserker Posts: 689 Karma: +38/-2 LAWL! LICK MY RIPESTICKZ0R H0M0 :D *****

RipE[Eur0]

  • Berserker
  • *****
  • *
  • Posts: 689
  • LAWL! LICK MY RIPESTICKZ0R H0M0 :D
    • View Profile
Re: Automatic ss implemented on the server
« Reply #29 on: June 02, 2021, 09:22:39 AM »
aight pasiba k0mrat!!11