Skip to content

Instantly share code, notes, and snippets.

@tasoseng
Last active March 8, 2023 14:37
Show Gist options
  • Save tasoseng/efa7e9ac0e9761a26aebe66bbedd8821 to your computer and use it in GitHub Desktop.
Save tasoseng/efa7e9ac0e9761a26aebe66bbedd8821 to your computer and use it in GitHub Desktop.
exclude zoom, teams, webex cidrs from openvpn routes (split tunnel)
import requests
import re
import ipaddress
with requests.Session() as s:
r = s.get('https://support.zoom.us/hc/en-us/articles/201362683-Network-Firewall-or-Proxy-Server-Settings-for-Zoom%C2%A0%20')
zoom = list(set(re.findall(r'(?:\d{1,3}.){3}\d{1,3}\/\d{1,2}', r.text)))
#r = s.get('https://docs.microsoft.com/en-us/microsoft-365/enterprise/urls-and-ip-address-ranges?view=o365-worldwide#skype-for-business-online-and-microsoft-teams')
#teams = list(set(re.findall(r'(?:\d{1,3}.){3}\d{1,3}\/\d{1,2}', r.text)))
teams = [ '13.107.64.0/18', '52.112.0.0/14', '52.120.0.0/14', '52.238.119.141/32', '52.244.160.207/32' ]
r = s.get('https://help.webex.com/en-us/WBX264/How-Do-I-Allow-Webex-Meetings-Traffic-on-My-Network#id_135011')
webex = list(set(re.findall(r'(?:\d{1,3}.){3}\d{1,3}\/\d{1,2}', r.text)))
all = list(set(zoom+teams+webex))
print(len(all),all)
for cidr in all:
res = ipaddress.ip_network(cidr)
print("""echo "push 'route {} net_gateway'" >>${{CC}}""".format(res.with_netmask.replace('/',' ')))
with open('all_cidrs.txt', 'w') as f:
for cidr in all:
f.write(cidr+'\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment