Skip to content

Commit 1e6e2ec

Browse files
committed
Reworked CMakeLists.txt
Updated README.md
1 parent 5bf9010 commit 1e6e2ec

2 files changed

Lines changed: 68 additions & 11 deletions

File tree

CMakeLists.txt

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ project(hash_dumper
77
)
88

99
# Initializing parameters
10-
option(DEBUG "Sets compilation flags for debugging" OFF)
11-
option(RELEASE "Sets compilation flags for optimized binary" OFF)
12-
option(BUILD32 "Sets compilation flags for 32-bit mode" OFF)
1310
set(INSTALL_PREFIX /usr/local/bin CACHE PATH "Path for installed binaries")
11+
set(BUILD_ARCH "amd64" CACHE STRING "Build architecture amd64/i386")
12+
set(BUILD_CPU "RELEASE" CACHE STRING "Build target mode RELEASE/DEBUG")
1413

1514
# Checking parameters
1615
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX})
1716

18-
if ((DEBUG) AND (NOT RELEASE))
17+
# Add debug flags
18+
if (BUILD_TARGET STREQUAL "DEBUG")
1919
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
2020
add_compile_options(-O0)
2121
add_compile_options(-ggdb)
@@ -32,17 +32,28 @@ if ((DEBUG) AND (NOT RELEASE))
3232

3333
endif()
3434

35-
if ((NOT DEBUG) AND (RELEASE))
35+
# Add release flags
36+
if (BUILD_TARGET STREQUAL "RELEASE")
3637
message(STATUS "Enabled release with -O3")
3738
add_compile_options(-O3)
39+
add_compile_options(-s)
3840
endif()
3941

40-
if (BUILD32)
41-
message(STATUS "Enabled 32-bit mode")
42+
# Process build architectures
43+
if (BUILD_ARCH STREQUAL "amd64")
44+
message(STATUS "Build amd64 binary")
45+
add_compile_options(-m64)
46+
add_link_options(-m64)
47+
set(CMAKE_LIBRARY_PATH /usr/lib/x86_64-linux-gnu)
48+
include_directories(BEFORE /usr/include/x86_64-linux-gnu)
49+
elseif (BUILD_ARCH STREQUAL "i386")
50+
message(STATUS "Build i386 binary")
4251
add_compile_options(-m32)
4352
add_link_options(-m32)
44-
SET(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu")
53+
set(CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
4554
include_directories(BEFORE /usr/include/i386-linux-gnu)
55+
else()
56+
message(FATAL_ERROR "Unknown building architecture ${BUILD_ARCH}")
4657
endif()
4758

4859
# Source code paths
@@ -70,14 +81,14 @@ install(TARGETS ${PROJECT_NAME} DESTINATION .)
7081
message(STATUS "WARNING! Installation prefix ${CMAKE_INSTALL_PREFIX}")
7182

7283
# Cleanup cache
73-
unset(DEBUG CACHE)
74-
unset(RELEASE CACHE)
75-
unset(BUILD32 CACHE)
7684
unset(INSTALL_PREFIX CACHE)
85+
unset(BUILD_ARCH CACHE)
86+
unset(BUILD_TARGET CACHE)
7787

7888
unset(CMAKE_LIBRARY_PATH CACHE)
7989
unset(CMAKE_INSTALL_PREFIX CACHE)
8090

91+
# Clear OpenSSL references
8192
unset(OPENSSL_FOUND CACHE)
8293
unset(OPENSSL_INCLUDE_DIR CACHE)
8394
unset(OPENSSL_CRYPTO_LIBRARY CACHE)

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,52 @@ For building required *OpenSSL >= 3.0 or OpenSSL 1.1.1* library. Use cmake to ge
3939
- [Running CMake with OpenSSL](https://stackoverflow.com/a/45548831)
4040
- [How to enable legacy provider?](https://github.com/openssl/openssl/issues/20112)
4141

42+
**Basic setup**
43+
44+
Cloning repository
45+
46+
```sh
47+
$ git clone https://github.com/Retr0-code/hash-dumper
48+
$ git submodule update --init
49+
```
50+
51+
----
52+
53+
If You work alone
54+
55+
```sh
56+
$ git branch dev_<username>
57+
$ git checkout dev_<username>
58+
$ git push -u origin dev_<username>
59+
```
60+
61+
**OR**
62+
63+
If You work in a small team
64+
65+
```sh
66+
$ git checkout dev_<team_tag>
67+
$ git pull
68+
```
69+
70+
71+
**Building using cmake**
72+
73+
Use *BUILD_ARCH* parameter to specify architecture of output binary
74+
75+
*Architectures:*
76+
77+
- amd64 (default);
78+
- i386;
79+
80+
Use *BUILD_TARGET* parameter to specify compiling configuration
81+
82+
*Configurations:*
83+
84+
- RELEASE (default);
85+
- DEBUG;
86+
87+
4288
## Manual
4389

4490
You can use this utility to dump NTLMv1/2 hashes from already compromised host by using `--realtime` flag

0 commit comments

Comments
 (0)