import json # Load sign-in data signins = json.load(open('D:/ClaudeTools/temp/vwp_signins_raw.json')).get('value', []) # Load existing results try: results = json.load(open('D:/ClaudeTools/temp/vwp_bec_results.json')) except: results = {} # Add sign-in data results['signins'] = signins # Add sign-in summary ips = {} locations = {} failed = 0 risky = 0 for s in signins: ip = s.get('ipAddress', 'N/A') loc = s.get('location', {}) country = loc.get('countryOrRegion', '?') loc_str = f"{loc.get('city','?')}, {loc.get('state','?')}, {country}" ips[ip] = ips.get(ip, 0) + 1 locations[loc_str] = locations.get(loc_str, 0) + 1 if s.get('status', {}).get('errorCode', 0) != 0: failed += 1 if s.get('riskLevelDuringSignIn', 'none') not in ('none', 'low', None, ''): risky += 1 results['signin_summary'] = { 'total': len(signins), 'failed': failed, 'risky': risky, 'unique_ips': len(ips), 'ips': ips, 'locations': locations } with open('D:/ClaudeTools/temp/vwp_bec_results.json', 'w') as f: json.dump(results, f, indent=2, default=str) print('Results compiled and saved.')