Skip to content

Commit

Permalink
Reworked CMakeLists.txt
Browse files Browse the repository at this point in the history
Updated README.md
  • Loading branch information
Retr0-code committed Nov 7, 2023
1 parent 5bf9010 commit 1e6e2ec
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 11 deletions.
33 changes: 22 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ project(hash_dumper
)

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

# Checking parameters
set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX})

if ((DEBUG) AND (NOT RELEASE))
# Add debug flags
if (BUILD_TARGET STREQUAL "DEBUG")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(-O0)
add_compile_options(-ggdb)
Expand All @@ -32,17 +32,28 @@ if ((DEBUG) AND (NOT RELEASE))

endif()

if ((NOT DEBUG) AND (RELEASE))
# Add release flags
if (BUILD_TARGET STREQUAL "RELEASE")
message(STATUS "Enabled release with -O3")
add_compile_options(-O3)
add_compile_options(-s)
endif()

if (BUILD32)
message(STATUS "Enabled 32-bit mode")
# Process build architectures
if (BUILD_ARCH STREQUAL "amd64")
message(STATUS "Build amd64 binary")
add_compile_options(-m64)
add_link_options(-m64)
set(CMAKE_LIBRARY_PATH /usr/lib/x86_64-linux-gnu)
include_directories(BEFORE /usr/include/x86_64-linux-gnu)
elseif (BUILD_ARCH STREQUAL "i386")
message(STATUS "Build i386 binary")
add_compile_options(-m32)
add_link_options(-m32)
SET(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu")
set(CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
include_directories(BEFORE /usr/include/i386-linux-gnu)
else()
message(FATAL_ERROR "Unknown building architecture ${BUILD_ARCH}")
endif()

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

# Cleanup cache
unset(DEBUG CACHE)
unset(RELEASE CACHE)
unset(BUILD32 CACHE)
unset(INSTALL_PREFIX CACHE)
unset(BUILD_ARCH CACHE)
unset(BUILD_TARGET CACHE)

unset(CMAKE_LIBRARY_PATH CACHE)
unset(CMAKE_INSTALL_PREFIX CACHE)

# Clear OpenSSL references
unset(OPENSSL_FOUND CACHE)
unset(OPENSSL_INCLUDE_DIR CACHE)
unset(OPENSSL_CRYPTO_LIBRARY CACHE)
Expand Down
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,52 @@ For building required *OpenSSL >= 3.0 or OpenSSL 1.1.1* library. Use cmake to ge
- [Running CMake with OpenSSL](https://stackoverflow.com/a/45548831)
- [How to enable legacy provider?](https://github.com/openssl/openssl/issues/20112)

**Basic setup**

Cloning repository

```sh
$ git clone https://github.com/Retr0-code/hash-dumper
$ git submodule update --init
```

----

If You work alone

```sh
$ git branch dev_<username>
$ git checkout dev_<username>
$ git push -u origin dev_<username>
```

**OR**

If You work in a small team

```sh
$ git checkout dev_<team_tag>
$ git pull
```


**Building using cmake**

Use *BUILD_ARCH* parameter to specify architecture of output binary

*Architectures:*

- amd64 (default);
- i386;

Use *BUILD_TARGET* parameter to specify compiling configuration

*Configurations:*

- RELEASE (default);
- DEBUG;


## Manual

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

0 comments on commit 1e6e2ec

Please sign in to comment.