Files
tf_provider/tools/har/analyze_vmbad_params.py
T

48 lines
1.5 KiB
Python

import json
import os
def extract_params_from_har(har_path):
print(f"\n--- Analyzing {os.path.basename(har_path)} ---")
if not os.path.exists(har_path):
print(f"File not found: {har_path}")
return
with open(har_path, 'r', encoding='utf-8') as f:
har_data = json.load(f)
entries = har_data['log']['entries']
# Track operations to group parameters
operations = {} # UID -> list of params
for entry in entries:
req = entry['request']
# Looking for POST /api/v1/index.cfm/instanceOperationCfsParams
if '/instanceOperationCfsParams' in req['url'] and req['method'] == 'POST':
post_data = req.get('postData', {})
text = post_data.get('text')
if text:
try:
p = json.loads(text)
op_uid = p.get('instanceOperationUid')
if op_uid not in operations:
operations[op_uid] = []
operations[op_uid].append(p)
except:
pass
for op_uid, params in operations.items():
print(f"\nOperation Uid: {op_uid}")
for p in params:
param_id = p.get('svcOperationCfsParamId')
param_val = p.get('paramValue')
print(f" ID: {param_id:4} | Value: {repr(param_val)}")
har_files = [
'/home/naeel/terra/har/f12vmbad.har',
'/home/naeel/terra/har/f12vmbad1.har'
]
for h in har_files:
extract_params_from_har(h)