Skip to content

Check if account is shadowbanned on the run - #2059

Open
jakubkrysl wants to merge 5 commits into
RocketMap:developfrom
jakubkrysl:check-blinded
Open

Check if account is shadowbanned on the run#2059
jakubkrysl wants to merge 5 commits into
RocketMap:developfrom
jakubkrysl:check-blinded

Conversation

@jakubkrysl

@jakubkrysl jakubkrysl commented May 23, 2017

Copy link
Copy Markdown
Contributor

This PR aims to identify if accounts are shadowbanned / get shadowban on the run.

Description

One can identify shadowbanned accounts by missing pokemons in their scan. So if current account sees only "common" pokemons and no "rares", it pulls nearby active pokemons from database and compares them to what the current account sees. If there are any rare pokemons around and the current account can't see them, it sends a warning with pokemon IDs saying, the account is shadowbanned. It also writes the account to "acc_shadowbanned.csv" (only if not there yet) and sends it to recycler for -ari + 24h.
It also counts consecutive non-rare scans and if the number exceeds 20, it sends the account to recycle for -ari. It does not write to "acc_shadowbanned.csv" in this case, because this is not 100% reliable, as some rural areas can have only common pokemons. The number of consecutive counts is so high on purpose, because we have to give the previous method some time to work. This way fresh accounts get into rotation and we can use the 1st method.

Motivation and Context

Who would not want to know, if their account gets blinded? And sort them out...

How Has This Been Tested?

I was running -st 20 with blinded accounts few hours to identify common pokemons. Than I took few of these accounts and let them run the same area with not yet blinded accounts. Here is a log of found blinded account:
image

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Comment thread pogom/models.py Outdated

@blueberry0101 blueberry0101 May 23, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is a better way.

common = [16, 19, 27, 29, 32, 41, 43, 46, 52, 54, 60, 69, 72, 74, 98, 118,
          120, 129, 161, 165, 167, 177, 183, 187, 194, 198, 209, 218]

rare_ids = [x for x in range(1, 250) if x not in common]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant better way finding common pokemons than using this kind of list of IDs.Tthis is mostly cosmetic change, but looks better, you are right :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

range(1,252)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aRengo the rare_ids list is constructed from range, but IDs of common pokemons are substracted from the list. So the range is not complete, that's the whole point :D

@jakubkrysl

jakubkrysl commented May 24, 2017

Copy link
Copy Markdown
Contributor Author

I just added the rest of confirmed common pokemons, source reddit.
I am looking into possiblity of confirming shadowbanned accounts by checking the store for items, it seems shadowbanned accounts can't see any items buyable by coins, they only see real money exchanges. To clarify: blindness is a symptom of shadowban.
So far I traced the request to GET_STORE_ITEMS protobuf object, but I have no idea how to access it as it is in platform of pgoapi and not with the rest of protobufs. Could definitely use some help there...

EDIT: Checking store for missing items does not seem to be a reliable way to check for shadowban. The account has to be flagged too for this to happen, but flag != shadowban. So no point in doing another check this way, if it can't check for shadowban alone...

@sebastienvercammen

sebastienvercammen commented May 24, 2017

Copy link
Copy Markdown
Member

@Thetacz

2: Preferably not. The idea of using the shop to identify blind accounts (because they could only see coins) was a good one, but it's apparently not true for everyone. As an alternative, I suggest looking at scan data: it seems blind accounts don't get all details the regular accounts are getting, as the 'enabled' field was missing and triggered a KeyError. 'enabled' is a field that's usually always received.

But we've also started working on a PGoClient wrapper around PGoAPI, which could include a status such as banned/flagged/blind, and which could automatically update the account status after every request. @aRengo

3: Look at the flow for banned accounts. Iirc, we remove them from queue, output to logs, and never retry that account.

@jakubkrysl

Copy link
Copy Markdown
Contributor Author

