Skip to content

Instantly share code, notes, and snippets.

@coconut49
Created August 16, 2016 15:33
Show Gist options
  • Save coconut49/2a6300e899ee7e07f2e087040c4fe006 to your computer and use it in GitHub Desktop.
Save coconut49/2a6300e899ee7e07f2e087040c4fe006 to your computer and use it in GitHub Desktop.
import iptools
with open("chn.txt") as f,open("proxifier.txt",mode="w") as o:
line = f.readline()
while line:
ip,netmask = line.split(" ")
print("Now Processing IP: "+str(ip)+" Netmask: "+str(netmask))
ipstart,ipend=iptools.ipv4.subnet2block(str(ip)+"/"+str(netmask))
o.writelines(ipstart+"-"+ipend+"\n")
line = f.readline()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment