Skip to content

Commit 5ea3462

Browse files
committed
Small cleanup for src/heap/heap.c and prepare CHANGES/README for new release
1 parent 882ae93 commit 5ea3462

File tree

3 files changed

+53
-36
lines changed

3 files changed

+53
-36
lines changed

CHANGES

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
rop-tool v2.2 (2015-05-15)
2+
- Port project on windows
3+
- Fix bugs in PE parser
4+
- Fix bugs in api/utils
5+
- Add --bad option in gadget and search command, to exclude bad bytes in address
6+
- Add NX bit on info command (ELF only)
7+
- New command : heap, used to visualize heap allocations (Linux/glibc only)
8+
- Fix bad behavior in 'search --all'
9+
- Gadgets which finished by syscall or int 0x80 instruction are now filtered
10+
111
rop-tool v2.1 (2015-04-05)
212
- Renamed the project to rop-tool
313
- Handle Mach-O file format

README.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
rop-tool v2.1
1+
rop-tool v2.2
22
====
33

44
A tool to help you writing binary exploits
@@ -7,7 +7,7 @@ A tool to help you writing binary exploits
77
### OPTIONS
88

99
```
10-
rop-tool v2.1
10+
rop-tool v2.2
1111
Help you to make binary exploits.
1212
1313
Usage: rop-tool <cmd> [OPTIONS]
@@ -16,6 +16,7 @@ Commands :
1616
gadget Search gadgets
1717
patch Patch the binary
1818
info Print info about binary
19+
heap Display heap structure
1920
search Search on binary
2021
help Print help
2122
version Print version
@@ -87,8 +88,32 @@ OPTIONS:
8788
8889
```
8990

91+
#### HEAP COMMAND
92+
93+
```
94+
Usage : rop-tool heap [OPTIONS] [COMMAND]
95+
96+
OPTIONS:
97+
--help, -h Print this help message
98+
--library, -l <l> Specify the library path for libheap.so (default : ./libheap-x86-64.so)
99+
--no-color, -N Do not colorize output
100+
```
101+
102+
**Small explication about output of heap command**
103+
104+
Each line correspond to a malloc chunk, and the heap is dumped
105+
after each execution of heap functions (free, malloc, realloc, calloc)
106+
107+
* addr: is the real address of the malloc chunk
108+
109+
* usr_addr: is the address returned by malloc functions to user
110+
111+
* size: is the size of the malloc chunk
112+
113+
* flags: P is PREV_INUSE, M is IS_MAPED and A is NON_MAIN_ARENA
114+
90115
### FEATURES
91-
* String searching, Gadget searching, patching, info
116+
* String searching, Gadget searching, patching, info, heap visualization
92117
* Colored output
93118
* Intel and AT&T flavor
94119
* Support of ELF, PE and MACH-O binary format
@@ -100,27 +125,31 @@ OPTIONS:
100125

101126
Basic gadget searching
102127

103-
* rop-tool g ./program
128+
* rop-tool gadget ./program
104129

105130
Display all gadgets with AT&T syntax
106131

107-
* rop-tool g ./program -f att -a
132+
* rop-tool gadget ./program -f att -a
108133

109134
Search in RAW file (not supported format)
110135

111-
* rop-tool g ./program -r
136+
* rop-tool gadget ./program -r
112137

113138
Search a "splitted" string in the binary
114139

115-
* rop-tool s ./program -s "/bin/sh"
140+
* rop-tool search ./program -s "/bin/sh"
116141

117142
Search all strings in binary
118143

119-
* rop-tool s ./program -a
144+
* rop-tool search ./program -a
120145

121146
Patch binary at offset 0x1000, with "\xaa\xbb\xcc\xdd" and save as "patched" :
122147

123-
* rop-tool p ./program -o 0x1000 -b "\xaa\xbb\xcc\xdd" -O patched
148+
* rop-tool patch ./program -o 0x1000 -b "\xaa\xbb\xcc\xdd" -O patched
149+
150+
Visualize heap allocation of /bin/ls command :
151+
152+
* rop-tool heap /bin/ls
124153

125154
### SCREENSHOTS
126155

@@ -148,6 +177,11 @@ rop-tool search /bin/ls -w 0x90
148177

149178
![ScreenShot](https://t0x0sh.org/repo/rop-tool/screens/screen4.png)
150179

180+
```
181+
rop-tool heap ./a.out
182+
```
183+
184+
![ScreenShot](https://t0x0sh.org/repo/rop-tool/screens/screen5.png)
151185

152186
### DEPENDENCIES
153187
- [capstone](http://capstone-engine.org/)

src/heap/heap.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,18 @@
2323
#ifndef __WINDOWS__
2424
#include "rop_heap.h"
2525

26-
#define HEAP_DEFAULT_FORMAT "ascii"
2726
#define HEAP_DEFAULT_LIBPATH "./libheap-" ARCHITECTURE ".so"
2827

2928
char **heap_options_command = NULL;
3029
const char *heap_options_libpath = HEAP_DEFAULT_LIBPATH;
31-
const char *heap_options_output = NULL;
32-
const char *heap_options_format = HEAP_DEFAULT_FORMAT;
3330
const char *heap_options_color = "1";
3431

3532
void heap_help(void) {
3633
printf("Usage : %s heap [OPTIONS] [COMMAND]\n\n", PACKAGE);
3734
printf("OPTIONS:\n");
38-
printf(" --format, -f <f> Select output format (default: %s)\n", HEAP_DEFAULT_FORMAT);
3935
printf(" --help, -h Print this help message\n");
4036
printf(" --library, -l <l> Specify the library path for libheap.so (default : %s)\n", HEAP_DEFAULT_LIBPATH);
4137
printf(" --no-color, -N Do not colorize output\n");
42-
printf(" --output, -O <f> Write trace in a file\n");
4338
printf("\n");
4439
}
4540

@@ -49,11 +44,9 @@ void heap_options_parse(int argc, char **argv) {
4944
int opt;
5045

5146
const struct option opts[] = {
52-
{"format", required_argument, NULL, 'f'},
5347
{"help", no_argument, NULL, 'h'},
5448
{"library", required_argument, NULL, 'l'},
5549
{"no-color", no_argument, NULL, 'N'},
56-
{"output", required_argument, NULL, 'O'},
5750
{NULL, 0, NULL, 0 }
5851
};
5952

@@ -74,14 +67,6 @@ void heap_options_parse(int argc, char **argv) {
7467
heap_options_color = "0";
7568
break;
7669

77-
case 'O':
78-
heap_options_output = optarg;
79-
break;
80-
81-
case 'f':
82-
heap_options_format = optarg;
83-
break;
84-
8570
default:
8671
heap_help();
8772
exit(EXIT_FAILURE);
@@ -104,18 +89,6 @@ void heap_cmd(int argc, char **argv) {
10489
exit(EXIT_FAILURE);
10590
}
10691

107-
if(setenv("LIBHEAP_FORMAT", heap_options_format, 0) == -1) {
108-
fprintf(stderr, "Can't set LIBHEAP_FORMAT environment variable\n");
109-
exit(EXIT_FAILURE);
110-
}
111-
112-
if(heap_options_output) {
113-
if(setenv("LIBHEAP_OUTPUT", heap_options_output, 0) == -1) {
114-
fprintf(stderr, "Can't set LIBHEAP_OUTPUT environment variable\n");
115-
exit(EXIT_FAILURE);
116-
}
117-
}
118-
11992
if(setenv("LIBHEAP_COLOR", heap_options_color, 0) == -1) {
12093
fprintf(stderr, "Can't set LIBHEAP_COLOR environment variable\n");
12194
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)