bernhard: utils/testing test-send-emails-excessive-invitations.py, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Mon May 5 19:09:43 CEST 2008


Author: bernhard

Update of /kolabrepository/utils/testing
In directory doto:/tmp/cvs-serv14846

Added Files:
	test-send-emails-excessive-invitations.py 
Log Message:
New file for bad invitations.


--- NEW FILE: test-send-emails-excessive-invitations.py ---
#!/usr/bin/env python
"""Send emails with iTIP invitations trying to overload the client.

Usage $progname <recipientemailaddress>

This script is Free Software under the GNU General Public License >=v2.
bernhard at intevation.de (initial 20080505)
"""

__version__="$Revision: 1.1 $"
# $Source: /kolabrepository/utils/testing/test-send-emails-excessive-invitations.py,v $

import sys

import datetime
import itertools
import smtplib
import string

msgbase="""Subject: %s
From: nobody at example.org
Date: Thu, 15 Mar 2008 15:18:02 +0200
MIME-Version: 1.0
Content-Type: text/calendar;
  method=request;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

BEGIN:VCALENDAR
PRODID:-//K Desktop Environment//NONSGML libkcal 3.5//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20080505T155557Z
ORGANIZER;CN=Tim Test 3:MAILTO:ttest3 at example.org
ATTENDEE;CN=Tim Test 3;RSVP=FALSE;PARTSTAT=ACCEPTED;
 ROLE=REQ-PARTICIPANT:mailto:ttest3 at example.org
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:
 btest at example.org
ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:
 ttest2 at example.org
CREATED:20080505T155507Z
UID:%s
SEQUENCE:0
LAST-MODIFIED:20080505T155557Z
SUMMARY:Long running appointment with many exceptions
RRULE:FREQ=DAILY;COUNT=50000
EXDATE;VALUE=DATE:20080506
%s
DTSTART:20080505T163000Z
DTEND:20080505T170000Z
TRANSP:OPAQUE
END:VEVENT

END:VCALENDAR
"""


uidbase = "-2"
date = datetime.date(2008,5,6)
lines = ""
c = itertools.count()

while c.next()<200:
    date = date + datetime.timedelta(days=1)
    lines = lines + "EXDATE;VALUE=DATE:%4d%02d%02d\n" % \
            (date.year, date.month, date.day)

msg1 = msgbase % ("Test1, 200 exceptions", "manually-1" + uidbase , lines)

while c.next()<42000:
    date = date + datetime.timedelta(days=1)
    lines = lines + "EXDATE;VALUE=DATE:%4d%02d%02d\n" % \
            (date.year, date.month, date.day)

msg2 = msgbase % ("Test2, 42000 exceptions", "manually-2" + uidbase , lines)

toadd = [sys.argv[1]]
smtpserver='localhost'
# if you set a loginname, aconnection via TLS and authentification is tried
loginname = None
password  = None


fromadd="nobody at example.org"
basemsg=("From: %s\r\nTo: %s\r\n%%s\r\n" % (fromadd, string.join(toadd, ", ")))

server=smtplib.SMTP(smtpserver)
#server.set_debuglevel(1)

if loginname != None and password != None:
    server.starttls()
    server.login(loginname,password)

server.sendmail(fromadd,toadd,msg1)
server.sendmail(fromadd,toadd,msg2)

server.quit()





More information about the commits mailing list