Created
May 25, 2018 07:29
-
-
Save lixingcong/3d3187fd31c689857c31c1e985844f4d to your computer and use it in GitHub Desktop.
dante配置ACL生成器
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# 用于打印dante.conf的socks pass/block的 | |
# 目标规则(Target IPs) | |
# Document: https://www.inet.no/dante/doc/1.4.x/sockd.conf.5.html | |
TELEGRAM_PASS_CIDR=( | |
"91.108.4.0/22", | |
"91.108.8.0/21", | |
"91.108.16.0/21", | |
"91.108.36.0/23", | |
"91.108.38.0/23", | |
"91.108.56.0/22", | |
"149.154.160.0/2", | |
) | |
DEFAULT_BLOCK_CIDR=( | |
"0.0.0.0/0", | |
) | |
def parse_cidr(cidr,isPass): | |
for line in cidr: | |
if isPass is True: | |
print "socks pass {" | |
else: | |
print "socks block {" | |
print "\tfrom: 0.0.0.0/0 to: "+line | |
print "}" | |
print "" | |
if __name__ == "__main__": | |
parse_cidr(TELEGRAM_PASS_CIDR,True) | |
parse_cidr(DEFAULT_BLOCK_CIDR,False) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment