Wruczek / ts-website

A website for your TeamSpeak 3 server
https://ts.wruczek.tech
GNU General Public License v3.0
333 stars 80 forks source link

Banlist ip check #215

Closed cataalin closed 1 year ago

cataalin commented 1 year ago

I have seen that the $ipbanned option was deactivated, I activated it to see how it is but it seems that it does not work well, how can I fix it? He shows me this even though I ban myself. @Wruczek

fdsfdsfd

Wruczek commented 1 year ago

If you banned yourself then it's correct that you see the ban information. I do not understand, can you try explaining what is wrong?

cataalin commented 1 year ago

If you banned yourself then it's correct that you see the ban information. I do not understand, can you try explaining what is wrong?

Shouldn't it come out that you are not banned by not being? because the same thing always comes out, banned or not.

gfdgdgfd

Wouldn't it work just like in a post of yours from 2018?

image 👀 no, it's not dead ;)

image I guess the bans page is complete. Finishing the viewer now!

You don't need to enable this feature - it is on by default. In fact, there is no config for this function. Everyone banned will see this message. I was referring to the fact that you should not edit any files as all the config options are in DB.

I was saying it because I tried an autoban and nothing comes out, but what about this image? when does it appear?

image 👀 no, it's not dead ;)

image I guess the bans page is complete. Finishing the viewer now!

Wruczek commented 1 year ago

Yes, it should only show the alert if your IP is banned. So it shows it every time, even if you are not banned? Can you check what IP your website detects? Click on login and hover over the 𝝅 icon: image Now compare it to the IP banned by your TS3 server. Is it the same?

cataalin commented 1 year ago

Yes, it shows it the same all the time even if you are not prohibited, the ip is the same as the ts in the debugging, maybe I activate it wrong or something or through the https protocol could it be? I activate it by changing line 12 of bans.php, false to true.

image image

Wruczek commented 1 year ago

Line 12 does not activate anything, you have made the site think that everyone is IP banned. The configuration is in database, you don't need to change anything else.

cataalin commented 1 year ago

oh, but in the database I don't see anything related to this, not even in the translations, could you tell me where?

Wruczek commented 1 year ago

You don't need to enable this feature - it is on by default. In fact, there is no config for this function. Everyone banned will see this message. I was referring to the fact that you should not edit any files as all the config options are in DB.

cataalin commented 1 year ago

I was saying it because I tried an autoban and nothing comes out, but what about this image? when does it appear? "Your IP is not banned"

image I guess the bans page is complete. Finishing the viewer now!

Wruczek commented 1 year ago

It seems that it was removed, only the "You are banned" alert exists.

cataalin commented 1 year ago

ah I understand, that's why there is no div in body.latte, okay thanks I'll close the topic.

cataalin commented 1 year ago

It seems that it was removed, only the "You are banned" alert exists.

I have tried to self-ban, and the alert does not appear, should it appear?

fdffffffffffff

Wruczek commented 1 year ago

It should - check if the banned IP is the same as shown in the login modal screen when hovering over the 𝝅 icon.

cataalin commented 1 year ago

It should - check if the banned IP is the same as shown in the login modal screen when hovering over the 𝝅 icon.

I have checked and it is the same.

Wruczek commented 1 year ago

Can you attach a screenshot both from the 𝝅 icon and banlist? You can censor half of the IP. Also, are any other files modified? Please make sure you are using TS-website with no file modifications.

cataalin commented 1 year ago

¿Puedes adjuntar una captura de pantalla tanto del ícono 𝝅 como de la lista de prohibición? Puedes censurar la mitad de la IP. Además, ¿se modifican otros archivos? Asegúrese de estar utilizando el sitio web de TS sin modificaciones de archivos.

original website without any editing, it shows the same ip check, I have php 7.4 and use https protocol

fffffffffddddddddddddddd

Wruczek commented 1 year ago

Edit bans.php and add the following line on line 63

if ($ip === Utils::getClientIp()) {
    $ipbanned = [
        "invoker" => (string) $ban["invokername"],
        "reason" => (string) $ban["reason"]
    ];

+   var_dump($ipbanned);
}

Refresh the website, you should see additional text show up - please screenshot or copy/paste it here.

cataalin commented 1 year ago

Edit bans.php and add the following line on line 63

if ($ip === Utils::getClientIp()) {
    $ipbanned = [
        "invoker" => (string) $ban["invokername"],
        "reason" => (string) $ban["reason"]
    ];

+   var_dump($ipbanned);
}

Refresh the website, you should see additional text show up - please screenshot or copy/paste it here.

It matches me on line 53 and nothing appears, it does not show the var_dump

Wruczek commented 1 year ago

Move it after the if statement + add an echo with more info:

  if ($ip === Utils::getClientIp()) {
      $ipbanned = [
          "invoker" => (string) $ban["invokername"],
          "reason" => (string) $ban["reason"]
      ];
  }

+ var_dump($ipbanned);
+ echo "IP: $ip, Client: " . Utils::getClientIp() . "<br>\n";
cataalin commented 1 year ago

Move it after the if statement + add an echo with more info:

  if ($ip === Utils::getClientIp()) {
      $ipbanned = [
          "invoker" => (string) $ban["invokername"],
          "reason" => (string) $ban["reason"]
      ];
  }

+ var_dump($ipbanned);
+ echo "IP: $ip, Client: " . Utils::getClientIp() . "<br>\n";

now show me

bool(false) IP: 47.63.***.***, Client: 47.63.***.***

Wruczek commented 1 year ago

Those two strings must somehow be different, can you send the uncensored version via email to image?

cataalin commented 1 year ago

Those two strings must somehow be different, can you send the uncensored version via email to image?

sure, tell me what you need me to send you exactly

Wruczek commented 1 year ago

Send the same output but not censored.

cataalin commented 1 year ago

Send the same output but not censored.

sent, you can check.

Wruczek commented 1 year ago

I see, it compares against the censored IP....

Try changing these lines to:

    try {
        $ipCensored = Utils::censorIpAddress($ip);
    } catch (\Exception $e) {}

    if ($lastNickname !== null) {
        $abbreviation = [$ipCensored, "IP"];
    } else {
        $target = $ipCensored;
    }
cataalin commented 1 year ago

I see, it compares against the censored IP....

Try changing these lines to:

    try {
        $ipCensored = Utils::censorIpAddress($ip);
    } catch (\Exception $e) {}

    if ($lastNickname !== null) {
        $abbreviation = [$ipCensored, "IP"];
    } else {
        $target = $ipCensored;
    }

It seems to work, thank you very much for the help, there are a couple of other similar things that I'm trying to solve but I don't know if I should open a topic for each one, what do you think, would you have time?

fdsfdshhgf

Wruczek commented 1 year ago

Yes, each problem should have its own issue.

cataalin commented 1 year ago

Yes, each problem should have its own issue.

Ok, I was saying it so as not to make you too dizzy, I have been able to solve some things but there are some that I can't find with it, when I have time I'll tell you, thanks!