From: Vincent Le Gallic Date: Sun, 20 Oct 2013 22:35:58 +0000 (+0200) Subject: C'était pour spammer pour avoir les cotiz post-pot X-Git-Url: http://gitweb.pimeys.fr/?p=scripts-20-100.git;a=commitdiff_plain;h=64e9a0d0f2ea7bfdce03ccb6b13afff1d5b95760 C'était pour spammer pour avoir les cotiz post-pot --- diff --git a/.gitignore b/.gitignore index d4a2498..77f5cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,11 @@ vrun/ # Pas utile regen_config_SOGo.sh -# Outputs or working giles +# Outputs or working files newsbot/workingfile newsbot/dicoread.txt ssh/plouf.json color_output test_color_output bde/old/integrite/*.sql +spambot/acoeurlist.txt diff --git a/spambot/spambot.py b/spambot/spambot.py new file mode 100755 index 0000000..1a782aa --- /dev/null +++ b/spambot/spambot.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +# Pour envoyer des mails en masses à plein de gens, parce que y'en a marre à la fin + +import os +import email +import sys + +DEBUG = False +if "--debug" in sys.argv: + DEBUG = True + +QUIET = False +if "--quiet" in sys.argv: + QUIET = True + +def sendmail(to, subject, body, froms=[u"20-100's spambot "], cc=[]): + if isinstance(to, unicode) or isinstance(to, str): + to = [to] + if isinstance(cc, unicode) or isinstance(cc, str): + cc = [cc] + if isinstance(froms, unicode) or isinstance(froms, str): + froms = [froms] + if DEBUG: + cc, to = [], [u"Default target for testing spambot "] + headers = u"From: %s\nTo: %s\n" % (", ".join(froms), ", ".join(to)) + if cc: + headers += u"Cc: %s\n" % (", ".join(cc)) + headers += u"Subject: %s\n" % email.Header.make_header([(subject, "utf8")]).encode() + headers += u"Content-Type: text/plain; charset=UTF-8\n" + mail = headers + "\n" + body + mailer = os.popen("/usr/sbin/sendmail -t", "w") + mailer.write(mail.encode("utf-8") + "\n.") + mailer.close() + + +def spam_quelu(): + if not QUIET: + print "Spamming quelu about WiFi profile." + 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") + + + +def spam_acoeur(qui, combien): + if not QUIET: + print "Spamming %s about Bus/Pot A♡" % qui + body = u"""Plop, + +Petit mail pour te rappeler que, tous calculs confondus, pour le bus et/ou le pot A♡, tu dois encore %s€. +Ce serait cool que tu me fasses un virement. + +Si tu préfères par virement note ou par espèces (bof), envoie-moi un mail. + +Si tu as déjà remboursé et que tu reçois ce mail, préviens-moi, j'ai du merder quelque part… + +-- +20-100, trésorier des A♡""" % combien + sendmail(qui, u"[Bus et/ou Pot A♡] Remboursement", body) + +def get_acoeurs(): + l = open("acoeurlist.txt").readlines() + l = [i.strip() for i in l if not i.strip().startswith("#") and i.strip() != ""] + return [i.split(" ") for i in l] + +def spam_acoeurs(): + liste = get_acoeurs() + for (qui, combien) in liste: + spam_acoeur(qui, combien) + + +def spam_29C3(): + return + +todolist = [spam_quelu] #, spam_acoeurs]#, spam_29C3] +if __name__ == "__main__": + for action in todolist: + action()