Skip to content

Instantly share code, notes, and snippets.

@skidunion
Last active April 13, 2024 09:26
Show Gist options
  • Save skidunion/8fb085b41d30a81ec9bd8029c34b2d87 to your computer and use it in GitHub Desktop.
Save skidunion/8fb085b41d30a81ec9bd8029c34b2d87 to your computer and use it in GitHub Desktop.
Personal Shadowsocks filter list
from sys import argv
from base64 import b64decode
from urllib.parse import urlparse
def to_acl(line: str) -> str:
rule = line.lstrip('|.').replace('*', '/').rstrip('/')
# Append protocol if not included
if not rule.startswith("http://") and not rule.startswith("https://"):
rule = "http://" + rule
hostname = urlparse(rule).hostname.replace('.', '\\.')
return f"(?:^|\.){hostname}$"
with open(argv[1]) as list:
list = list.read()
if 'AutoProxy' not in list:
# Needs to be decoded
list = b64decode(list.encode()).decode()
list = filter(
lambda line: line[0] not in '![', list.splitlines())
acl = set(map(to_acl, list))
print("""
[bypass_all]
[proxy_list]
""", '\n'.join(acl), sep='\n')
from sys import argv
from datetime import datetime
from hashlib import md5
from base64 import b64encode
def main():
with open(argv[1]) as list:
list = list.read()
list = list.replace("{last_modified}", datetime.utcnow().strftime(
f"%a, %d %b %Y %H:%M:%S UTC"))
without_checksum = '\n'.join(
filter(lambda line: line != '! Checksum: {checksum}', list.splitlines()))
checksum = b64encode(
md5(without_checksum.encode()).digest()).decode()[:-2]
list = list.replace("{checksum}", checksum)
result = b64encode(list.encode()).decode()
for chunk in range(0, len(result) // 64 + 1):
start = chunk * 64
print(result[start:start+64])
if __name__ == "__main__":
main()
[bypass_all]
[proxy_list]
(?:^|\.)twimg\.com$
(?:^|\.)protonmail\.com$
(?:^|\.)intel\.com$
(?:^|\.)medium\.com$
(?:^|\.)auth0\.openai\.com$
(?:^|\.)x\.com$
(?:^|\.)opensea\.io$
(?:^|\.)twitter\.com$
(?:^|\.)linkedin\.com$
(?:^|\.)theins\.ru$
(?:^|\.)instagram\.com$
(?:^|\.)remove\.bg$
(?:^|\.)chat\.openai\.com$
(?:^|\.)protonmail\.ch$
(?:^|\.)rutracker\.org$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Shadowsocks filter list.
! Contains some sites blocked in Russia, as well
! as sites with their own Kampfs.
!--------------Oficially blocked----------------
||yt3.ggpht.com
||medium.com
||x.com
||twitter.com
||twimg.com
||t.co
||proton.me
||protonmail.com
||protonmail.ch
||opensea.io
||facebook.com
||instagram.com
||rutracker.org
||theins.ru
||linkedin.com
!------------Purposefully blocked---------------
||intel.com
||remove.bg
||chat.openai.com
||auth0.openai.com
||cdn.oaistatic.com
!---------------------EOF-----------------------
.yt3.ggpht.com
.builds.parsec.app
.twitter.com
.t.co
.twimg.com
.proton.me
.protonmail.ch
.protonmail.com
.medium.com
.intel.com
.openai.com
.oaistatic.com
.gemini.google.com
.bing.com
.microsoft.com
.live.com
.spotify.com
.anydesk.com
.linkedin.com
.licdn.com
.tumblr.com
.soundcloud.com
.quora.com
.fbcdn.net
.meta.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment