Skip to content

Commit 330c90a

Browse files
WintermuteWintermute
authored andcommitted
Initial commit
0 parents  commit 330c90a

32 files changed

+1671
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Jakub Lutczyn
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<h1 align="center"> Shellab </h1>
2+
<h5 align="center"> Linux and Windows shellcode development/enrichment utility </h5>
3+
<p align="center">
4+
<a>
5+
<img alt="Shellab" title="Shellab" src="flask.png" width="380" height="450">
6+
</a>
7+
</p>
8+
9+
10+
## Table of Contents
11+
- [Introduction](#introduction)
12+
- [Requirements](#requirements)
13+
- [Features](#features)
14+
- [Future improvements](#future improvements)
15+
- [Example usage](#example usage)
16+
- [Screenshots](#screenshots)
17+
- [Contribution](#contribution)
18+
- [License](#license)
19+
20+
21+
## Introduction
22+
Shellab is a tool that can be used to improve existing shellcodes and adapt them for personal needs. Developed to provide an alternative to msfvenom with new functionalities. Suitable for both Windows and Linux shellcode (32 and 64 bit).
23+
24+
## Requirements
25+
Shellab requires Radare2, you should to install it running this command:
26+
`$ sudo apt-get install radare2`
27+
28+
## Features
29+
30+
* Encode shellcode with custom encoder
31+
32+
* Generate stagers and egghunters (including [sandwich](https://www.securitysift.com/eggsandwich-egghunter-integrity/) and [omelette](http://www.thegreycorner.com/2013/10/omlette-egghunter-shellcode.html) egghunter)
33+
* Inject shellcode into PE files
34+
* Run shellcode on Linux
35+
* Remove bad characters and null-bytes
36+
* Perform experimental size reduction (by instructions replacement)
37+
* Export shellcode in different executable formats (C, C#, Python, Powershell, hex, raw etc.)
38+
* Add custom instructions, NOP slides and specific system calls
39+
40+
## Future improvenemts
41+
- [ ] Create more encoders
42+
- [ ] Implement generation of fully alphanumeric shellcode
43+
- [ ] Add shellcode comparison mechanism
44+
45+
46+
##Example usage
47+
This example will encode the input shellcode with "rot_xor" encoder, insert "xor eax, eax" instruction and 100 non-canonical NOP instructions in front of it, generate a bind stager (that will listen for the incoming shellcode on port 4444) and prepend the shellcode with exit() syscall.
48+
######Show help message:
49+
<img src="screenshots/help_screenshot.png" width="600"/>
50+
######List available components:
51+
<img src="screenshots/list_screenshot.png" width="600"/>
52+
######Generate the shellcode:
53+
<img src="screenshots/example.png" width="600"/>
54+
55+
56+
57+
58+
##Contribution
59+
If you have an idea for a new encoder, egghunter or stager, or just want to improve this tool, simply create a pull request :)
60+
61+
## License
62+
This software is under [MIT License](https://en.wikipedia.org/wiki/MIT_License)

encoders/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__all__ = ["single_incr"]

encoders/__init__.pyc

174 Bytes
Binary file not shown.

encoders/ff_substract.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/python2.7
2+
3+
class Encoder:
4+
name = 'ff_substract'
5+
description = 'Substracts value of each instruction from 0xff'
6+
arch = 'x86'
7+
rank = 'manual'
8+
def encode(self, payload):
9+
def stub():
10+
stub = "\xeb\x0d\x5e\x8a\x1e\x80\xf3\xff\x74\x0a\x88\x1e\x46\xeb\xf4\xe8\xee\xff\xff\xff"
11+
return stub
12+
encoded = ''
13+
for char in bytearray(payload):
14+
char = 0xff - char
15+
encoded += chr(char)
16+
return encoded + '\xff', stub()

encoders/ff_substract.pyc

994 Bytes
Binary file not shown.

encoders/insertion_additive_xor.pyc

3.88 KB
Binary file not shown.

encoders/rot_xor.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/python2.7
2+
import random
3+
4+
class Encoder:
5+
name = 'rot_xor'
6+
description = 'Add a random number to every byte and xor with previous one'
7+
arch = 'x86'
8+
rank = 'excellent'
9+
def encode(self, payload):
10+
number = random.choice(range(1,255))
11+
key = random.choice(range(1,255))
12+
opcode = []
13+
opcode.append(number)
14+
encoded = ''
15+
index = 0
16+
def stub():
17+
stub = "\xeb\x1c\x5e\x31\xc0\x31\xdb\x31\xc9\xb1\x16"
18+
stub += "\xb0\x66\xb3\x2a\x8a\x16\x30\xd0\x88\x06\x28"
19+
stub += "\x1e\x88\xd0\x46\xe2\xf3\xeb\x05\xe8\xdf\xff\xff\xff"
20+
return stub
21+
for char in bytearray(payload):
22+
byte = (char + key) % 256
23+
byte = byte ^ opcode[index]
24+
return encoded, stub()

encoders/rot_xor.pyc

1.2 KB
Binary file not shown.

encoders/single_incr.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/python2.7
2+
3+
4+
class Encoder:
5+
name = 'single_incr'
6+
description = 'Single incrementation encoder'
7+
arch = 'x86'
8+
rank = 'good'
9+
def encode(self, payload):
10+
def stub():
11+
stub ="\x32\xc1\x32\xdc\x32\xca\x32\xd3"
12+
stub +="\xb3\x0a\x6b\x0b\x69\x75\x69\x62"
13+
stub +="\x6f\x69\x6b\x70\x6f\x62\x8a\xe2"
14+
stub +="\xb4\x02\xb1\x05\xce\x81\x32\xdc"
15+
stub +="\xb1\x02\xce\x81"
16+
return stub
17+
encoded = ''
18+
for char in bytearray(payload):
19+
char += 1
20+
encoded += chr(char) # It was chr(char)
21+
return encoded, stub()
22+

0 commit comments

Comments
 (0)