# -*- coding: utf-8 -*- """票 05:验证 fat jar 内嵌模块 jar 含新守卫字节码。 判别依据:内嵌 crm-opportunity jar 须含 state/OpportunityActionGuard.class, 且 TransitionController.class 含 66014 禁领提示片段。""" import io, sys, os, time, zipfile sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') jar = r'e:\code\crm-backend-matt\crm-app\target\crm-app-1.0.0-SNAPSHOT.jar' print('fat jar mtime =', time.strftime('%m-%d %H:%M:%S', time.localtime(os.stat(jar).st_mtime))) z = zipfile.ZipFile(jar) nested = [n for n in z.namelist() if n.startswith('BOOT-INF/lib/crm-opportunity-')] print('[nested]', nested) inner = zipfile.ZipFile(z.open(nested[0])) names = [n for n in inner.namelist() if 'OpportunityActionGuard' in n] print('[guard entries]', names) has_guard = bool(names) tc = [n for n in inner.namelist() if n.endswith('OpportunityTransitionController.class')] data = inner.read(tc[0]) claim_forbidden = '禁领规则'.encode('utf-8') in data print('[transition controller] claim-forbidden msg present =', claim_forbidden) ok = has_guard and claim_forbidden print('VERDICT:', 'NEW-JAR-WITH-T05' if ok else 'OLD-JAR-T05-MISSING')