43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
import json
|
|
import os
|
|
|
|
def extract_params_from_har(har_path):
|
|
print(f"--- Analyzing {os.path.basename(har_path)} ---")
|
|
with open(har_path, 'r', encoding='utf-8') as f:
|
|
har_data = json.load(f)
|
|
|
|
entries = har_data['log']['entries']
|
|
|
|
# Store parameters group by operation (if possible)
|
|
# Looking for POST /api/v1/index.cfm/instanceOperationCfsParams
|
|
|
|
results = []
|
|
for entry in entries:
|
|
req = entry['request']
|
|
if '/instanceOperationCfsParams' in req['url'] and req['method'] == 'POST':
|
|
post_data = req.get('postData', {})
|
|
text = post_data.get('text')
|
|
if text:
|
|
try:
|
|
params = json.loads(text)
|
|
results.append(params)
|
|
except:
|
|
pass
|
|
|
|
for p in results:
|
|
# Expected keys: instanceOperationUid, svcOperationCfsParamId, paramValue
|
|
op_uid = p.get('instanceOperationUid')
|
|
param_id = p.get('svcOperationCfsParamId')
|
|
param_val = p.get('paramValue')
|
|
print(f"Op: {op_uid} | ID: {param_id} | Value: {param_val} (Type: {type(param_val).__name__})")
|
|
|
|
har_files = [
|
|
'/home/naeel/terra/har/vm.har'
|
|
]
|
|
|
|
for h in har_files:
|
|
if os.path.exists(h):
|
|
extract_params_from_har(h)
|
|
else:
|
|
print(f"File not found: {h}")
|