├── DrMITM.nimble ├── LICENSE ├── Python ├── DrMITM.py └── module │ └── MTG.py ├── README.md ├── lib └── eop.nim ├── src ├── DrMITM.nim └── http │ ├── .httpstatusresponse.nim.swp │ └── httpstatusresponse.nim └── tests ├── test1.nim └── test1.nims /DrMITM.nimble: -------------------------------------------------------------------------------- 1 | # Package 2 | 3 | version = "0.1.0" 4 | author = "imgp3dev" 5 | description = "DrMITM is a program designed to globally log all http/https trafficc." 6 | license = "MIT" 7 | 8 | # Dependencies 9 | 10 | requires "nim >= 0.19.0" 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 IMGP3DEV 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Python/DrMITM.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import time 3 | import socket 4 | import MTG 5 | url = input("Enter URL: ") 6 | print("sending request") 7 | payload = {"Testing"} 8 | r = requests.post(url, data=payload) 9 | print(r.text) 10 | time.sleep(1) 11 | print("IP: " socket.gethostname(url)) 12 | print("Note: the traffic request is stored in request.txt") 13 | ip = print("Switching IP") 14 | ip = url 15 | print("Sending message to the Server") 16 | resend() 17 | -------------------------------------------------------------------------------- /Python/module/MTG.py: -------------------------------------------------------------------------------- 1 | #MTG = Message Traffic Grabber. 2 | # > Getting Data that was sent to the server 3 | import socket 4 | import http.client 5 | import time 6 | def resend(url): 7 | s = socket.socket() 8 | data = HTTPConnection.set_debuglevel(3) ##Uses debugging just for an advantage of seeing more traffic. 9 | socket.create_connection(url,[10[url, 80]]) ###Connects to IP & Port.### 10 | r.send(data) 11 | sleep(2) 12 | res = input("Set a timer for how long you want to log the traffic or press E if you want to go in live logging mode or b to go into traffic blocking mode: ") 13 | if res == "e": 14 | s.listen() 15 | data = file object = open(Log.txt [,w][, 0 ]) ###Listens to traffic and resort to Creating Log.txt then output "Data" to it. 16 | if res == "b" 17 | num = print("Enter any number from 1-3: ") 18 | ###^To make sure it doesnt execute for no reason### 19 | while (num < 10): 20 | r.send(spam) 21 | spam = print("########################") 22 | num = num + 1 23 | resend() #### Sends Hashtags after stopping in traffic #### 24 | else: 25 | s.listen() 26 | sleep(res) 27 | data = file object = open(Log.txt [,w][, 0 ]) ###Same goes for this.### 28 | 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # D̳r̳M̳I̳T̳M̳ 2 | DrMITM is a program designed to globally log all traffic. 3 | 4 | # Diagram: 5 | ![programidea](https://user-images.githubusercontent.com/42507604/51783887-7a7c5600-2106-11e9-81a1-1d693e69500b.png) 6 | 7 | # H̳o̳w̳ i̳t̳ w̳o̳r̳k̳s̳ 8 | DrMITM sends a request to website and returns the IP of the website just in case the server of the website is designed to rely on the website IP for requests, and the request that goes to the website also ends up being sent to the server which it will log the message that the website sends, it will then return the same message and send it directly to the server, where the server may see it as the website but it will also direct our request to the website once the program changes IP's. once it sends our request to the website, the program will then pause our traffic, and wait for incoming traffic, when a new user tries to login or whatever and the website sends a request to the server, DrMITM will receive it, and the way it gets the data back to us is by sending the same data to a file. 9 | 10 | # H̳o̳w̳ d̳o̳ i̳ g̳e̳t̳ s̳t̳a̳r̳t̳e̳d̳ 11 | 12 | For Nim version: 13 | Install 19.0 Nim(using choosenim or git clone) 14 | Git clone the repo 15 | cd into the directory 16 | Run nim DrMITM.nim 17 | 18 | 19 | For Python version: 20 | Install Python 21 | git clone the repo 22 | cd into the directory 23 | Run python DrMITM.py 24 | 25 | 26 | # ᴄᴏᴍᴍᴀɴᴅs 27 | 28 | e(live logging) 29 | 30 | b(traffic blocking) 31 | 32 | r(redirect users) 33 | 34 | # u̲p̲c̲o̲m̲i̲n̲g̲ f̲e̲a̲t̲u̲r̲e̲s̲ 35 | 36 | --ᴘʀᴇᴠᴇɴᴛɪɴɢ ᴄʟɪᴇɴᴛ ᴛʀᴀғғɪᴄ ғʀᴏᴍ ʀᴇᴀᴄʜɪɴɢ ᴛʜᴇ sᴇʀᴠᴇʀ.--(ɴᴏᴡ ᴀᴠᴀɪʟᴀʙʟᴇ) 37 | 38 | --ʀᴇᴅɪʀᴇᴄᴛɪɴɢ ᴛʀᴀғғɪᴄ--(ɴᴏᴡ ᴀᴠᴀɪʟᴀʙʟᴇ) 39 | 40 | 41 | 42 | # ᴛʜᴇᴏʀᴇᴛɪᴄᴀʟ ᴄᴏɴ 43 | 44 | ᴛʜᴇʀᴇ ᴍᴀʏ ʙᴇ ᴀ ᴘᴏssɪʙɪʟɪᴛʏ ᴛʜᴀᴛ ᴅʀᴍɪᴛᴍ ᴡɪʟʟ ғᴀɪʟ ᴀᴛ sɴɪғғɪɴɢ ᴛʀᴀғғɪᴄ ᴏғ ᴡᴇʙsɪᴛᴇs ᴛʜᴀᴛ ᴄᴏᴍᴍᴜɴɪᴄᴀᴛᴇ ᴛʜʀᴏᴜɢʜ ᴍᴜʟᴛɪᴘʟᴇ sᴇʀᴠᴇʀs ʙᴇᴄᴀᴜsᴇ ᴏғ ᴄᴏɴғɪɢᴜʀᴀᴛɪᴏɴ ʀᴇᴀsᴏɴs ᴏʀ ᴘᴏssɪʙʟʏ ᴀ ᴄʜᴀɴɢᴇ ᴏғ ᴇɴᴄʀʏᴘᴛɪᴏɴ ᴏʀ ʀᴇǫᴜɪʀᴇᴍᴇɴᴛs ᴏғ ɴᴇᴇᴅɪɴɢ ᴛᴏ ᴛʀɪᴄᴋ ᴛʜᴇ sᴇʀᴠᴇʀ. ᴀɴᴅ ɪ sᴀʏ "ᴛʜᴇʀᴇ ᴍᴀʏ" ʙᴇᴄᴀᴜsᴇ ɪᴛ ʜᴀsɴ'ᴛ ʙᴇᴇɴ ᴛᴇsᴛᴇᴅ ʏᴇᴛ. 45 | 46 | # Issue Reporting 47 | 48 | If you have an issue please submit it with the following details given: 49 | 50 | *your issue* 51 | 52 | *Your Nim Or Python version* 53 | 54 | *Operating system* 55 | 56 | *The process of what you were doing before the issue occurred* 57 | 58 | 59 | # Q&A: 60 | 61 | Q:How does live logging works? 62 | 63 | A:it just sends the logged data to a file and outputs it on screen. 64 | 65 | Q: How does the traffic block work? 66 | A: a unicode gets sent to the website from server and overflows the traffic towards incoming traffic. 67 | 68 | Q:How does the redirectio. feature works? 69 | 70 | A: it sends a fake error message + redirection status code from the server with a modified location. 71 | 72 | -------------------------------------------------------------------------------- /lib/eop.nim: -------------------------------------------------------------------------------- 1 | import times 2 | import os 3 | import httpclient 4 | import json 5 | import random 6 | import httpstatusresponse 7 | #Easy output 8 | #Quick output to DrMITM 9 | 10 | proc intro*(hello: string) = 11 | echo "Hello, Enter website URL: " 12 | let input = readLine(stdin) 13 | ###^ Grabs Input ### 14 | proc request*(send: string) = 15 | echo "sending request" 16 | ##^ Outputs sending request## 17 | proc output*(out: string) = 18 | echo "IP: ", client 19 | echo "Note: The traffic request is stored in request.txt" 20 | ###^Grabs request that the website is sending to the Server.### 21 | 22 | proc resent*(re: string) = 23 | echo "Switching IP.." 24 | echo client ######Uses client IP###### 25 | echo "Sending message to Server". 26 | 27 | proc switch*(sw: string) = 28 | echo "Changing IP back to the original.." 29 | 30 | proc Log*(lg: string) = 31 | echo "Logging the traffic.." 32 | echo "enter a command: " 33 | let lg = readLine(stdin).parseInt() 34 | if lg == "e": ##If they press e it will output data into Log.txt then output it.## 35 | echo "" 36 | proc WriteFile(File: string){ 37 | Log.txt 38 | } 39 | proc ReadFile(File: string){ 40 | Log.txt 41 | } 42 | if lg == "b": 43 | echo "Enter any number from 1-3: " ##Easier way of knowing when to loop## 44 | let lg = readLine(stdin).parseInt() 45 | proc msg*(Message: string) = "###############" 46 | while lg < 10: 47 | resent() 48 | switch() 49 | msg() 50 | inc lg 51 | ####^ if the number is less than 10 it will spam hashtags to the server after it switches#### 52 | else: 53 | echo "Timer set to: ", lg 54 | echo "starting.." 55 | sleep(lg) 56 | proc writeFile(File: string){ 57 | Log.txt 58 | } 59 | #Live-logging is seeing the requests coming instead#of data being sent to a file after given time. 60 | # 61 | # 62 | ErrorMessage(url) 63 | ##^Sends fake error message + redirection. 64 | -------------------------------------------------------------------------------- /src/DrMITM.nim: -------------------------------------------------------------------------------- 1 | import httpclient 2 | import eop 3 | import json 4 | import os 5 | intro()##Asks to enter URL## 6 | var client = newHttpClient() ##creates client## 7 | client.headers = newHttpHeaders({ "Content-Type": "application/json" }) 8 | let body = %*{ 9 | "data": "Test" ##sets up body message## 10 | } 11 | let response = client.request(input, httpMethod = HttpPost, body = $body) 12 | request() ##sends request 13 | echo response.status ##outputs status## 14 | if response.status == 200: 15 | proc createFile(dir: string){ 16 | request.txt 17 | } 18 | ##If the status is 200 it creates a file called request.txt and start the other functions## 19 | output() #Outputs IP. 20 | resent() #Resends Data 21 | switch() #Changes IP to original 22 | Log() #Logs traffic 23 | else: 24 | echo "Sorry there's an error." 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/http/.httpstatusresponse.nim.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Imgp3Dev/DrMITM/61fa1649c7f4b964f787f6b8d913ae08b6103289/src/http/.httpstatusresponse.nim.swp -------------------------------------------------------------------------------- /src/http/httpstatusresponse.nim: -------------------------------------------------------------------------------- 1 | import asynchttpserver, asyncdispatch, json 2 | import os 3 | ##Creates server on your IP 4 | 5 | proc ErrorMessage*(url: string) = 6 | var server = newAsyncHttpServer() 7 | proc cb(req: Request) {.async.} = 8 | await req.respond(Http200, "Redirected") 9 | 10 | waitFor server.serve(Port(8080), cb) 11 | 12 | ##Setting up content and responses 13 | proc handler(req: Request) {.async.} = 14 | if req.url.path == "/message": 15 | 16 | let msg = %* {"message": "Success"} 17 | let headers = newHttpHeaders([("Content-Type","application/json")]) 18 | await req.respond(Http302, $msg, headers,) 19 | proc WriteFile(File: string){ 20 | Http.txt 21 | } 22 | proc ReadFile(File: string){ 23 | Http.txt 24 | } 25 | #####Creates and display file content of http redirection status code##### 26 | else: 27 | await req.respond(Http404, "Not Found") 28 | -------------------------------------------------------------------------------- /tests/test1.nim: -------------------------------------------------------------------------------- 1 | doAssert(1 + 1 == 2) 2 | -------------------------------------------------------------------------------- /tests/test1.nims: -------------------------------------------------------------------------------- 1 | switch("path", "$projectDir/../src") --------------------------------------------------------------------------------