Skip to content

Commit a1f21ac

Browse files
committed
Added delete function and updated readme
1 parent d9f3cbf commit a1f21ac

File tree

9 files changed

+96
-13
lines changed

9 files changed

+96
-13
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/Shellcodev.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
11
# Shellcodev
22
Shellcodev is a tool designed to help and automate the process of shellcode creation.
3+
4+
[![Test](https://img.shields.io/badge/Tested-x86-brightgreen?style=flat-square)]() [![Test](https://img.shields.io/badge/Not%20tested-x64-red?style=flat-square)]() [![Release](https://img.shields.io/badge/Release-v2.0.0-blue?style=flat-square)]()
5+
6+
## Attribution
7+
This project is based on [WinREPL](https://github.com/XaFF-XaFF/WinREPL) by zerosum0x0
8+
9+
### Commands
10+
11+
```
12+
.help Show this help screen.
13+
.registers Show more detailed register info.
14+
.list Show list of previously executed assembly instructions.
15+
.edit line Edit specified line in list.
16+
.del line Delete specified line from list.
17+
.read addr size Read from a memory address.
18+
.write addr hexdata Write to a memory address.
19+
.toshell format Convert list to selected shellcode format. Available formats: c
20+
.allocate size Allocate a memory buffer.
21+
.loadlibrary path Load a DLL into the process.
22+
.kernel32 func Get address of a kernel32 export.
23+
.shellcode hexdata Execute raw shellcode.
24+
.peb Loads PEB into accumulator.
25+
.reset Start a new environment.
26+
.quit Exit the program.
27+
```
28+
29+
### Added features
30+
31+
All the instructions provided by user are now stored. User is now able to list, edit and delete instructions which makes
32+
shellcodes much easier to modify. Everything is in real-time, so any changes made in list also changes the register values.
33+
34+
### Goal features
35+
36+
- String converter: String provided by user will be automatically converted to hex and encoded with little endian. In case of nullbytes, they
37+
will be removed by encrypting data with xor.
38+
- Shellcode runner: User will be able to test shellcode by injecting it into the process.
39+
- More formats.

Shellcodev/command.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
#include "repl.h"
22
#include "color.hpp"
33

4-
BOOL axor;
4+
void shelldev_print_assembly(unsigned char* encode, size_t size)
5+
{
6+
printf("assembled (%zu bytes): ", size);
7+
8+
for (size_t i = 0; i < size; ++i)
9+
if (encode[i] == 0x0)
10+
std::cout << std::hex << dye::light_red("0x") << dye::light_red(static_cast<int>(encode[i])) << " ";
11+
else
12+
std::cout << std::hex << "0x" << static_cast<int>(encode[i]) << " ";
13+
14+
printf("\n");
15+
}
516

617
static BOOL shelldev_command_kernel32(shell_t* sh, std::vector<std::string> parts)
718
{
@@ -354,19 +365,29 @@ static BOOL shelldev_toshell(std::vector<asm_t>* assemblies, std::vector<std::st
354365
return TRUE;
355366
}
356367

368+
static BOOL shelldev_command_delete(shell_t* sh, std::vector<asm_t>* assemblies, std::vector<std::string> parts)
369+
{
370+
assemblies->erase(assemblies->begin() + std::stoi(parts[0]));
371+
372+
shelldev_run_shellcode(sh, assemblies);
373+
374+
return TRUE;
375+
}
376+
377+
357378
static BOOL winrepl_command_help()
358379
{
359380
std::cout << ".help\t\t\tShow this help screen." << std::endl;
360381
std::cout << ".registers\t\tShow more detailed register info." << std::endl;
361382
std::cout << ".list\t\t\tShow list of previously executed assembly instructions." << std::endl;
362383
std::cout << ".edit line\t\tEdit specified line in list." << std::endl;
363-
std::cout << ".toshell format\t\tConvert list to selected shellcode format. Available formats: c" << std::endl;
384+
std::cout << ".del line\t\tDelete specified line from list." << std::endl;
364385
std::cout << ".read addr size\t\tRead from a memory address." << std::endl;
365386
std::cout << ".write addr hexdata\tWrite to a memory address." << std::endl;
387+
std::cout << ".toshell format\t\tConvert list to selected shellcode format. Available formats: c" << std::endl;
366388
std::cout << ".allocate size\t\tAllocate a memory buffer." << std::endl;
367389
std::cout << ".loadlibrary path\tLoad a DLL into the process." << std::endl;
368390
std::cout << ".kernel32 func\t\tGet address of a kernel32 export." << std::endl;
369-
//std::cout << ".dep [0/1]\t\tEnable or disable NX-bit." << std::endl;
370391
std::cout << ".shellcode hexdata\tExecute raw shellcode." << std::endl;
371392
std::cout << ".peb\t\t\tLoads PEB into accumulator." << std::endl;
372393
std::cout << ".reset\t\t\tStart a new environment." << std::endl;
@@ -392,6 +413,8 @@ BOOL shelldev_run_command(shell_t* sh, std::string command, std::vector<asm_t>*
392413
return shelldev_toshell(assemblies, parts);
393414
else if (mainCmd == ".read")
394415
return shelldev_command_read(sh, parts);
416+
else if (mainCmd == ".del")
417+
return shelldev_command_delete(sh, assemblies, parts);
395418
else if (mainCmd == ".write")
396419
return shelldev_command_write(sh, parts);
397420
else if (mainCmd == ".allocate")

Shellcodev/print.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
#include "repl.h"
22
#include <stdio.h>
33

4+
45
static inline BOOL check_bit(DWORD var, char pos)
56
{
67
return !!((var) & (1 << (pos)));
78
}
89

9-
void shelldev_print_assembly(unsigned char *encode, size_t size)
10-
{
11-
printf("assembled (%zu bytes): ", size);
12-
13-
for (size_t i = 0; i < size; ++i)
14-
printf("%02x ", encode[i]);
15-
16-
printf("\n");
17-
}
18-
1910
static void winrepl_reset_console_color()
2011
{
2112
static HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);

screenshots/1.png

15.9 KB
Loading

screenshots/2.png

14.9 KB
Loading

0 commit comments

Comments
 (0)