Now it properly recycles the accounts (in case the shadowbans get lifted after some time - stil not confirmed). I can either leave it as it is and those accounts will get re-tried after user specified time, set some fixed time for shadowbanned (needs more reaserch, being done at #pogodev) or completely discard the account (or leave it there and add if that will skip shadowbanned accounts)

image

@jakubkrysl

jakubkrysl commented May 24, 2017

Copy link
Copy Markdown
Contributor Author

@sebastienvercammen Just compared response from shadowbanned and not. Those responses only differ in visible pokemons (aside from account specific - types of pokemon it seen, stats etc...). They both have the same amount of 'enabled' fields (same location). 'enabled' field only occurs in forts, could not see it anywhere else. All 'enabled' fields were set to true in both responses.

EDIT: missclick on close, sry :/

@jakubkrysl jakubkrysl closed this May 24, 2017
@jakubkrysl jakubkrysl reopened this May 24, 2017
Comment thread pogom/search.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the logger (%s) instead of string with {} some stuff {} in it.format(foo,bar)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alderon86 I used %s before, but changed it for consistency with line #836. If you insist so much, I will change it in a heatbeat. :)

@jakubkrysl jakubkrysl May 25, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should I split the mesage to more lines? (Similar way as is done in models.py when logging empty spawnpoint - line 2375)

Comment thread pogom/search.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

               status['message'] = (
                    'Account %s could not find pokemon ID: %s. ' +
                    'Possibly shadowbanned, switching accounts... ' ,e.account['username'], e.missed_ids)

Comment thread pogom/search.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

               status['message'] = (
                    'Account %s could not find pokemon ID: %s. ' +
                    'Possibly shadowbanned, switching accounts... ', e.account['username'], e.missed_ids)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stackoverflow.com/a/11589591
But you are right, looks nicer.

@Alderon86

Alderon86 commented May 25, 2017

Copy link
Copy Markdown
Contributor

1.list of rare pokemons constains some common ones that I have not encountered yet in my area. For example: Have not seen bulba in ages, any nest to test if he is common? 2.Do we want to identify blinded accounts based on their inability to find rare pokemons? (Warn after X consecutive rareless finds...) 3.What do we want to do with identified blinded accounts?

1.Bulba and any other of the starter pokemons are not common.
2.I like the idea of giving a warning after 5 times fails to scan a rare, after 10 fails mark it as shadowbanned
3.remove from rotation and give a log/status warning that the account is blind/shadowbanned and is removed from rotation.

Ofc just my two cents

@jakubkrysl jakubkrysl changed the title [WIP] Check if account is blinded on the run Check if account is shadowbanned on the run May 30, 2017
@sebastienvercammen sebastienvercammen added this to the 4.0.0 milestone Jun 1, 2017
@Borges-Wellington

Copy link
Copy Markdown

Does anyone know how to implement mapbox leaflet in place of gmap? For Internet browsing and others. I have other instances that do a scan and wanted an interface booklet

@Buncertainc

Copy link
Copy Markdown
Contributor

It seems that No.77 Ponyta should also be included in the common_ids.

@jakubkrysl

Copy link
Copy Markdown
Contributor Author

@Buncertainc Do you have some source for that? Or any location of Ponyta nest, so I can test it?

@Buncertainc

Copy link
Copy Markdown
Contributor

@Thetacz No, Sorry. It's only from my accounts' experience. I have several blinded accounts which are able to find Ponyta.

@tomballgithub

Copy link
Copy Markdown
Contributor

@Thetacz Ponyta nest @ 30.168453, -95.7407196

@sebastienvercammen

Copy link
Copy Markdown
Member

@wellington1092 This is not the place for that.

@Thetacz Awaiting changes, or ready for review?

@jakubkrysl

jakubkrysl commented Jun 6, 2017

Copy link
Copy Markdown
Contributor Author

@Buncertainc Thanks for the tip, it seems to be true.
@tomballgithub Thanks, using that nest I confirmed, ponyta is among common pokemons. Adding it to the list.
@sebastienvercammen Just added ponyta to common list, so it is ready for review. Sorry for the delay, too much new stuff going on IRL :)

@pki0

pki0 commented Jun 9, 2017

Copy link
Copy Markdown

What about a new column "blind" in workerstatus? If an account hits the shadowban set blind to '1', else '0'.
This would make scripts for automatic restart/account changing more easy and comfortable.
Just a suggestion .

Edit: Or a column named "Status" with OK/Blind/Banned as options

@jakubkrysl

Copy link
Copy Markdown
Contributor Author

@pokemonkiel That seems like out of scope of this PR as that should be solved by proper account manager. Generally I like the idea, but accounts get unshadowbanned, so there would have to be a way to check and reset the flag in DB. And that is definitely out of scope and work for proper account manager...Now we just send accounts to rest.
I implemented saving to file, so there is room for custom management. Without the need for future massive code change on RM side.

@Kimuji

Kimuji commented Jun 17, 2017

Copy link
Copy Markdown

I'm currently trying your PR.
From what i saw it seems that event related pokemons are still displayed for shadowbanned accounts.
So it means during events this PR isn't detecting those blind accounts.

I understand the logic behind your PR, but why is the warning "spawnpoint xxx has no Pokemon N times in a row." not used in a way or an other in the detection ?

@SiteEffect

Copy link
Copy Markdown
Contributor

An option would be to make the list a flag with current list as default and let map maintainers adjust them during an event.

@SiteEffect

SiteEffect commented Jun 19, 2017

Copy link
Copy Markdown
Contributor

This is the current list common_list for the live event:

    common_ids = [16, 19, 23, 27, 29, 32, 37, 41, 43, 46, 52, 54, 58, 60,
                  69, 72, 74, 77, 81, 90, 98, 118, 120, 129, 155, 161, 165,
                  167, 177, 183, 187, 191, 194, 198, 209, 218, 220, 228]

