|
41 | 41 | - name: Build EXE with PyInstaller |
42 | 42 | run: pyinstaller packaging/windows.spec --noconfirm |
43 | 43 |
|
| 44 | + - name: Strip Rich PE header to avoid false AV detections |
| 45 | + run: | |
| 46 | + python -c " |
| 47 | + import struct, pathlib |
| 48 | + exe = pathlib.Path('dist/TgWsProxy.exe') |
| 49 | + data = bytearray(exe.read_bytes()) |
| 50 | + rich = data.find(b'Rich') |
| 51 | + if rich == -1: |
| 52 | + raise SystemExit('Rich header not found') |
| 53 | + ck = struct.unpack_from('<I', data, rich + 4)[0] |
| 54 | + dans = struct.pack('<I', 0x536E6144 ^ ck) |
| 55 | + ds = data.find(dans) |
| 56 | + if ds == -1: |
| 57 | + raise SystemExit('DanS marker not found') |
| 58 | + data[ds:rich + 8] = b'\x00' * (rich + 8 - ds) |
| 59 | + exe.write_bytes(data) |
| 60 | + print(f'Stripped Rich header: offset {ds}..{rich+8}') |
| 61 | + " |
| 62 | +
|
44 | 63 | - name: Rename artifact |
45 | 64 | run: mv dist/TgWsProxy.exe dist/TgWsProxy_windows.exe |
46 | 65 |
|
|
74 | 93 | - name: Build EXE with PyInstaller |
75 | 94 | run: pyinstaller packaging/windows.spec --noconfirm |
76 | 95 |
|
| 96 | + - name: Strip Rich PE header to avoid false AV detections |
| 97 | + run: | |
| 98 | + python -c " |
| 99 | + import struct, pathlib |
| 100 | + exe = pathlib.Path('dist/TgWsProxy.exe') |
| 101 | + data = bytearray(exe.read_bytes()) |
| 102 | + rich = data.find(b'Rich') |
| 103 | + if rich == -1: |
| 104 | + raise SystemExit('Rich header not found') |
| 105 | + ck = struct.unpack_from('<I', data, rich + 4)[0] |
| 106 | + dans = struct.pack('<I', 0x536E6144 ^ ck) |
| 107 | + ds = data.find(dans) |
| 108 | + if ds == -1: |
| 109 | + raise SystemExit('DanS marker not found') |
| 110 | + data[ds:rich + 8] = b'\x00' * (rich + 8 - ds) |
| 111 | + exe.write_bytes(data) |
| 112 | + print(f'Stripped Rich header: offset {ds}..{rich+8}') |
| 113 | + " |
| 114 | +
|
77 | 115 | - name: Rename artifact |
78 | 116 | run: mv dist/TgWsProxy.exe dist/TgWsProxy_windows_7_${{ matrix.suffix }}.exe |
79 | 117 |
|
|
0 commit comments