Created
February 21, 2018 18:38
-
-
Save rpherrera/6c5973a1d4a86909edf5b39d9fab9cd3 to your computer and use it in GitHub Desktop.
Example on how you can interact with StrongSwan be means of Vici API
This file contains 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
import vici | |
import json | |
s = vici.Session() | |
for i in s.list_sas(): | |
print json.dumps(i, indent=2) | |
# sample output: | |
# { | |
# "rw": { | |
# "uniqueid": "1", | |
# "version": "2", | |
# "state": "ESTABLISHED", | |
# "local-host": "192.168.10.100", | |
# "local-port": "4500", | |
# "local-id": "192.168.10.100", | |
# "remote-host": "192.168.10.200", | |
# "remote-port": "4500", | |
# "remote-id": "192.168.10.200", | |
# "initiator-spi": "21b050a4c5d40f0c", | |
# "responder-spi": "6f63b5b2a276e66b", | |
# "encr-alg": "AES_CBC", | |
# "encr-keysize": "128", | |
# "integ-alg": "HMAC_SHA1_96", | |
# "prf-alg": "PRF_HMAC_SHA1", | |
# "dh-group": "MODP_2048", | |
# "established": "2166", | |
# "reauth-time": "1211", | |
# "child-sas": { | |
# "rw-3": { | |
# "name": "rw", | |
# "uniqueid": "3", | |
# "reqid": "1", | |
# "state": "INSTALLED", | |
# "mode": "TUNNEL", | |
# "protocol": "ESP", | |
# "spi-in": "cf4d1430", | |
# "spi-out": "cc912d07", | |
# "encr-alg": "AES_CBC", | |
# "encr-keysize": "128", | |
# "integ-alg": "HMAC_SHA1_96", | |
# "bytes-in": "76", | |
# "packets-in": "1", | |
# "use-in": "292", | |
# "bytes-out": "76", | |
# "packets-out": "1", | |
# "use-out": "292", | |
# "rekey-time": "437", | |
# "life-time": "780", | |
# "install-time": "420", | |
# "local-ts": [ | |
# "0.0.0.0/0" | |
# ], | |
# "remote-ts": [ | |
# "192.168.10.200/32" | |
# ] | |
# } | |
# } | |
# } | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment