-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change the structure of whole project
- Loading branch information
1 parent
56b8dce
commit 4243b4f
Showing
95 changed files
with
3,579 additions
and
4,263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"files.associations": { | ||
"winpe.h": "c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
# ReverseUtil | ||
# ReverseTool | ||
|
||
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/yurisizuku/reverseutil?color=green&label=ReverseUtil)![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/YuriSizuku/ReverseUtil/build_wintools.yml?label=build_wintools) | ||
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/yurisizuku/reversetool?color=green&label=ReverseTool)![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/YuriSizuku/ReverseTool/build_wintools.yml?label=build_wintools) | ||
There are my tools for reversing. | ||
The building example is in `./sln`, | ||
The building example is in `./project`, | ||
as well as `Makefile` for `tcc`, `gcc` and `clang`. | ||
|
||
## UTIL scripts and libraries | ||
## Cross scripts and libraries | ||
|
||
* `bintext.py`, for text exporting and importing, checking | ||
* `libbintext.py`, for text exporting and importing, checking | ||
* `librawtext.py`, some matching and statistic method for text | ||
* `libfont.py`, for extracting, building tile font, or generating font picture. | ||
* `libtext.py`, some matching and statistic method for text | ||
* `texture.py`, something about texture and picture convert | ||
* `ftextcvt.py`, convert the `ftext` format made by `bintext.py` | ||
* `cpcvt.py`, convert some strings encoding in file | ||
* `listmagic.py`, list the files magic to analyze | ||
* `shellcode.py`, some method for generating shellcode, such as parsing `coff` object file | ||
* `bintext.h`, parser for `ftext` by `bintext.py` | ||
* `libtexture.py`, something about texture and picture convert | ||
* `libshellcode.py`, some method for generating shellcode, such as parsing `coff` object file | ||
* `ftext.py`, convert the `ftext` format made by `bintext.py` | ||
* `codepage.py`, convert some strings encoding in file | ||
|
||
## Windows scripts and libraries | ||
|
||
* `win_injectdll.py` , pre inject `dll` to a `exe` | ||
* `win_console.js`, Allocate a console for game | ||
* `win_file.js` , view information for both `CreateFile`, `ReadFile`, `WriteFile`, `fopen`,`fread`, `fwrite` | ||
* `win_redirect.js`, redirect font, codepage, and paths in games | ||
* `winhook.h`, single file for dynamic hook functions, such as IAT hook, inline hook | ||
* `winpe.h`, single file for parsing windows PE structure, adjust RELOC, ADDRS, or IAT | ||
* `windllin.py` , pre inject `dll` to a `exe` | ||
* `winconsole.js`, Allocate a console for game | ||
* `winfile.js` , view information for both `CreateFile`, `ReadFile`, `WriteFile`, `fopen`,`fread`, `fwrite` | ||
* `winredirect.js`, redirect font, codepage, and paths in games | ||
|
||
## Useful tools | ||
## Windows Useful tools | ||
|
||
* `dllloader.c`, a tool to start a exe with a `dll` injected, see [Release](https://github.com/YuriSizuku/ReverseUtil/releases) | ||
* `win.c`, a tool to start a exe with a `dll` injected, see [Release](https://github.com/YuriSizuku/ReverseUtil/releases) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
::@echo off | ||
set TARGET_NAME=bintext | ||
set PYENV_NAME=pyenv | ||
set PYENV_DIR=%~dp0build | ||
set PYSRC_PATH=%~dp0..\..\src\script\cross_lib\libbintext.py | ||
set OUT_DIR=%~dp0build | ||
set ICON_PATH=%~dp0..\..\asset\default.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:: build single files | ||
call %~dp0_env.bat | ||
python -m pip install nuitka | ||
nuitka --standalone --onefile --full-compat --show-progress "%PYSRC_PATH%" --windows-icon-from-ico="%ICON_PATH%" --output-dir="%OUT_DIR%\obj\nuitka" -o "%OUT_DIR%\c%TARGET_NAME%.exe" --assume-yes-for-downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:: build by pyinstaller | ||
call %~dp0_env.bat | ||
python -m pip install pyinstaller | ||
pyinstaller -F "%PYSRC_PATH%" --name "%TARGET_NAME%.exe" --distpath="%OUT_DIR%" --workpath="%OUT_DIR%/obj/pyinstaller" --specpath="%OUT_DIR%/obj/pyinstaller" --icon="%ICON_PATH%" --exclude-module=numpy --exclude-module=PIL --console --clean --noupx -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
::@echo off | ||
:: use as build_viapyenv.bat path/to/xxx.bat | ||
|
||
call %~dp0_env.bat | ||
if not exist "%PYENV_DIR%" mkdir "%PYENV_DIR%" | ||
|
||
pushd "%PYENV_DIR%" | ||
python -m venv %PYENV_NAME% | ||
cd %PYENV_NAME%\Scripts | ||
call %1 | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
::@echo off | ||
set TARGET_NAME=ftext | ||
set PYENV_NAME=pyenv | ||
set PYENV_DIR=%~dp0build | ||
set PYSRC_PATH=%~dp0..\..\src\script\cross_tool\ftext.py | ||
set OUT_DIR=%~dp0build | ||
set ICON_PATH=%~dp0..\..\asset\default.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:: build single files | ||
call %~dp0_env.bat | ||
python -m pip install nuitka | ||
nuitka --standalone --onefile --full-compat --show-progress "%PYSRC_PATH%" --windows-icon-from-ico="%ICON_PATH%" --output-dir="%OUT_DIR%\obj\nuitka" -o "%OUT_DIR%\c%TARGET_NAME%.exe" --assume-yes-for-downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:: build by pyinstaller | ||
call %~dp0_env.bat | ||
python -m pip install pyinstaller | ||
pyinstaller -F "%PYSRC_PATH%" --name "%TARGET_NAME%.exe" --distpath="%OUT_DIR%" --workpath="%OUT_DIR%/obj/pyinstaller" --specpath="%OUT_DIR%/obj/pyinstaller" --icon="%ICON_PATH%" --exclude-module=numpy --exclude-module=PIL --console --clean --noupx -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
::@echo off | ||
:: use as build_viapyenv.bat path/to/xxx.bat | ||
|
||
call %~dp0_env.bat | ||
if not exist "%PYENV_DIR%" mkdir "%PYENV_DIR%" | ||
|
||
pushd "%PYENV_DIR%" | ||
python -m venv %PYENV_NAME% | ||
cd %PYENV_NAME%\Scripts | ||
python -m pip install python-docx | ||
call %1 | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# main config | ||
LIBPREFIX?=./../../ | ||
ARCH?=i686 | ||
PREFIX?=./build | ||
|
||
CC:=clang | ||
INCS:=-I$(LIBPREFIX)src/include -I$(LIBPREFIX)src/include/win | ||
LIBDIRS:= | ||
LIBS:=-luser32 -lgdi32 -lpsapi | ||
CFLAGS:=-ffunction-sections\ | ||
-fdata-sections -std=c99 | ||
LDFLAGS:= | ||
|
||
# arch config | ||
ifeq ($(ARCH), x86_64) | ||
ARCH_POSTFIX:=64 | ||
LIBDIRS+=-L$(LIBPREFIX)lib64 | ||
CFLAGS+=-D_WIN64 | ||
ifdef DEBUG | ||
BUILD_POSTFIX:=64d | ||
else | ||
BUILD_POSTFIX:=64 | ||
endif | ||
else # x86 | ||
ARCH_POSTFIX:=32 | ||
LIBDIRS+=-L$(LIBPREFIX)lib32 | ||
ifdef DEBUG | ||
BUILD_POSTFIX:=32d | ||
else | ||
BUILD_POSTFIX:=32 | ||
endif | ||
endif | ||
|
||
# compiler config | ||
ifneq (,$(findstring clang, $(CC))) | ||
CFLAGS+=-target $(ARCH)-pc-windows-msvc \ | ||
-D_CRT_SECURE_NO_DEPRECATE | ||
LDFLAGS+= -Wl,/OPT:REF\ | ||
-Wl,/DEF:src/libwinhook.def\ | ||
-Wno-undefined-inline | ||
else # mingw | ||
CFLAGS+=-m$(ARCH_POSTFIX) \ | ||
-fPIC\ | ||
-fvisibility=hidden\ | ||
-fgnu89-inline\ | ||
-DWINPE_NOASM | ||
ifneq (,$(findstring gcc, $(CC))) | ||
LDFLAGS+=-lwinpthread \ | ||
-static-libgcc \ | ||
-static-libstdc++ \ | ||
-Wl,-Bstatic,--whole-archive \ | ||
-Wl,--no-whole-archive\ | ||
-Wl,--gc-sections\ | ||
-Wl,--enable-stdcall-fixup\ | ||
-Wl,--kill-at | ||
endif | ||
endif | ||
|
||
# optimization config | ||
ifdef DEBUG | ||
CFLAGS+=-g -D_DEBUG | ||
else | ||
CFLAGS+=-Os | ||
endif | ||
LIBDIRS+=-L$(PREFIX) | ||
|
||
# system config | ||
ifeq ($(shell echo ${OS}), Windows_NT) | ||
DLL_EXT=.dll | ||
EXE_EXT=.exe | ||
else | ||
DLL_EXT?=.so | ||
EXE_EXT?= | ||
endif | ||
|
||
# other config | ||
ifneq (,$(findstring clang, $(CC))) | ||
else | ||
ifneq (,$(findstring gcc, $(CC))) | ||
endif | ||
endif | ||
|
||
all: prepare\ | ||
libwinhook\ | ||
libwinhook_test\ | ||
helloexe\ | ||
hellodll | ||
|
||
clean: | ||
rm -rf $(PREFIX)/*libwinhook* | ||
rm -rf $(PREFIX)/*hello* | ||
rm -rf $(PREFIX)/*test* | ||
|
||
prepare: | ||
@if ! [ -d $(PREFIX) ]; then mkdir -p $(PREFIX); fi | ||
|
||
libwinhook: src\libwinhook.c | ||
@echo \#\#building $@ ... | ||
$(CC) -shared $< \ | ||
-o $(PREFIX)/$@$(BUILD_POSTFIX)$(DLL_EXT) \ | ||
$(CFLAGS) $(LDFLAGS) $(INCS) $(LIBS) $(LIBDIRS) | ||
|
||
libwinhook_test: src\libwinhook_test.c | ||
$(CC) $< \ | ||
-o $(PREFIX)/$@$(BUILD_POSTFIX).exe \ | ||
$(CFLAGS) $(LDFLAGS) $(INCS) $(LIBS) $(LIBDIRS) | ||
|
||
helloexe: src\helloexe.c | ||
@echo \#\#building $@ ... | ||
$(CC) $< -o $(PREFIX)/hello$(BUILD_POSTFIX).exe $(CFLAGS) -lgdi32 -luser32 | ||
|
||
hellodll: src\hellodll.c | ||
@echo \#\#building $@ ... | ||
$(CC) -shared $< -o $(PREFIX)/hello$(BUILD_POSTFIX).dll $(CFLAGS) -luser32 | ||
|
||
.PHONY: all clean prepare libwinhook helloexe hellodll |
Oops, something went wrong.