add: tools, secrets (safe files), updated gitignore
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
def analyze_har(file_path):
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
har_data = json.load(f)
|
||||
|
||||
target_uid = "79ac8a4a-353b-4f3f-8ab1-fa937d2d23f8"
|
||||
|
||||
entries = har_data['log']['entries']
|
||||
|
||||
found_responses = []
|
||||
|
||||
for entry in entries:
|
||||
request = entry['request']
|
||||
response = entry['response']
|
||||
|
||||
# Check if the URL contains the UID or the request/response body contains it
|
||||
url = request.get('url', '')
|
||||
|
||||
resp_text = ""
|
||||
if 'content' in response and 'text' in response['content']:
|
||||
resp_text = response['content']['text']
|
||||
|
||||
if target_uid in url or target_uid in resp_text:
|
||||
found_responses.append({
|
||||
'url': url,
|
||||
'method': request['method'],
|
||||
'status': response['status'],
|
||||
'time': entry['startedDateTime'],
|
||||
'response': resp_text
|
||||
})
|
||||
|
||||
# Sort by time
|
||||
found_responses.sort(key=lambda x: x['time'])
|
||||
|
||||
for i, item in enumerate(found_responses):
|
||||
print(f"--- Entry {i+1} ---")
|
||||
print(f"Time: {item['time']}")
|
||||
print(f"Method: {item['method']}")
|
||||
print(f"URL: {item['url']}")
|
||||
print(f"Status: {item['status']}")
|
||||
|
||||
if item['response']:
|
||||
try:
|
||||
data = json.loads(item['response'])
|
||||
# Only print interesting parts to avoid flooding
|
||||
if 'instanceOperation' in data:
|
||||
op = data['instanceOperation']
|
||||
print(f"Operation: {op.get('operation')} Status: {op.get('isSuccessful')} Progress: {op.get('isInProgress')}")
|
||||
if 'stages' in op:
|
||||
for stage in op['stages']:
|
||||
print(f" Stage: {stage.get('stage')} Successs: {stage.get('isSuccessful')} Msg: {stage.get('stageMsg')}")
|
||||
elif 'instance' in data:
|
||||
inst = data['instance']
|
||||
print(f"Instance Status: {inst.get('explainedStatus')}")
|
||||
except:
|
||||
print("Response is not JSON or parsing failed")
|
||||
print("\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
analyze_har("/home/naeel/terra/har/f12vmbad.har")
|
||||
Reference in New Issue
Block a user