add tokens for netre

This commit is contained in:
Neale Pickett 2013-01-31 13:51:56 -07:00
parent fa0078ac69
commit 26e6a20573
2 changed files with 27 additions and 9 deletions

View File

@ -1,6 +1,11 @@
From: The Tracer FIRE Registration Fairy <neale@lanl.gov>
To: RCPT
Subject: Tracer FIRE: Your Course Assignment
Subject: Tracer FIRE: Your Course Assignment (repeat email)
This is a repeat email of your course assignment. Some people didn't
recieve their assignment on Monday. This should not contain any new
information if you've already seen your course assignment.
Your course assignment is:

View File

@ -1,14 +1,27 @@
#! /usr/bin/python3
import smtplib
import sys
courses = {
"net": "Network Archaeology",
"mal": "Malware Reverse-Engineering",
"hst": "Host Forensics",
"icc": "Incident Coordination",
"nil": "None",
}
smtpd = smtplib.SMTP("mail.lanl.gov")
template = open("hubs-mail.txt").read()
for line in open("assignments.txt"):
course, email = line.strip().split()
print(email)
msg = template.replace("RCPT", email)
smtpd.sendmail("neale@lanl.gov", [email], msg)
template = sys.stdin.read()
if 'RCPT' not in template:
print("Pass the template on stdin.")
else:
for line in open("assignments.txt"):
course, email = line.strip().split()
coursename = courses[course]
print(email)
msg = template.replace("RCPT", email).replace("COURSE", coursename)
smtpd.sendmail("neale@lanl.gov", [email], msg)
#print(msg)