Removed requirement of -x64 arg for 64bit binaries.

master
mike1k 3 years ago
parent 328d0c9f6a
commit cdf3b77f18

@ -19,7 +19,6 @@ PERSES by default works off a command line. Listed below are the arguments requr
| `-s` or `--symbol` | Symbol or list of symbols to be mutated. This requires a linked `.map` file. | :x: | | `-s` or `--symbol` | Symbol or list of symbols to be mutated. This requires a linked `.map` file. | :x: |
| `--map` | Map file to be linked. IDA Pro `.map` files must have their extension replaced with `.ida`. | :x: | | `--map` | Map file to be linked. IDA Pro `.map` files must have their extension replaced with `.ida`. | :x: |
| `--list` | List of functions to be mutated. Each entry must envelop one line and be formatted as `0x1000:0x2000` where `0x1000` is the start and `0x2000` is the end of the routine. | :x: | | `--list` | List of functions to be mutated. Each entry must envelop one line and be formatted as `0x1000:0x2000` where `0x1000` is the start and `0x2000` is the end of the routine. | :x: |
| `--x64` | Used to indicate that the file is of 64bit architecture (AMD64). | :heavy_check_mark: |
| `--rets` | Allow PERSES to build a `RET` gadget pool used to create `JMP`s to random locations. | :x: | | `--rets` | Allow PERSES to build a `RET` gadget pool used to create `JMP`s to random locations. | :x: |
| `--scan` | Force PERSES to scan for code protection markers. | :x: | | `--scan` | Force PERSES to scan for code protection markers. | :x: |

@ -1,6 +1,7 @@
#include "perses.hpp" #include "perses.hpp"
#include <argparse/argparse.hpp> #include <argparse/argparse.hpp>
template<int BitSize> template<int BitSize>
void createApplication(perses::X86BinaryApplication<BitSize>* app, argparse::ArgumentParser& args) void createApplication(perses::X86BinaryApplication<BitSize>* app, argparse::ArgumentParser& args)
{ {
@ -101,10 +102,6 @@ int main(int argc, char* argv[])
args.add_argument("-f", "--file") args.add_argument("-f", "--file")
.help("Input file path.") .help("Input file path.")
.required(); .required();
args.add_argument("-x64")
.help("Required for X64 PE files.")
.default_value(false)
.implicit_value(true);
args.add_argument("-a", "--address") args.add_argument("-a", "--address")
.help("Address(es) to mutate") .help("Address(es) to mutate")
.remaining(); .remaining();
@ -145,10 +142,19 @@ int main(int argc, char* argv[])
if (!std::filesystem::exists(filepath)) if (!std::filesystem::exists(filepath))
{ {
logger()->critical("Unable to find file: {}.", filepath); logger()->critical("Unable to find file: {}.", filepath);
return 0; return 1;
}
// Determine arch. type automatically.
DWORD type = 0ul;
if (!GetBinaryTypeA(filepath.c_str(), &type) && GetLastError() != ERROR_BAD_EXE_FORMAT)
{
logger()->critical("Are you sure this is a executable file?");
return 1;
} }
if (args.get<bool>("-x64")) if (type == SCS_64BIT_BINARY)
{ {
createApplication(new perses::X86BinaryApplication<PERSES_64BIT>(filepath), args); createApplication(new perses::X86BinaryApplication<PERSES_64BIT>(filepath), args);
} }

Loading…
Cancel
Save