Skip to content
/ mftp Public
forked from metakgp/mftp

Automatic updates for KGP T&P make murderous rage slightly pleasant.

License

Notifications You must be signed in to change notification settings

lakshz/mftp

 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License Wiki


MFTP - My Freaking Training & Placements

CDC Noticeboard on Your Mail: Where Automatic Updates Turn Chaos into Pleasure!
Report Bug · Request Feature

Table of Contents

About The Project


MFTP continuously monitors the CDC Noticeboard and forwards incoming notices to the configured email address, whether it's an individual account or a Google Group. It is also available as a service and as a cronjob on linux systems.

Warning This tool is completely legal, but the way you use it can get you into legal trouble. Some things you cannot do are:

  • Use this tool to send CDC notifications to any non-KGPian.
  • Use this tool on a wide scale or publicise its running instance without consent from the Placement Committee.

Please use this tool responsibly and within ethical and legal bounds. We do not promote violating company policies or laws. The extent of the punishment may very from disciplinary action by the institute to blacklisting from CDC process.

(back to top)

Supports:

  1. Shells
    • bash
    • zsh
  2. OS(s)
    • any *nix[GNU+Linux and Unix]

(back to top)

Setup

To set up a local instance of the application, follow the steps below.

Prerequisites

The following requirements are to be satisfied for the project to function properly:

  • python3 >=python3.10
    sudo apt update
    sudo apt install python3
  • MongoDB clusters' URI. Create an account on MongoDB Atlas and then create a cluster, give yourself access to that cluster and get the mongoDB connect URI.
  • This project depends on ERP Login module by Arpit Bhardwaj for the ERP Login workflow. Read its documentation and setup your environment for it.

(back to top)

Installation

Now that the environment has been set up and configured to properly compile and run the project, the next step is to download and configure the project locally on your system.

  1. Clone the repository

    git clone https://github.com/metakgp/MFTP.git
    cd ./MFTP
  2. Install required dependencies

    pip3 install -r requirements.txt
  3. Sending Emails

    The tool provides two methods of sending emails.

    Why?
    Because on campus LAN port 465 (SMTP port) is blocked and if you want to host it on an internal server on the campus LAN, you will need another method than SMTP.
    However, it is preferred to use SMTP when hosting on external server as SMTP is the easiest of the two.

    • Using SMTP

      --smtp

      • Create an app password for the senders' email.
      • After creating app password use it as your FROM_EMAIL_PASS value in next step.
    • Using GMAIL API

      --gmail-api

      • Follow this quick start guide to configure gmail api on the senders' mail.
      • After successfull configuration of gmail api, you can leave the value of FROM_EMAIL_PASS as it is in the next step.
  4. Configuring environment variables

    • Copy env.example.py as env.py. It looks like this:
      # ERP Credentials
      ROLL_NUMBER = "XXYYXXXXX"
      PASSWORD = "**********"
      SECURITY_QUESTIONS_ANSWERS = {
          "Q1" : "A1",
          "Q2" : "A2",
          "Q3" : "A3",
      }
      
      # EMAIL CREDENTIALS
      FROM_EMAIL = "abc@gmail.com"
      FROM_EMAIL_PASS = "**********"
      
      # OTHER PARAMETERS
      BCC_EMAIL_S = ["xyz@googlegroups.com", "abc@googlegroups.com"] # Multiple mails for bcc
      # BCC_EMAIL_S = ["xyz@googlegroups.com"] # This is how you can set single mail in a list
      MONGODB_URI = "%****%******%"
    • Update the values inside the double quotes ("). DO NOT CHANGE VAR NAMES.
  5. Configure the mftp service For linux systems MFTP is available as a service and as a cronjob. To configure it, execute the following commands after navigating into the root directory of the project (inside the mftp folder).

    cd service/
    ./configure-service.sh

(back to top)

Usage

It is mandatory to provide either of the following flags to the execution command.

  • --smtp
  • --gmail-api
python3 mftp.py --smtp        # Using SMTP for sending mails
python3 mftp.py --gmail-api   # Using GMAIL API for sending mails

Using MFTP as a Service

After configuring MFTP as a service, you can use the mftp command with several options to interact with the tool as a service.
Following is the help menu for the service.

Usage: mftp [OPTIONS]

Options:
  -h, --help               Display this help and exit
  logs [OPTIONS]           Display last 25 lines of log file
    Options:
      clear                 Clear the log file
      NUM                   Display last NUM lines of log file
  disable                  Disable mftp service
  enable                   Enable mftp service
  status                   Check status of mftp service
  restart                  Restart mftp service
  stop                     Stop mftp service
  start                    Start mftp service
  cronjob [OPTIONS]        Use mftp as a cronjob
    Options:
      enable [NUM]             Enable mftp cronjob after every NUM minutes (default is 2 minutes)
      disable                  Disable mftp cronjob
      status                   Check status of mftp cronjob

(back to top)

Maintainer(s)

(back to top)

Contact

📫 Metakgp - Metakgp's slack invite Metakgp's email metakgp's Facebook metakgp's LinkedIn metakgp's Twitter metakgp's Instagram

(back to top)

Additional documentation

(back to top)

About

Automatic updates for KGP T&P make murderous rage slightly pleasant.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 63.6%
  • Shell 35.7%
  • Dockerfile 0.7%