swaks
操作系统版本:Kali GNU/Linux
swaks版本: 20201014.0
安装swaks
apt-get install swaks
swaks --to receptuser@gmail.com --from senduser@gmail.com
swaks常用参数
--to
:收件人邮件地址--from
:发件人邮件地址--h-From
:显示的发件人名称和发件人邮件地址,若发件人邮件地址与--from
不一致将会显示--attach-type
:包括两种格式,纯文本样式text/plain
、HTML样式text/html
--attach-body
:邮件正文--header
:邮件标题--ehlo
:ehlo header--header-X-Mailer
:X-Mailer header--header-Message-Id
:Message-Id header
swaks --to receptuser@gmail.com --from senduser@gmail.com --h-From: '"it@gmail.com" <admin@coregmail.com>' --attach-type 'text/html; charset=UTF-8' --attach-body mail.txt --header 'Subject:邮件标题' --ehlo admin --header-X-Mailer 'Gmail' --header-Message-Id ''
Python+swaks批量发送邮件
cat > phishingmail.py
import random
import os
def excute_fromaddress():
cs=''
for i in range(5):
r1=str(random.randint(0,9))
r2=chr(random.randint(65,90))
r3=chr(random.randint(97,122))
rr=random.choice([r1,r2,r3])
cs=cs+rr
cs=cs+"@"
for i in range(5):
r1=str(random.randint(0,9))
r2=chr(random.randint(65,90))
r3=chr(random.randint(97,122))
rr=random.choice([r1,r2,r3])
cs=cs+rr
cs=cs+".com"
return str(cs)
def excute_toaddress():
with open(r'user.txt','r') as f:
users=f.readlines()
return users
def excute_messageid():
cs=''
for i in range(8):
r1=str(random.randint(1,9))
r2=chr(random.randint(65,74))
rr=random.choice([r1,r2])
cs=cs+rr
cs=cs+"."
for i in range(4):
r1=str(random.randint(1,9))
r2=chr(random.randint(65,74))
rr=random.choice([r1,r2])
cs=cs+rr
cs=cs+"."
for i in range(11):
r1=str(random.randint(1,9))
r2=chr(random.randint(65,74))
rr=random.choice([r1,r2])
cs=cs+rr
return str(cs)
def send_mail():
users=excute_toaddress()
for user in users:
if user:
toaddress = user.strip('\n') + '@gmail.com'
fromaddress=excute_fromaddress()
command="swaks --to " + toaddress + " --from '" + fromaddress + "' --h-From: '\"it@gmail.com\" <" + fromaddress + ">' --attach-type 'text/html; charset=UTF-8' --attach-body mail.txt" + "--header 'Subject:邮件标题' --ehlo admin --header-X-Mailer 'Gmail' --header-Message-Id '<" + str(excute_messageid) + ".Gmail.it@gmail.com>'"
os.system(command)
if __name__ == '__main__':
print(send_mail())
参考链接:
http://www.jetmore.org/john/code/swaks/latest/doc/ref.txt