Code Monkey home page Code Monkey logo

res-2021-labo-smtp's Introduction

RES-2021-Labo-SMTP

Alessando Parrino & Dylan Canton
02.05.2021

Description of project

This application allows you to send fake prank emails to a group of people. To do this, you can specify a list of victims to form groups of people. Each group must consist of at least two receivers and one sender belonging to the list of victims, the number of groups created will be specified by the user. The sender victim will send the prank mail to each receiver, the email will contain a subject and content taken randomly from a list of messages. The main purpose is to make the receivers believe that the sender was the author of the message

Getting Started

1. Installation

  1. Clone the repo

    git clone https://github.com/Alessandro-AP/RES-2021-Labo-SMTP.git
  2. Execute main's application in MainApplication.java


2. Instructions configuration

To change the application settings you can edit the config.properties file where you can define 3 parameters :

  • server address
  • server port
  • number of people groups that the application should create

Configure text files

To modify the victims list or the message list that will compose the emails, it is possible to edit the files contained in the /data folder, in this folder we find :

  • email.txt : text files containing the emails of the victims, each email must be separated by a line return.
  • messages.txt : text file containing the list of messages, as a convention we decided that the first line of the message represents the subject and the rest of the message represents the content of the mail. Each message is separated by a line return and a delimiter "---".

Exemple:

Dear Tina
I love you.
---

3. Setting up a mock SMTP server

A mockserver is a server, running locally on the machine, which provides services similar to a classic production server. This kind of server is useful during development or just out of curiosity since it simulates the functionality of a real server.

There is a wide range of mockservers on the web that simulate, for example a mail (SMTP), web (HTTP / HTTPS) server. For more information : https://www.mock-server.com/

In this application, we use MockMock, which is a mock SMTP server :

https://github.com/tweakers/MockMock

Two methods of setting up the server are presented here, the user is free to choose the method that suits him, the result being the same.

  • Basic way

    The basic way is just executing the mockserver on our machine :

    Important : You need the java JDK to be able to execute a .jar file on your workstation.

  1. First download the MockMock.jar file at https://github.com/tweakers/MockMock, in the section Installation/Setup.

  2. Put the file wherever you want and open a terminal in the same folder as the .jar file.

  3. Finally, execute the following command in the terminal

    java -jar MockMock.jar
    
  4. You should have the following result at the console, it means that the mockserver started correctly:

    mockserverLaunchTerminalOutput

  5. The mockserver is now started and ready to work.

  • Docker way

    In this case, we use docker to launch the mockserver in a docker container from a docker image.

    If you are not familiar with docker, take a look at the documentation for the installation :

    https://www.docker.com/get-started

  1. Go to the docker folder in the project.

  2. Open a terminal in this folder.

  3. Build the docker's image by running the build-image.sh script.

    ./build-image.sh
  4. Start the docker's container by running the run-container.sh script.

    ./run-container.sh
  5. You should have the same result at the console as in step 4 in the basic way.

  6. The mockserver is now started and ready to work.

Once the mockserver has been launched (no matter which way you have chosen), SMTP messages sent to port 25 will be intercepted by the mockserver on port 8282.

MockMock provides a web interface to view the received mails, to access them, open a browser and enter the url localhost:8282.

You should have the following page in your browser :

mockserverPage

The mockserver is now started and ready to work. Use the browser interface to see and manage emails.

Implementation

The application has been structured according to the following UML diagram:

UML_diagram.png

Class descriptions :

  • Person : This class represents the person victim, it has an email address (the address should be valid).
  • Group : This class represents groups of people who are victims.
  • Prank : This class represents the prank that will appear in the email, it is composed of the victim sender, a list of victim receivers and the prank message.
  • Email : This class represents a real email, it consists of a recipient a list of recipients, a list of CC, a subject and a content.
  • DataParser : Class that takes care of parse our .txt files (contained in the /data folder) into Java objects.
  • AppConfiguration : This class contains the system configurations defined in the file config.properties.
  • PrankMaker : This class generates "Prank" randomly.
  • SmtpClient : SMTP client that takes care of sending emails, it is built using Java Sockets and requires an IP address and a port.
  • MainApplication : The main class of the application, it uses AppConfiguration class to retrieve information about the server, then generates pranks through the PrankMaker and uses them to form emails objects. At last, the SMTP client retrieves these mails in order to send them.

res-2021-labo-smtp's People

Contributors

alessandro-ap avatar cantondy avatar

Watchers

 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.