You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.8 KiB

7 days ago
# -*- coding: utf-8 -*-
"""票 04:解嵌套——从 fat jar 的 BOOT-INF/lib/crm-opportunity jar 里读 SubController.class 搜端点字符串。"""
import io, sys, zipfile, io as _io, time, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
fat = r'e:\code\crm-backend-matt\crm-app\target\crm-app-1.0.0-SNAPSHOT.jar'
z = zipfile.ZipFile(fat)
libs = [n for n in z.namelist() if n.startswith('BOOT-INF/lib/crm-')]
print('[BOOT-INF/lib crm jars]')
for n in libs:
info = z.getinfo(n)
print(f' {n} size={info.file_size} date={info.date_time}')
opp_name = [n for n in libs if 'crm-opportunity' in n]
if opp_name:
inner = zipfile.ZipFile(_io.BytesIO(z.read(opp_name[0])))
sub = [n for n in inner.namelist() if 'OpportunitySubController' in n]
print('\n[内层 SubController 条目]', sub)
for n in sub:
data = inner.read(n)
hits = [s.decode() for s in (b'customer/add', b'customer/search', b'set-primary',
b'team/add', b'team/update', b'team/delete') if s in data]
print(f' {n}: 新端点字符串={hits}')
# 同时看 ~/.m2 仓库里的 crm-opportunity jar
m2 = os.path.expanduser(r'~\.m2\repository\com\crm\crm-opportunity\1.0.0-SNAPSHOT\crm-opportunity-1.0.0-SNAPSHOT.jar')
if os.path.exists(m2):
st = os.stat(m2)
print(f'\n[.m2 crm-opportunity jar] mtime={time.strftime("%H:%M:%S", time.localtime(st.st_mtime))} size={st.st_size}')
zm2 = zipfile.ZipFile(m2)
sub2 = [n for n in zm2.namelist() if 'OpportunitySubController' in n]
for n in sub2:
data = zm2.read(n)
hits = [s.decode() for s in (b'customer/add', b'team/add') if s in data]
print(f' {n}: 新端点字符串={hits}')
else:
print('\n[.m2] crm-opportunity jar 不存在:', m2)