Skip to content

Commit

Permalink
make project structure simple
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriSizuku committed Oct 16, 2024
1 parent 621e223 commit e5ab6fc
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
uses: microsoft/setup-msbuild@v1.1

- name: build target
run: .\project\winexe_winmemdll\release_msvc.bat
run: script/build_winmemdll.bat

- name: upload release
uses: ncipollo/release-action@v1
if: github.event_name == 'push'
with:
artifacts: "./project/winexe_winmemdll/build/winmemdll32.exe,./project/winexe_winmemdll/build/winmemdll64.exe"
artifacts: "build/winmemdll32.exe,build/winmemdll64.exe"
allowUpdates: "true"
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
.vscode
__pycache__

project/**/build/*
build/*
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "depend/reversetool"]
path = depend/reversetool
url = https://github.com/YuriSizuku/ReverseTool.git
[submodule "depend/winreverse"]
path = depend/winreverse
url = https://github.com/YuriSizuku/toolkit-WinReverse.git
8 changes: 3 additions & 5 deletions project/winexe_winmemdll/Makefile → Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# build example, tested in linux 10.0.0-3, gcc 12, wine-9.0
# make winmemdll_shellcode CC=x86_64-w64-mingw32-gcc BUILD_TYPE=32
# make winmemdll_shellcode CC=i686-w64-mingw32-clang BUILD_TYPE=32
# make winmemdll_shellcode CC=x86_64-w64-mingw32-clang BUILD_TYPE=64
# make winmemdll_shellcode CC=x86_64-w64-mingw32-clang
# make winmemdll winmemdll_test CC=i686-w64-mingw32-gcc BUILD_TYPE=32d
# make winmemdll winmemdll_test CC=x86_64-w64-mingw32-gcc BUILD_TYPE=64d

# general config
CC:=gcc # clang (llvm-mingw), gcc (mingw-w64), tcc (x86 stdcall name has problem)
BUILD_TYPE:=32# 32, 32d, 64, 64d
BUILD_DIR:=build
INCS:=-I../../depend/reversetool/src
INCS:=-Idepend/winreverse/src
LIBS:=-luser32 -lgdi32 -lpsapi
CFLAGS:=-fPIC -std=c99 \
-fvisibility=hidden \
Expand Down Expand Up @@ -58,7 +56,7 @@ winmemdll_test: src/winmemdll_test.c

# only support llvm-mingw (tested 18.1), for building coff format
# sometimes nested force inline function might cause problems
winmemdll_shellcode: ../../depend/reversetool/project/windll_winpe/src/libwinpe.c
winmemdll_shellcode: depend/winreverse/project/windll_winpe/src/libwinpe.c
@echo "## $@"
# use -mno-sse for not making string as constant, sse makes array assign with ds:
$(CC) -c -O3 -m32 -mno-sse $< -o $(BUILD_DIR)/$@32.o \
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MemoryModule

![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/yurisizuku/memorymodule?color=green&label=MemoryModule)![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/YuriSizuku/MemoryModule/build_wintools.yml?label=build_wintools)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/yurisizuku/win-MemoryModule?color=green&label=MemoryModule)![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/YuriSizuku/win-MemoryModule/build.yml?label=build)

☘️ A flexible PE loader, loading module in memory.
Most of the functions can be inline, compatible for shellcode.
Expand All @@ -22,8 +22,7 @@ Here's a example for using `llvm-mingw`

```shell
git clone https://github.com/YuriSizuku/MemoryModule.git --recursive
cd MemoryModule/project/win_memdll
make winmemdll_shellcode # only if you want to generate shellcode
make winmemdll_shellcode CC=x86_64-w64-mingw32-clang # only if you want to generate shellcode
make winmemdll CC=i686-w64-mingw32-gcc BUILD_TYPE=32d # x86 debug
```

Expand Down
1 change: 0 additions & 1 deletion depend/reversetool
Submodule reversetool deleted from 517fb6
1 change: 1 addition & 0 deletions depend/winreverse
Submodule winreverse added at 77cc93
2 changes: 0 additions & 2 deletions project/winexe_winmemdll/release_msvc.bat

This file was deleted.

2 changes: 2 additions & 0 deletions script/build_winmemdll.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
msbuild winmemdll.sln -t:winmemdll:rebuild -p:configuration=release -p:Platform=x86
msbuild winmemdll.sln -t:winmemdll:rebuild -p:configuration=release -p:Platform=x64
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from keystone import *

sys.path.append("../../depend/reversetool/src")
sys.path.append("depend/winreverse/src")
import wincoff as shellcode

def gen_oepinit_code32():
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -122,7 +122,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -139,7 +139,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -156,7 +156,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -122,7 +122,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -139,7 +139,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -156,7 +156,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>../../depend/reversetool/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>depend/winreverse/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down

0 comments on commit e5ab6fc

Please sign in to comment.