"""OMEGA AB-008: offline static activation evidence, Python 3.9+. Does not execute driver commands, contact HP, download, or refresh ZIP. """ import argparse, csv, datetime, hashlib, re from pathlib import Path RULES = { 'activation': r'\b\w*(?:csi|CSI)\w*(?:cmd|CMD|config|CONFIG|enable|ENABLE|register|REGISTER|write|WRITE)\w*\b|\biwl_mvm_send_csi_cmd\b|\b\w*csi\w*\s*\(', 'firmware': r'CSI_REPORTING|CSI_HEADER_NOTIFICATION|CSI_CHUNKS_NOTIFICATION|\b\w*csi\w*\s*\[', 'configuration': r'CONFIG_\w*(?:IWL|CFG80211|MAC80211)\w*|^\s*(?:menuconfig|config|depends on|select)\s+.*(?:IWL|CFG80211|MAC80211)|\bIWL_VENDOR_CMDS\b', 'operating_mode': r'NL80211_IFTYPE_MONITOR|IEEE80211_IF_TYPE_MNTR|IEEE80211_CONF_MONITOR|\bmonitor\b|\b(?:vif|wdev)->iftype\b|WIPHY_VENDOR_CMD_NEED_\w+', 'delivery': r'iwl_mvm_(?:rx_csi\w*|csi_complete|send_csi_event|vendor_csi_register)|IWL_MVM_VENDOR_\w*CSI\w*|cfg80211_vendor_event_alloc_ucast', } RULES = {k: re.compile(v,re.I) for k,v in RULES.items()} CSI = re.compile(r'\b\w*csi\w*\b',re.I) def main(): p=argparse.ArgumentParser(description=__doc__) p.add_argument('--root', type=Path, default=Path.home()/'Documents'/'OMEGA'/'OMICRON') p.add_argument('--run', default='AB-007-20261127-162346-512367') a=p.parse_args(); root=a.root.resolve(); run=root/'Analysis'/a.run if not (root/'Index'/'Current-Checkpoint.txt').is_file(): raise SystemExit('OMEGA root not found') with (run/'retrieval.csv').open(encoding='utf-8-sig',newline='') as f: rows=list(csv.DictReader(f)) files=[]; missing=[] for r in rows: if r['status']!='OK': missing.append(f"{r['source']} {r['file']}: {r['status']}"); continue path=run/'sources'/r['source']/r['file']; data=path.read_bytes() if hashlib.sha256(data).hexdigest()!=r['sha256']: raise SystemExit(f'Hash mismatch: {path}') files.append((r,data.decode('utf-8').splitlines())) if not files: raise SystemExit('No verified sources') stamp=datetime.datetime.now().strftime('%Y%m%d-%H%M%S-%f'); out=root/'Analysis'/('AB-008-'+stamp); out.mkdir(parents=True) hits=[]; excerpts=[]; summary=[] for r,lines in files: selected={} for i,line in enumerate(lines): tags=[k for k,pat in RULES.items() if pat.search(line)] if not tags: continue # For broad configuration/mode terms retain context near CSI, or # configuration declarations in build files. Not a full call graph. near=any(CSI.search(x) for x in lines[max(0,i-35):i+36]) build=Path(r['file']).name.startswith(('Kconfig','Makefile')) if not near and not (build and 'configuration' in tags): continue selected[i]=tags hits.append({'source':r['source'],'file':r['file'],'line':i+1,'topics':';'.join(tags),'text':line.strip(),'url':r['url'],'sha256':r['sha256']}) if not selected: continue # Merge overlapping windows, avoiding repeated source excerpts. windows=[] for i in selected: lo=max(0,i-18); hi=min(len(lines),i+25) if windows and lo<=windows[-1][1]: windows[-1][1]=max(hi,windows[-1][1]) else: windows.append([lo,hi]) excerpts.append(f"\n=== {r['source']} / {r['file']} ===\n{r['url']}\nSHA256 {r['sha256']}") for lo,hi in windows: excerpts.append(f'--- lines {lo+1}-{hi} ---') excerpts.extend(f'{i+1:5} {"*" if i in selected else " "} {lines[i]}' for i in range(lo,hi)) with (out/'evidence.csv').open('w',encoding='utf-8-sig',newline='') as f: w=csv.DictWriter(f,fieldnames=['source','file','line','topics','text','url','sha256']); w.writeheader(); w.writerows(hits) (out/'AB-008-Source-Context.txt').write_text('\n'.join(excerpts)+'\n',encoding='utf-8') report=['OMEGA AB-008 - CSI ACTIVATION AND CONFIGURATION','CROSS-0 | offline static analysis | '+stamp,'Input: '+str(run.relative_to(root)),f'Verified source hashes: {len(files)}','Missing paths: '+str(len(missing)),*missing,'', 'QUESTIONS AND CANDIDATE EVIDENCE'] questions={'activation':'Which command, write handler or registration activates CSI?', 'firmware':'Which firmware capability checks and notifications are involved?', 'configuration':'Which build options or conditional compilation guards are relevant?', 'operating_mode':'Is a monitor-mode or interface-type requirement visible?', 'delivery':'Which registration and delivery mechanisms connect to activation?'} for topic,q in questions.items(): matches=[h for h in hits if topic in h['topics'].split(';')] report.extend(['',q,f'Candidate lines: {len(matches)} (not independent capabilities)']) # prioritize Core46; report all candidates, full context in separate file for h in sorted(matches,key=lambda h:(h['source']!='intel-core46',h['file'],h['line'])): report.append(f"{h['source']} {h['file']}:{h['line']} {h['text']}") if not matches: report.append('No matching lines in sample; unresolved.') report.extend(['','LIMITATIONS','Regex matches may be comments, unrelated CSI variants, or inactive code. Inspect full source context and guards before interpreting.','Monitor-mode references do not establish necessity; absence does not establish ordinary-mode support.','No runtime firmware capability, kernel build configuration, command execution or CSI collection tested.','Exact Ubuntu build not examined. No new sources downloaded; missing AB-007 files remain unknown.','No checkpoint or ZIP update. Exodus deferred.']) dest=out/'AB-008-Activation-Report.txt'; dest.write_text('\n'.join(report)+'\n',encoding='utf-8') print('AB-008 static evidence collected:',len(hits),'candidate lines') print('Verified input files:',len(files),'| missing:',len(missing)) print('Report:',dest); print('Context:',out/'AB-008-Source-Context.txt'); print('Exodus NOT deployed; ZIP unchanged.') if __name__=='__main__': main()