As part of an effort to trace the https traffic from Zowe, I found there are trace points you can enable.
You can get a list of these from a request like “https://10.1.1.2:7558/application/loggers”. In the browser it returns one long string like (my formatting)
{"levels":["OFF","ERROR","WARN","INFO","DEBUG","TRACE"],
"loggers":{"ROOT":{"configuredLevel":"INFO","effectiveLevel":"INFO"},
"_org":{"configuredLevel":null,"effectiveLevel":"INFO"},
"_org.springframework":{"configuredLevel":null,"effectiveLevel":"INFO"},
"_org.springframework.web":{"configuredLevel":null,"effectiveLevel":"INFO"},
...
Once you know the trace point, you can change it. See here.
Using https module
certs="--cert colinpaice.pem --cert-key colinpaice.key.pem"
verify="--verify no"
url="https://10.1.1.2:7558/application/loggers"
https GET ${url} $certs $verify
This displayed the data, nicely formatted. But if you pipe it, the next stage receives one long character string.
Using Python
#!/usr/bin/env python3
import ssl
import json
import sys
from http.client import HTTPConnection
import requests
import urllib3
# trace the traffic flow
HTTPConnection.debuglevel = 1
my_header = { 'Accept' : 'application/json' }
urllib3.disable_warnings()
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
certificate="colinpaice.pem"
key="colinpaice.key.pem"
cpcert=(certificate,key)
jar = requests.cookies.RequestsCookieJar()
s = requests.Session()
geturl="https://10.1.1.2:7558/application/loggers"
res = s.get(geturl,headers=my_header,cookies=jar,cert=cpcert,verify=False)
if res.status_code != 200:
print("error code",res.status_code)
sys.exit(8)
headers = res.headers
for h in headers:
print(h,headers[h])
cookies = res.cookies.get_dict()
for c in cookies:
print("cookie",c,cookies[c])
js = json.loads(res.text)
print("type",js.keys())
print(js['levels'])
print(js['groups'])
loggers = js['loggers']
for ll in loggers:
print(ll,loggers[ll])
This prints out one line per item.
The command
python3 zloggers.py |grep HTTP
gives
...
org.apache.http {'configuredLevel': 'DEBUG', 'effectiveLevel': 'DEBUG'}
org.apache.http.conn {'configuredLevel': None, 'effectiveLevel': 'DEBUG'}
org.apache.http.conn.ssl {'configuredLevel': None, 'effectiveLevel': 'DEBUG'}
...