Giter Club home page Giter Club logo

matrix-spam-scripts's Introduction

Setup

config.json

{
  "accessToken": "xxx"
}

Scripts

fetch-events-from-room.js

Paginate from the beginning of the room to the specified --stop-date if provided and save all events to ./data/{roomId}/messages in ndjson(new-line delimited JSON) format to be processed by the other scripts.

You can also resume progress if the program errors or stops by passing the --resume flag.

node fetch-events-from-room.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host

node fetch-events-from-room.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host --stop-date 1618468687519

node fetch-events-from-room.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host --resume

find-bad-events.js

Looks through the locally persisted events from fetch-events-from-room.js and identifies the senders and event ID's that match the given regex. Results are saved out to ./data/{roomId}/bad-event-ids-{date}.txt and ./data/{roomId}/bad-senders-{date}.txt.

node find-bad-events.js --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host --grep "awfe"

node find-bad-events.js --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host --grep "hello\? there"

clean-up-bad-events.js

Takes a list of bad event ID's and redacts them. (see script above for creating the list)

node clean-up-bad-events.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb_my.matrix.host --bad-event-ids-file-path "./data/!SdfEMelMdOPSHyPEBb_my.matrix.host/bad-event-ids-1648694479383.txt" --concurrency 1

clean-up-bad-users.js

Takes a list of bad user MXID's and bans them, which also kicks them (see script above for creating the list).

node clean-up-bad-users.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb_my.matrix.host --bad-event-ids-file-path "./data/!SdfEMelMdOPSHyPEBb_my.matrix.host/bad-senders-1648694479383.txt" --concurrency 1

collate-bad-senders-and-get-bad-servers.js

node collate-bad-senders-and-get-bad-servers.js --room-id !SdfEMelMdOPSHyPEBb:my.matrix.host"

find-bulk-spam-membership-in-room.js

The logic in this is pretty specific to the incident we were using it with but it looks through all of the room membership and finds MXID's which match a certain pattern.

If --membership-file-path is not provided, it will fetch the membership again.

Results are saved out to ./data/{roomId}/bulk-spam-mxids-{date}.txt and ./data/{roomId}/bulk-spam-servers-{date}.txt.

node find-bulk-spam-membership-in-room.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb_my.matrix.host --since 1648425600000

node find-bulk-spam-membership-in-room.js --homeserver-url http://localhost:18008 --room-id !SdfEMelMdOPSHyPEBb_my.matrix.host --since 1648425600000 --membership-file-path "./data/!SdfEMelMdOPSHyPEBb_my.matrix.host/members-1648774700622.ndjson"

matrix-spam-scripts's People

Contributors

madlittlemods avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

matrix-spam-scripts's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.