Skip to content

Commit a001121

Browse files
committed
chang version name format
1 parent 83b564f commit a001121

13 files changed

Lines changed: 286 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88

99
jobs:
1010
build_winreverse:
11-
runs-on: windows-2019
11+
runs-on: windows-2025
1212
strategy:
1313
matrix:
1414
project:
@@ -24,6 +24,23 @@ jobs:
2424
- name: add msbuild to path
2525
uses: microsoft/setup-msbuild@v1.1
2626

27+
- name: prepare enviroment
28+
run: |
29+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
30+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
31+
$WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP'
32+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
33+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
34+
if ($process.ExitCode -eq 0)
35+
{
36+
Write-Host "components have been successfully added"
37+
}
38+
else
39+
{
40+
Write-Host "components were not installed"
41+
exit 1
42+
}
43+
2744
- name: build target
2845
run: .\project\${{ matrix.project.dirname }}\release_msvc.bat
2946

@@ -34,4 +51,31 @@ jobs:
3451
artifacts: "./project/${{ matrix.project.dirname }}/build/${{ matrix.project.targetname }}32.${{ matrix.project.targetext }},./project/${{ matrix.project.dirname }}/build/${{ matrix.project.targetname }}64.${{ matrix.project.targetext }}"
3552
allowUpdates: "true"
3653
replacesArtifacts: "true"
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
56+
build_src:
57+
runs-on: ubuntu-24.04
58+
steps:
59+
- name: pull and init
60+
uses: actions/checkout@v3
61+
with: {submodules: true}
62+
- name: install depends
63+
run: |
64+
pip3 install lief keystone-engine
65+
66+
- name: build pysrc
67+
run: |
68+
chmod +x project/winsrc_all/*.sh
69+
bash project/winsrc_all/build_src.sh
70+
cd project/winsrc_all
71+
archive_name=WinReverseSrc_${{ github.ref_name }}
72+
7z a ${archive_name}.7z build
73+
7z rn ${archive_name}.7z build ${archive_name}
74+
75+
- name: create a release
76+
uses: ncipollo/release-action@v1
77+
if: github.event_name == 'push'
78+
with:
79+
artifacts: "project/winsrc_all/*.7z"
80+
allowUpdates: "true"
3781
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,62 @@ permissions:
88

99
jobs:
1010
test_windll_winhook:
11-
runs-on: windows-2019
11+
runs-on: windows-2025
1212
steps:
1313
- name: pull and init
1414
uses: actions/checkout@v3
1515
with: {submodules: true}
1616

1717
- name: add msbuild to path
1818
uses: microsoft/setup-msbuild@v1.1
19+
20+
- name: prepare enviroment
21+
run: |
22+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
23+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
24+
$WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP'
25+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
26+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
27+
if ($process.ExitCode -eq 0)
28+
{
29+
Write-Host "components have been successfully added"
30+
}
31+
else
32+
{
33+
Write-Host "components were not installed"
34+
exit 1
35+
}
1936
2037
- name: test target
2138
shell: cmd
2239
run: .\project\windll_winhook\test_msvc.bat
2340

2441
test_windll_winpe:
25-
runs-on: windows-2019
42+
runs-on: windows-2025
2643
steps:
2744
- name: pull and init
2845
uses: actions/checkout@v3
2946
with: {submodules: true}
3047

3148
- name: add msbuild to path
3249
uses: microsoft/setup-msbuild@v1.1
50+
51+
- name: prepare enviroment
52+
run: |
53+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
54+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
55+
$WorkLoads = '--add Microsoft.VisualStudio.Component.WinXP'
56+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"", $WorkLoads, '--quiet', '--norestart', '--nocache')
57+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
58+
if ($process.ExitCode -eq 0)
59+
{
60+
Write-Host "components have been successfully added"
61+
}
62+
else
63+
{
64+
Write-Host "components were not installed"
65+
exit 1
66+
}
3367
3468
- name: test target
3569
shell: cmd

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*.vcxproj.user
1414

1515
.vs
16-
.vscode
16+
.vscode/settings.json
1717
__pycache__
1818

1919
project/**/build/*

.vscode/c_cpp_properties.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"env": {
3+
"llvmmingw" : "${env:LLVMMINGW_HOME}"
4+
},
5+
"configurations": [
6+
{
7+
"name": "win32",
8+
"includePath": [
9+
"${workspaceFolder}/**",
10+
"${workspaceFolder}/src/**"
11+
12+
],
13+
"defines": [
14+
"_DEBUG",
15+
"UNICODE",
16+
"_UNICODE",
17+
"WINPE_IMPLEMENTATION",
18+
"WINHOOK_IMPLEMENTATION",
19+
"WINHOOK_USEDYNBIND"
20+
],
21+
"compilerPath": "${llvmmingw}//bin/clang.exe",
22+
"cStandard": "c99",
23+
"cppStandard": "c++11",
24+
"intelliSenseMode": "windows-clang-x86"
25+
},
26+
{
27+
"name": "win64",
28+
"includePath": [
29+
"${workspaceFolder}/**",
30+
"${workspaceFolder}/src/**"
31+
32+
],
33+
"defines": [
34+
"_DEBUG",
35+
"_WIN64",
36+
"UNICODE",
37+
"_UNICODE",
38+
"WINPE_IMPLEMENTATION",
39+
"WINHOOK_IMPLEMENTATION",
40+
"WINHOOK_USEDYNBIND"
41+
],
42+
"compilerPath": "${llvmmingw}//bin/clang.exe",
43+
"cStandard": "c99",
44+
"cppStandard": "c++11",
45+
"intelliSenseMode": "windows-clang-x64"
46+
}
47+
],
48+
"version": 4
49+
}

.vscode/launch.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "win libwinpe_test32d",
9+
"type": "cppdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/project/windll_winpe/build/libwinpe_test32d.exe",
12+
"args": [],
13+
"stopAtEntry": false,
14+
"cwd": "${workspaceFolder}/project/windll_winpe/build",
15+
"environment": [],
16+
"externalConsole": false,
17+
"MIMode": "gdb",
18+
"miDebuggerPath": "${env:MSYS2_HOME}/mingw32/bin/gdb.exe",
19+
"setupCommands": [
20+
{
21+
"description": "Enable pretty-printing for gdb",
22+
"text": "-enable-pretty-printing",
23+
"ignoreFailures": true
24+
},
25+
{
26+
"description": "Set Disassembly Flavor to Intel",
27+
"text": "-gdb-set disassembly-flavor intel",
28+
"ignoreFailures": true
29+
}
30+
]
31+
},
32+
{
33+
"name": "win libwinpe_test64d",
34+
"type": "cppdbg",
35+
"request": "launch",
36+
"program": "${workspaceFolder}/project/windll_winpe/build/libwinpe_test64d.exe",
37+
"args": [],
38+
"stopAtEntry": false,
39+
"cwd": "${workspaceFolder}/project/windll_winpe/build",
40+
"environment": [],
41+
"externalConsole": false,
42+
"MIMode": "gdb",
43+
"miDebuggerPath": "${env:MSYS2_HOME}/mingw64/bin/gdb.exe",
44+
"setupCommands": [
45+
{
46+
"description": "Enable pretty-printing for gdb",
47+
"text": "-enable-pretty-printing",
48+
"ignoreFailures": true
49+
},
50+
{
51+
"description": "Set Disassembly Flavor to Intel",
52+
"text": "-gdb-set disassembly-flavor intel",
53+
"ignoreFailures": true
54+
}
55+
]
56+
},
57+
{
58+
"name": "win libwinhook_test32d",
59+
"type": "cppdbg",
60+
"request": "launch",
61+
"program": "${workspaceFolder}/project/windll_winhook/build/libwinhook_test32d.exe",
62+
"args": [],
63+
"stopAtEntry": false,
64+
"cwd": "${workspaceFolder}/project/windll_winhook/build",
65+
"environment": [],
66+
"externalConsole": false,
67+
"MIMode": "gdb",
68+
"miDebuggerPath": "${env:MSYS2_HOME}/mingw32/bin/gdb.exe",
69+
"setupCommands": [
70+
{
71+
"description": "Enable pretty-printing for gdb",
72+
"text": "-enable-pretty-printing",
73+
"ignoreFailures": true
74+
},
75+
{
76+
"description": "Set Disassembly Flavor to Intel",
77+
"text": "-gdb-set disassembly-flavor intel",
78+
"ignoreFailures": true
79+
}
80+
]
81+
},
82+
{
83+
"name": "win libwinhook_test64d",
84+
"type": "cppdbg",
85+
"request": "launch",
86+
"program": "${workspaceFolder}/project/windll_winhook/build/libwinhook_test32d.exe",
87+
"args": [],
88+
"stopAtEntry": false,
89+
"cwd": "${workspaceFolder}/project/windll_winhook/build",
90+
"environment": [],
91+
"externalConsole": false,
92+
"MIMode": "gdb",
93+
"miDebuggerPath": "${env:MSYS2_HOME}/mingw64/bin/gdb.exe",
94+
"setupCommands": [
95+
{
96+
"description": "Enable pretty-printing for gdb",
97+
"text": "-enable-pretty-printing",
98+
"ignoreFailures": true
99+
},
100+
{
101+
"description": "Set Disassembly Flavor to Intel",
102+
"text": "-gdb-set disassembly-flavor intel",
103+
"ignoreFailures": true
104+
}
105+
]
106+
}
107+
]
108+
}

project/winsrc_all/build_src.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
build_pysrc()
2+
{
3+
src_dir=$1
4+
dst_dir=$2
5+
module_name=$3
6+
module_ver=$(python -c "import sys, os; sys.path.append(r'$src_dir'); from $module_name import __version__ as v; print(v)")
7+
module_ver=$(echo $module_ver | sed -E 's/\./_/g')
8+
echo build ${module_name}_v${module_ver}.py
9+
cp -f $src_dir/${module_name}.py $dst_dir/${module_name}_v${module_ver}.py
10+
}
11+
12+
build_csrc()
13+
{
14+
src_dir=$1
15+
dst_dir=$2
16+
module_name=$3
17+
module_ver=$(awk '/.*_VERSION/ {print $3}' $src_dir/$module_name.h | sed 's/"//g')
18+
module_ver=$(echo $module_ver | sed -E 's/\./_/g')
19+
echo build ${module_name}_v${module_ver}.h
20+
cp -f $src_dir/${module_name}.h $dst_dir/${module_name}_v${module_ver}.h
21+
}
22+
23+
mkdir -p $(dirname $0)/build
24+
build_pysrc src $(dirname $0)/build windllin
25+
build_csrc src $(dirname $0)/build commdef
26+
build_csrc src $(dirname $0)/build winhook
27+
build_csrc src $(dirname $0)/build windyn
28+
build_csrc src $(dirname $0)/build winpe
29+
build_csrc src $(dirname $0)/build winversion
30+
cp -f src/winversion.def $(dirname $0)/build/winversion.def

src/commdef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#ifndef _COMMDEF_H
77
#define _COMMDEF_H
8-
#define COMMDEF_VERSION 110
8+
#define COMMDEF_VERSION "0.1.1"
99
#ifdef __cplusplus
1010
extern "C" {
1111
#endif

src/wincoff.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
"""
1+
__version__ = "0.1.1"
2+
__description__ = f"""
23
A tool to parse .obj file made by msvc
34
and generate them to shellcode byte array
4-
v0.1, developed by devseed
5+
v{__version__}, developed by devseed
56
"""
67

78
import os
89
import struct
910
import codecs
1011
from typing import Union, List, Dict
1112

12-
__version__ = 110
13+
1314

1415
class coff_filehdr_t(struct.Struct):
1516
def __init__(self, data):
@@ -216,17 +217,6 @@ def test_codecvt():
216217
assert(aa == [0x22, 0x3, 4, 0b1111, 235, 44, 0x22, 33])
217218
print(aa)
218219

219-
def debug():
220-
test_codecvt()
221-
222-
def main():
223-
pass
224-
225-
if __name__ == '__main__':
226-
#debug()
227-
main()
228-
pass
229-
230220
"""
231221
history:
232222
v0.1, inital version parse .obj file

0 commit comments

Comments
 (0)