add checking for total/active to filter additional instances (#7)

pull/8/head
Domenic Horner 2023-06-26 06:23:23 +08:00 committed by GitHub
parent 4aae212769
commit 453ac4ca19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -2,7 +2,7 @@ import requests
from loguru import logger from loguru import logger
from fediseer.consts import FEDISEER_VERSION from fediseer.consts import FEDISEER_VERSION
def retrieve_suspicious_instances(activity_suspicion = 20): def retrieve_suspicious_instances(activity_suspicion = 20, active_suspicious = 500):
# GraphQL query # GraphQL query
query = ''' query = '''
{ {
@ -67,6 +67,12 @@ def retrieve_suspicious_instances(activity_suspicion = 20):
if node["total_users"] / local_activity > activity_suspicion: if node["total_users"] / local_activity > activity_suspicion:
is_bad = True is_bad = True
# print(node) # print(node)
# check active users (monthly is a lot lower than total users)
if node["total_users"] / node["active_users_monthly"] > active_suspicious:
is_bad = True
# print(node)
if is_bad: if is_bad:
bad_node = { bad_node = {
"domain": node["domain"], "domain": node["domain"],