]>
gitweb.pimeys.fr Git - scripts-20-100.git/blob - spambot/spambot.py
2 # -*- encoding: utf-8 -*-
4 # Pour envoyer des mails en masses à plein de gens, parce que y'en a marre à la fin
11 if "--debug" in sys
.argv
:
15 if "--quiet" in sys
.argv
:
18 def sendmail(to
, subject
, body
, froms
=[u
"20-100's spambot <legallic@crans.org>"], cc
=[]):
19 if isinstance(to
, unicode) or isinstance(to
, str):
21 if isinstance(cc
, unicode) or isinstance(cc
, str):
23 if isinstance(froms
, unicode) or isinstance(froms
, str):
26 cc
, to
= [], [u
"Default target for testing spambot <legallic@crans.org>"]
27 headers
= u
"From: %s\nTo: %s\n" % (", ".join(froms
), ", ".join(to
))
29 headers
+= u
"Cc: %s\n" % (", ".join(cc
))
30 headers
+= u
"Subject: %s\n" % email
.Header
.make_header([(subject
, "utf8")]).encode()
31 headers
+= u
"Content-Type: text/plain; charset=UTF-8\n"
32 mail
= headers
+ "\n" + body
33 mailer
= os
.popen("/usr/sbin/sendmail -t", "w")
34 mailer
.write(mail
.encode("utf-8") + "\n.")
40 print "Spamming quelu about WiFi profile."
41 sendmail("pellissier@crans.org", "Profil Wifi", u
"Au fait, tu devais pas me filer un profil Wifi ?\n\n-- \n20-100, qui s'est enfin codé son spambot")
45 def spam_acoeur(qui
, combien
):
47 print "Spamming %s about Bus/Pot A♡" % qui
50 Petit mail pour te rappeler que, tous calculs confondus, pour le bus et/ou le pot A♡, tu dois encore %s€.
51 Ce serait cool que tu me fasses un virement.
53 Si tu préfères par virement note ou par espèces (bof), envoie-moi un mail.
55 Si tu as déjà remboursé et que tu reçois ce mail, préviens-moi, j'ai du merder quelque part…
58 20-100, trésorier des A♡""" % combien
59 sendmail(qui
, u
"[Bus et/ou Pot A♡] Remboursement", body
)
62 l
= open("acoeurlist.txt").readlines()
63 l
= [i
.strip() for i
in l
if not i
.strip().startswith("#") and i
.strip() != ""]
64 return [i
.split(" ") for i
in l
]
68 for (qui
, combien
) in liste
:
69 spam_acoeur(qui
, combien
)
75 todolist
= [spam_quelu
] #, spam_acoeurs]#, spam_29C3]
76 if __name__
== "__main__":
77 for action
in todolist
: