2018-03-05 12:28:41 +01:00
|
|
|
from disposable_email_domains import blacklist
|
2016-10-31 23:28:20 +01:00
|
|
|
|
2018-05-10 19:13:36 +02:00
|
|
|
def is_reserved_subdomain(subdomain: str) -> bool:
|
2016-10-31 23:28:20 +01:00
|
|
|
if subdomain in ZULIP_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
|
|
|
if subdomain[-1] == 's' and subdomain[:-1] in ZULIP_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
|
|
|
if subdomain in GENERIC_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
|
|
|
if subdomain[-1] == 's' and subdomain[:-1] in GENERIC_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2018-05-10 19:13:36 +02:00
|
|
|
def is_disposable_domain(domain: str) -> bool:
|
2016-11-05 03:26:30 +01:00
|
|
|
return domain.lower() in DISPOSABLE_DOMAINS
|
|
|
|
|
2016-10-31 23:28:20 +01:00
|
|
|
ZULIP_RESERVED_SUBDOMAINS = frozenset([
|
2016-12-25 21:31:34 +01:00
|
|
|
# zulip terms
|
2016-10-31 23:28:20 +01:00
|
|
|
'stream', 'channel', 'topic', 'thread', 'installation', 'organization', 'realm',
|
2017-07-26 17:38:56 +02:00
|
|
|
'team', 'subdomain', 'activity', 'octopus', 'acme', 'push',
|
2016-12-25 21:31:34 +01:00
|
|
|
# machines
|
2016-10-31 23:28:20 +01:00
|
|
|
'zulipdev', 'localhost', 'staging', 'prod', 'production', 'testing', 'nagios', 'nginx',
|
2016-12-25 21:31:34 +01:00
|
|
|
# website pages
|
2016-10-31 23:28:20 +01:00
|
|
|
'server', 'client', 'features', 'integration', 'bot', 'blog', 'history', 'story',
|
2017-07-26 17:38:56 +02:00
|
|
|
'stories', 'testimonial', 'compare', 'for', 'vs',
|
2016-12-25 21:31:34 +01:00
|
|
|
# competitor pages
|
|
|
|
'slack', 'mattermost', 'rocketchat', 'irc', 'twitter', 'zephyr', 'flowdock', 'spark',
|
2017-07-26 17:38:56 +02:00
|
|
|
'skype', 'microsoft', 'twist', 'ryver', 'matrix', 'discord', 'email', 'usenet',
|
2016-12-25 21:31:34 +01:00
|
|
|
# zulip names
|
2016-10-31 23:28:20 +01:00
|
|
|
'zulip', 'tulip', 'humbug',
|
2016-12-25 21:31:34 +01:00
|
|
|
# platforms
|
2016-10-31 23:28:20 +01:00
|
|
|
'plan9', 'electron', 'linux', 'mac', 'windows', 'cli', 'ubuntu', 'android', 'ios',
|
2016-12-25 21:31:34 +01:00
|
|
|
# floss
|
2017-07-26 17:38:56 +02:00
|
|
|
'contribute', 'floss', 'foss', 'free', 'opensource', 'open', 'code', 'license',
|
2016-12-25 21:31:34 +01:00
|
|
|
# intership programs
|
|
|
|
'intern', 'outreachy', 'gsoc', 'gci', 'externship',
|
|
|
|
# tech blogs
|
|
|
|
'engineering', 'infrastructure', 'tooling', 'tools', 'javascript', 'python'])
|
2016-10-31 23:28:20 +01:00
|
|
|
|
|
|
|
# Most of this list was curated from the following sources:
|
|
|
|
# http://wiki.dwscoalition.org/notes/List_of_reserved_subdomains (license: CC-BY-SA 3.0)
|
|
|
|
# http://stackoverflow.com/questions/11868191/which-saas-subdomains-to-block (license: CC-BY-SA 2.5)
|
|
|
|
GENERIC_RESERVED_SUBDOMAINS = frozenset([
|
|
|
|
'about', 'abuse', 'account', 'ad', 'admanager', 'admin', 'admindashboard',
|
|
|
|
'administrator', 'adsense', 'adword', 'affiliate', 'alpha', 'anonymous',
|
|
|
|
'api', 'assets', 'audio', 'badges', 'beta', 'billing', 'biz', 'blog',
|
|
|
|
'board', 'bookmark', 'bot', 'bugs', 'buy', 'cache', 'calendar', 'chat',
|
|
|
|
'clients', 'cname', 'code', 'comment', 'communities', 'community',
|
|
|
|
'contact', 'contributor', 'control', 'coppa', 'copyright', 'cpanel', 'css',
|
|
|
|
'cssproxy', 'customise', 'customize', 'dashboard', 'data', 'demo', 'deploy',
|
|
|
|
'deployment', 'desktop', 'dev', 'devel', 'developer', 'development',
|
|
|
|
'discussion', 'diversity', 'dmca', 'docs', 'donate', 'download', 'e-mail',
|
|
|
|
'email', 'embed', 'embedded', 'example', 'explore', 'faq', 'favorite',
|
|
|
|
'favourites', 'features', 'feed', 'feedback', 'files', 'forum', 'friend',
|
|
|
|
'ftp', 'general', 'gettingstarted', 'gift', 'git', 'global', 'graphs',
|
|
|
|
'guide', 'hack', 'help', 'home', 'hostmaster', 'https', 'icon', 'im',
|
|
|
|
'image', 'img', 'inbox', 'index', 'investors', 'invite', 'invoice', 'ios',
|
|
|
|
'ipad', 'iphone', 'irc', 'jabber', 'jars', 'jobs', 'join', 'js', 'kb',
|
|
|
|
'knowledgebase', 'launchpad', 'legal', 'livejournal', 'lj', 'login', 'logs',
|
|
|
|
'm', 'mail', 'main', 'manage', 'map', 'media', 'memories', 'memory',
|
|
|
|
'merchandise', 'messages', 'mobile', 'my', 'mystore', 'networks', 'new',
|
|
|
|
'newsite', 'official', 'ogg', 'online', 'order', 'paid', 'panel', 'partner',
|
|
|
|
'partnerpage', 'pay', 'payment', 'picture', 'policy', 'pop', 'popular',
|
|
|
|
'portal', 'post', 'postmaster', 'press', 'pricing', 'principles', 'privacy',
|
|
|
|
'private', 'profile', 'public', 'random', 'redirect', 'register',
|
|
|
|
'registration', 'resolver', 'root', 'rss', 's', 'sandbox', 'school',
|
|
|
|
'search', 'secure', 'servers', 'service', 'setting', 'shop', 'shortcuts',
|
|
|
|
'signin', 'signup', 'sitemap', 'sitenews', 'sites', 'sms', 'smtp', 'sorry',
|
|
|
|
'ssl', 'staff', 'stage', 'staging', 'stars', 'stat', 'static', 'statistics',
|
|
|
|
'status', 'store', 'style', 'support', 'surveys', 'svn', 'syn',
|
|
|
|
'syndicated', 'system', 'tag', 'talk', 'team', 'termsofservice', 'test',
|
|
|
|
'testers', 'ticket', 'tool', 'tos', 'trac', 'translate', 'update',
|
|
|
|
'upgrade', 'uploads', 'use', 'user', 'username', 'validation', 'videos',
|
|
|
|
'volunteer', 'web', 'webdisk', 'webmail', 'webmaster', 'whm', 'whois',
|
|
|
|
'wiki', 'www', 'www0', 'www8', 'www9', 'xml', 'xmpp', 'xoxo'])
|
2016-11-05 03:26:30 +01:00
|
|
|
|
2018-03-05 12:28:41 +01:00
|
|
|
DISPOSABLE_DOMAINS = frozenset(blacklist)
|