def setup_captive_portal_app():
cpm = Flask(__name__)
cpm.add_url_rule('/success.html',
'success',
cp_check_ios_lt_v9_macos_lt_v1010)
# iOS from captive portal
cpm.add_url_rule('/library/test/success.html',
'success',
cp_check_ios_lt_v9_macos_lt_v1010)
cpm.add_url_rule('/hotspot-detect.html',
'hotspot-detect', cp_check_ios_gte_v9_macos_gte_v1010)
# Android <= v6 (possibly later too)
# noqa: See: https://www.chromium.org/chromium-os/chromiumos-design-docs/network-portal-detection
cpm.add_url_rule('/generate_204', 'welcome',
show_captive_portal_welcome)
# Fallback method introduced in Android 7
# See:
# noqa: https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/connectivity/NetworkMonitor.java#92
cpm.add_url_rule('/gen_204', 'welcome',
show_captive_portal_welcome)
# Captive Portal check for Amazon Kindle Fire
cpm.add_url_rule('/kindle-wifi/wifistub.html', 'welcome',
show_captive_portal_welcome)
# Captive Portal check for Windows
# See: https://technet.microsoft.com/en-us/library/cc766017(v=ws.10).aspx
cpm.add_url_rule('/ncsi.txt', 'welcome',
show_captive_portal_welcome)
# cpm.add_url_rule('/_authorised_clients',
# 'auth', get_authorised_clients, methods=['GET'])
cpm.add_url_rule('/_authorised_clients',
'auth', add_authorised_client, methods=['POST'])
cpm.add_url_rule('/_authorised_clients/<ip_addr_str>',
'auth_ip', add_authorised_client, methods=['PUT'])
cpm.add_url_rule('/_authorised_clients',
'deauth', remove_authorised_client, methods=['DELETE'])
cpm.add_url_rule('/_authorised_clients/<ip_addr_str>',
'deauth_ip', remove_authorised_client, methods=['DELETE'])
cpm.add_url_rule('/_redirect_to_connectbox',
'redirect', redirect_to_connectbox)
cpm.wsgi_app = ProxyFix(cpm.wsgi_app)
return cpm
captive_portal_manager.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录