If you find anything else being common, let us know. I am not sure about Lapras # 131.

@friscoMad

friscoMad commented Jun 20, 2017

Copy link
Copy Markdown
Contributor

I am not sure about this system I do see what -redacted- does a lot simpler just check wild + nearby for rare pokemons, nearby list is large and is uncommon to don't have any rare pokemon in the list.
This system seem more exact except when the whole map start blinding at the same time, I would see this being better if we do pause blind accounts asap

@SiteEffect

SiteEffect commented Jul 7, 2017

Copy link
Copy Markdown
Contributor

Re-check list and rebase, please :-)
Looks like the shadowbans are back.

@SiteEffect

SiteEffect commented Jul 15, 2017

Copy link
Copy Markdown
Contributor

There is a conflict with models.py left. You need to rebase to the new API objects instead of dicts.

@jakubkrysl

Copy link
Copy Markdown
Contributor Author

Sadly I don't have any free time now. Soonest date I can get to this is 4 days from now, but more probable is next week. Sorry guys for keeping you waiting with broken code.

@SiteEffect

Copy link
Copy Markdown
Contributor

No hurry 👍 enjoy!

It's ALIVE!!!!!
@jakubkrysl

Copy link
Copy Markdown
Contributor Author

Missclick on wrong branch, reopening and working again :)

@jakubkrysl jakubkrysl reopened this Jul 29, 2017
Happy Travis is happy
@tobias86aa

Copy link
Copy Markdown

Nice :)

@boby361

boby361 commented Jul 31, 2017

Copy link
Copy Markdown

So happy to see this. Have been so patient.

@boby361

boby361 commented Aug 4, 2017

Copy link
Copy Markdown

So i have a weird bug. I restarted my server and i got this error:
Traceback (most recent call last):
File "runserver.py", line 20, in
from pogom.app import Pogom
File "C:\Servers\RocketMap-Boby361\pogom\app.py", line 19, in
from .models import (Pokemon, Gym, Pokestop, ScannedLocation,
File "C:\Servers\RocketMap-Boby361\pogom\models.py", line 35, in
from .customLog import printPokemon
File "C:\Servers\RocketMap-Boby361\pogom\customLog.py", line 5, in
args = get_args()
File "C:\Servers\RocketMap-Boby361\pogom\utils.py", line 41, in wrapper
rv = function(*args)
File "C:\Servers\RocketMap-Boby361\pogom\utils.py", line 679, in get_args
args.username.pop(i)
IndexError: pop index out of range

If i rename my shadow ban file to somethhing else. it works. The file hasn't been touched in awhile. The formatting seems all proper (UTF-8). there is nothing missing. no extra space. nothing. it fixes itself if i remove accounts out. It happened with 17 accounts in it. Thoughts? Edit Its happened with less accounts now.

@jakubkrysl

jakubkrysl commented Aug 6, 2017

Copy link
Copy Markdown
Contributor Author

@boby361 This is still PR so things change from time to time and some are not backwards compatible. I added 4th field to the file, timestamp. Your old file has probably only 3 fields. So either check the code and add proper timestamp or delete it and let it create a new one.
Also check if you have the same account more than once in the file. Could not check the possibility, but would be very interested if it happens.

@boby361

boby361 commented Aug 6, 2017

Copy link
Copy Markdown

Yeah the file only contains lines with the 4 fields. Everything seems to work properly. It's just weird how it randomly throws this issue. I have other people having the same issue with the same fix (using the same fork. Although it's just a up to date RM develop branch + this PR) it happened to me on windows server 2016 although one of my scanning contributors had same issue on Ubuntu.

Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Sep 12, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
@jorgitoh

jorgitoh commented Oct 5, 2017

Copy link
Copy Markdown

Hi. Any progress with this PR?. Now we have Temp Ban and shadow bans again. I think is time to put an eye in this PR.

@sebastienvercammen

Copy link
Copy Markdown
Member

@jorgitoh Then go ahead and finish it yourself, it's open source. Otherwise stay silent if you have nothing to contribute.

Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Oct 24, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Oct 24, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Nov 11, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Dec 9, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Dec 19, 2017
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Alderon86 added a commit to Alderon86/RocketMap that referenced this pull request Jan 4, 2018
Alderon86 added a commit to Alderon86/RocketMap that referenced this pull request Jan 6, 2018
Alderon86 added a commit to Alderon86/RocketMap that referenced this pull request Jan 7, 2018
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Jan 13, 2018
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Galacticaa added a commit to Galacticaa/RocketMap that referenced this pull request Jan 13, 2018
A subtle blend of sLoPPy's detection and PR RocketMap#2059 with a bunch of tweaks
of my own. Looks for "non-common" Pokemon on each scan to update
non-rare scan counts accordingly. No account switching, just logs.

TODO: Put this stuff in a database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.