GithubHelp home page GithubHelp logo

dmnrcht / teaching-heigvd-res-2016-labo-smtp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akessonhenrik/teaching-heigvd-res-2016-labo-smtp

0.0 3.0 0.0 395 KB

Lab to experiment with the SMTP protocol (client-side)

Java 100.00%

teaching-heigvd-res-2016-labo-smtp's Introduction

Teaching-HEIGVD-RES-2016-Labo-SMTP

Members

Description

This program is responsible for sending fake messages to a list of emails victims.

From lists of emails and messages, the application generate random groups of N emails and one message. One email is the sender, the others are the recipients.

Configuration

Three configuration files allow to set application parameters (resources/config.properties) to define the list of emails (resources/emails.utf8) and define the messages to send (resources/messages.utf8).

The config.properties file must define :

  • smtpServerAddress and smtpServerPort : the SMTP configuration
  • sendBCCTo : an email address that will receive a blinded carbon copy of all emails sent
  • numberOfGroups : the number of group to create (a group corresponding to a prank).

Execution

From the time when the configuration files have been filled, the application can be executed without arguments.

The project use Maven as build system :

  • Build the project with the command : mvn clean package
  • Execute the application with : java -jar target/MailPranker-1.0.jar
  • Laugh!

Execution of MockMock as SMTP test server

The MockMock project could be cloned from the repo : https://github.com/tweakers-dev/MockMock.

It provide a SMTP server that will intercept all the passing emails and provide a web interface to see them. You need to build the project and execute the jar file to launch the server.

There is some options to define custom ports :

  • -p 2525 : the SMTP server will listen on the port 2525
  • -h 8080 : the HTTP server (for the web interface) will listen on the port 8080

For example : java -jar MockMock-1.4.0.one-jar.jar -p 2525 -h 8080

Docker/Vagrant warning

If you use a virtualised environment, don't forget to map the ports of your VM to your host. For example, you can execute PrankMailer and MockMock inside Vagrant and access the MockMock web interface with your favorite browser if you map your 8080 port to the Vagrant 8080 port.

Implementation

Class diagram

There is three packages, for the config classes, the smtp classes, and the PrankMailer specifics classes.

Implementation details

The three packages shows the main structure of the project. Each package can be shown as a responsibility of the application. There is one more MailPranker object out of packages which goal is to initiate the application. It gets the configurations from config file using the ConfigLoader and Config objects, generates the pranks with the PrankGenerator, and configure an SMTP connection to send the pranks.

The config package is responsible to load informations stored in the different files. ConfigLoader, MessagesLoader and EmailsLoader loads respectively configs, messages, and emails.

The purpose of model package is to generates pranks and send them. A prank is composed of one message (with a subject and a body) and at least three or more emails. It implements the ISmtpMessage to have properly formed pranks for SMTP protocol. Once the prank is created, the PrankGenerator sends it with his SmtpClient class instance.

Finally, in the smtp package, the SmtpClient class establishes a connection with the STMP server (the one specified in config.properties file) and sends the SmtpMessage prank previously created using the SMTP protocol communication (RFC 821).

teaching-heigvd-res-2016-labo-smtp's People

Contributors

dmnrcht avatar wasadigi avatar sebastienrichoz avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.