Mike Dilger on Nostr: GOSSIP: I have basic spam filtering via script working on a development branch. I'll ...
GOSSIP:
I have basic spam filtering via script working on a development branch. I'll need to optimize it and make pages for editing your script. But basically you create a script like this:
fn filter() {
if content.contains("AirDrop") {
0
} else if content.contains("Ukraine") {
0
} else {
1
}
}
0 means deny, 1 means allow, and 2 means "mute the author". The data available to the script (as scoped variables) inlcudes 'id' (hex string) 'pubkey' (hex string) 'kind' (integer) and 'content' (string). I may pass in 'now' (integer) too. The scripting language is pretty extensive. If people come up with good filtering ideas and need more variables passed in, I can enhance it.
I'm having a hard time figuring out how to spam block messages from random new pubkeys with randomized content. What is the algorithm to stop that? Maybe I should make an entropy calculation function, if the entropy is high it is probably not a human readable language.
Published at
2023-06-19 02:30:03Event JSON
{
"id": "f959a6f319adadd753d02045b94cd50183128d82485059a7ac8785e6c1a0fd60",
"pubkey": "ee11a5dff40c19a555f41fe42b48f00e618c91225622ae37b6c2bb67b76c4e49",
"created_at": 1687141803,
"kind": 1,
"tags": [
[
"client",
"gossip"
]
],
"content": "GOSSIP:\nI have basic spam filtering via script working on a development branch. I'll need to optimize it and make pages for editing your script. But basically you create a script like this:\n\nfn filter() {\n if content.contains(\"AirDrop\") {\n 0\n } else if content.contains(\"Ukraine\") {\n 0\n } else {\n 1\n }\n}\n\n0 means deny, 1 means allow, and 2 means \"mute the author\". The data available to the script (as scoped variables) inlcudes 'id' (hex string) 'pubkey' (hex string) 'kind' (integer) and 'content' (string). I may pass in 'now' (integer) too. The scripting language is pretty extensive. If people come up with good filtering ideas and need more variables passed in, I can enhance it.\n\nI'm having a hard time figuring out how to spam block messages from random new pubkeys with randomized content. What is the algorithm to stop that? Maybe I should make an entropy calculation function, if the entropy is high it is probably not a human readable language.",
"sig": "6afd7e581c4ab2f2455ceff1bfc263b41758361129f4e2e16b8f73c289a71e3e37ce551c181e7d78b0395cf1693f3119c8dd9f52a8863328f29356e29b740b46"
}