Skip to content

Instantly share code, notes, and snippets.

@hvnsweeting
Created November 15, 2012 14:54
Show Gist options
  • Save hvnsweeting/4079012 to your computer and use it in GitHub Desktop.
Save hvnsweeting/4079012 to your computer and use it in GitHub Desktop.
import requests
import json
import secutils as sec
HOST = "http://0.0.0.0:8080/create"
rules = [{"ip" : "123.123.123.123", "type":"all"},
{"ip" : "192.168.4.130" , "type" : "all"},
{"ip" : "192.168.3.182" , "type" : "all"},
{"ip" : "123.30.53.12" , "type" : "all"},
{"ip" : "222.255.27.156" , "type" : "all"},
{"ip" : "1.2.3.4", "type" : "ftp"},
{"ip" : "100.1.0.8", "type" : "ftp"},
{"ip" : "123.1.0.8", "type" : "custom", "ports" : "23,34,56"},
]
data = {"email" : "vpn-admin@vccloud.vn", "id" : "4", "type" : ["editor","admin"], "rules" : rules}
jsondata = json.dumps(data)
jsondata = sec.encrypt_data(jsondata)
r = requests.post(HOST, data=jsondata)
print r.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment