User Tools

Site Tools


mastodon_spam_scanner

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
mastodon_spam_scanner [2023/02/09 03:19]
admin
mastodon_spam_scanner [2023/02/09 04:14]
admin
Line 79: Line 79:
       }       }
       $percent_complete = number_format(($progress/​$total)*100,​1);​       $percent_complete = number_format(($progress/​$total)*100,​1);​
-      $moderation_link = $mastodon_host."/​admin/​accounts?​origin=local&​username="​.$username;​+      $moderation_link = "<a href='$mastodon_host/​admin/​accounts?​origin=local&​username="​.$username."'>​mod link</​a><​br />";
       echo $score."​\t$username\t$moderation_link\n";​       echo $score."​\t$username\t$moderation_link\n";​
       // this outputs a progress indicator to stderr       // this outputs a progress indicator to stderr
Line 91: Line 91:
  
 ?> ?>
 +</​code>​
 +
 +I added a moderation link to the CSV output so I can just open that file in a browser with this for example:
 +<code bash>
 +php scan_for_spammers.php | grep -E "​^4"​ > output.html
 +</​code>​
 +
 +To answer a question on Mastodon; ​ You could add a list of spam keywords or suspicious urls at the top of the file, for example:
 +
 +<code php>
 +$spam_keywords = array('​spam_term',​ '​spamwebsite.com'​);​
 +</​code>​
 +
 +Then add a loop just after the ''​foreach($attachment..''​ to search the profile text for a url or keyword, for example, adding this would increase the score generated based on more keywords matching:
 +
 +<code php>
 +      foreach($spam_keywords as $keyword) {
 +         ​if(preg_match("/​$keyword/​i",​ $json['​summary'​]))
 +            $score++;
 +      }
 +
 </​code>​ </​code>​
  
 Back to the [[Mastodon]] page. Back to the [[Mastodon]] page.
mastodon_spam_scanner.txt ยท Last modified: 2023/05/02 10:11 by neil