Author Topic: Automatic ss implemented on the server  (Read 23552 times)

Offline eleison

  • Grunt
  • ***
  • Posts: 220
    • 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);
}

Offline iL

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 1653
    • View Profile
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
« Last Edit: May 19, 2021, 06:41:40 AM by iL »
Need help to translate War2Combat to German, French, Italian, Polish or another language: http://forum.war2.ru/index.php/topic,4728.0.html
Please, contact me if you are interested in that.

Offline eleison

  • Grunt
  • ***
  • Posts: 220
    • 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 :)

Offline Certified MENSA Genius Brain (smart)

  • "The Architect"
  • Global Moderator
  • Dragon
  • *****
  • Posts: 5384
    • View Profile
Re: Automatic ss implemented on the server
« Reply #18 on: May 19, 2021, 10:51:34 AM »
This is awesome!!
    

Offline Player

  • Axe Thrower
  • ****
  • Posts: 484
    • 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.

Offline RipE[Eur0]

  • Berserker
  • *****
  • Posts: 715
  • 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!!

Offline RipE[Eur0]

  • Berserker
  • *****
  • Posts: 715
  • 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

Offline RipE[Eur0]

  • Berserker
  • *****
  • Posts: 715
  • 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

Offline woofy

  • Server Admin
  • Berserker
  • *****
  • Posts: 647
    • 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!

Offline tk[as]

  • Server Admin
  • Dragon
  • *****
  • Posts: 5021
    • 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.

Offline tk[as]

  • Server Admin
  • Dragon
  • *****
  • Posts: 5021
    • 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.

Offline iL

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 1653
    • View Profile
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...
Need help to translate War2Combat to German, French, Italian, Polish or another language: http://forum.war2.ru/index.php/topic,4728.0.html
Please, contact me if you are interested in that.

Offline RipE[Eur0]

  • Berserker
  • *****
  • Posts: 715
  • 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??

Offline iL

  • Administrator
  • Ogre Mage
  • *****
  • Posts: 1653
    • View Profile
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...
Need help to translate War2Combat to German, French, Italian, Polish or another language: http://forum.war2.ru/index.php/topic,4728.0.html
Please, contact me if you are interested in that.

Offline RipE[Eur0]

  • Berserker
  • *****
  • Posts: 715
  • 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