Advertisement
Sweetening

GSMEvil.py

Nov 1st, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.04 KB | None | 0 0
  1. import os
  2. import sqlite3
  3. from datetime import datetime
  4. from flask import Flask, render_template
  5. from flask_socketio import SocketIO
  6. from threading import Thread
  7. from optparse import OptionParser
  8.  
  9. app = Flask(__name__)
  10. socketio = SocketIO(app)
  11. sniffers_state = {"sms": False, "imsi": False, "gsm": False}
  12.  
  13. # Ensure the database directories exist
  14. def ensure_database_directories():
  15. db_dirs = ['database/imsi.db', 'database/sms.db']
  16. for db_path in db_dirs:
  17. db_dir = os.path.dirname(db_path)
  18. if not os.path.exists(db_dir):
  19. os.makedirs(db_dir)
  20.  
  21. class GsmSniffer:
  22. def __init__(self):
  23. # Initialization code here
  24. self.imsi_evil = ImSiEvil()
  25. self.sms_evil = SmsEvil()
  26.  
  27. def sniffer(self):
  28. print("Sniffer started.")
  29. # Implement your sniffer logic here
  30. # Call self.imsi_evil.get_imsi(packet) and self.sms_evil.get_sms(packet)
  31. pass
  32.  
  33. class ImSiEvil:
  34. def __init__(self):
  35. self.sql_conn = self.connect_db('database/imsi.db')
  36. self.create_imsi_table()
  37.  
  38. def connect_db(self, db_path):
  39. conn = sqlite3.connect(db_path)
  40. return conn
  41.  
  42. def create_imsi_table(self):
  43. self.sql_conn.execute('''
  44. CREATE TABLE IF NOT EXISTS imsi_data (
  45. id INTEGER PRIMARY KEY,
  46. imsi TEXT,
  47. tmsi TEXT,
  48. mcc INTEGER,
  49. mnc INTEGER,
  50. lac INTEGER,
  51. ci INTEGER,
  52. date_time TIMESTAMP
  53. )
  54. ''')
  55. self.sql_conn.commit()
  56.  
  57. def save_data(self, imsi, tmsi, mcc, mnc, lac, ci):
  58. date_time = datetime.now().strftime("%H:%M:%S %Y-%m-%d")
  59. self.sql_conn.execute('''
  60. INSERT INTO imsi_data(imsi, tmsi, mcc, mnc, lac, ci, date_time)
  61. VALUES (?, ?, ?, ?, ?, ?, ?)''', (imsi, tmsi, mcc, mnc, lac, ci, date_time))
  62. self.sql_conn.commit()
  63.  
  64. def get_imsi(self, packet):
  65. # Extract IMSI information from the packet
  66. # Implement logic to extract IMSI here
  67. pass
  68.  
  69. class SmsEvil:
  70. def __init__(self):
  71. self.sql_conn = self.connect_db('database/sms.db')
  72. self.create_sms_table()
  73.  
  74. def connect_db(self, db_path):
  75. conn = sqlite3.connect(db_path)
  76. return conn
  77.  
  78. def create_sms_table(self):
  79. self.sql_conn.execute('''
  80. CREATE TABLE IF NOT EXISTS sms_data (
  81. id INTEGER PRIMARY KEY,
  82. text TEXT,
  83. sender TEXT,
  84. receiver TEXT,
  85. date_time TIMESTAMP
  86. )
  87. ''')
  88. self.sql_conn.commit()
  89.  
  90. def save_data(self, text, sender, receiver):
  91. date_time = datetime.now().strftime("%H:%M:%S %Y-%m-%d")
  92. self.sql_conn.execute('''
  93. INSERT INTO sms_data(text, sender, receiver, date_time)
  94. VALUES (?, ?, ?, ?)''', (text, sender, receiver, date_time))
  95. self.sql_conn.commit()
  96.  
  97. def get_sms(self, packet):
  98. # Extract SMS information from the packet
  99. # Implement logic to extract SMS here
  100. pass
  101.  
  102. def header():
  103. os.system('clear')
  104. title = '''
  105. ▄██████▄ ▄████████ ▄▄▄▄███▄▄▄▄ ▄████████ ▄█ █▄ ▄█ ▄█
  106. ███ ███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███
  107. ███ █▀ ███ █▀ ███ ███ ███ ███ █▀ ███ ███ ███▌ ███
  108. ▄███ ███ ███ ███ ███ ▄███▄▄▄ ███ ███ ███▌ ███
  109. ▀▀███ ████▄ ▀███████████ ███ ███ ███ ▀▀███▀▀▀ ███ ███ ███▌ ███
  110. ███ ███ ███ ███ ███ ███ ███ █▄ ███ ███ ███ ███
  111. ███ ███ ▄█ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███▌ ▄
  112. ████████▀ ▄████████▀ ▀█ ███ █▀ ██████████ ▀██████▀ █▀ █████▄▄██
  113. ☠️ GSM EVIL ☠️
  114. --------------------------------------------------------------------------------
  115.  
  116. About:-
  117. Author: Taylor Christian Newsome
  118. Version : 1.0.0
  119.  
  120. Disclaimer:-
  121. This program was made to understand how GSM networks work.
  122. Use at your own risk!
  123. We are not responsible for any illegal activity!
  124.  
  125. --------------------------------------------------------------------------------
  126. '''
  127. print("\033[0;31;48m" + title)
  128.  
  129. @socketio.on('sms_sniffer')
  130. def handle_sms_event(json):
  131. if json == "on":
  132. if not sniffers_state["sms"]:
  133. sniffers_state["sms"] = True
  134. print("SMS sniffer started")
  135. if not sniffers_state["gsm"]:
  136. sniffers_state["gsm"] = True
  137. else:
  138. if sniffers_state["sms"]:
  139. sniffers_state["sms"] = False
  140. print("SMS sniffer stopped")
  141. socketio.emit('sniffers', sniffers_state)
  142.  
  143. @socketio.on('imsi_sniffer')
  144. def handle_imsi_event(json):
  145. if json == "on":
  146. if not sniffers_state["imsi"]:
  147. sniffers_state["imsi"] = True
  148. print("IMSI sniffer started")
  149. if not sniffers_state["gsm"]:
  150. sniffers_state["gsm"] = True
  151. else:
  152. if sniffers_state["imsi"]:
  153. sniffers_state["imsi"] = False
  154. print("IMSI sniffer stopped")
  155. socketio.emit('sniffers', sniffers_state)
  156.  
  157. @app.route('/')
  158. def home():
  159. return render_template('home.html')
  160.  
  161. @app.route('/sms/')
  162. def sms():
  163. return render_template('sms.html')
  164.  
  165. @app.route('/imsi/')
  166. def imsi():
  167. return render_template('imsi.html')
  168.  
  169. def server():
  170. app.run(host='0.0.0.0', port=80, threaded=True)
  171.  
  172. if __name__ == "__main__":
  173. ensure_database_directories() # Create database directories if needed
  174. header()
  175. parser = OptionParser(usage="%prog: [options]")
  176. parser.add_option("-i", "--iface", dest="iface", default="lo", help="Interface (default: lo)")
  177. parser.add_option("-p", "--port", dest="port", default="80", type="int", help="Port (default: 80)")
  178. parser.add_option("--host", dest="host", default="localhost", help="Host (default: localhost)")
  179. (options, args) = parser.parse_args()
  180.  
  181. server_thread = Thread(target=server)
  182. server_thread.start()
  183. header()
  184. try:
  185. gsm_sniffer = GsmSniffer() # Initialize the GSM Sniffer
  186. gsm_sniffer.sniffer() # Start the sniffer
  187. except KeyboardInterrupt:
  188. print('Interrupted')
  189. print('GsmEvil 2 closed!')
  190. os._exit(0)
  191.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement