Exemple #1
0
    def initialize(self, options):
        '''Called if plugin is enabled, passed the options namespace'''
        self.options           = options
        self.dnscfg            = self.config['MITMf']['DNS']
        self.dhcpcfg           = self.config['Spoof']['DHCP']
        self.targets           = options.targets
        self.arpmode           = 'rep' or options.arpmode
        self.manualiptables    = options.manualiptables
        self.mymac             = SystemConfig.getMAC(options.interface)
        self.myip              = SystemConfig.getIP(options.interface)
        self.protocolInstances = []

        #Makes scapy more verbose
        debug = False

        if options.arp:

            if not options.gateway:
                shutdown("[-] --arp argument requires --gateway")

            if options.targets is None:
                #if were poisoning whole subnet, start ARP-Watch
                arpwatch = ARPWatch(options.gateway, self.myip, options.interface)
                arpwatch.debug = debug

                self.tree_info.append("ARPWatch online")
                self.protocolInstances.append(arpwatch)

            arp = ARPpoisoner(options.gateway, options.interface, self.mymac, options.targets)
            arp.arpmode = self.arpmode
            arp.debug = debug

            self.protocolInstances.append(arp)


        elif options.icmp:

            if not options.gateway:
                shutdown("[-] --icmp argument requires --gateway")

            if not options.targets:
                shutdown("[-] --icmp argument requires --targets")

            icmp = ICMPpoisoner(options.interface, options.targets, options.gateway, self.myip)
            icmp.debug = debug

            self.protocolInstances.append(icmp)

        elif options.dhcp:

            if options.targets:
                shutdown("[-] --targets argument invalid when DCHP spoofing")

            dhcp = DHCPServer(options.interface, self.dhcpcfg, self.myip, self.mymac)
            dhcp.shellshock = options.shellshock
            dhcp.debug = debug
            self.protocolInstances.append(dhcp)

        if options.dns:

            if not options.manualiptables:
                if IpTables.getInstance().dns is False:
                    IpTables.getInstance().DNS(self.dnscfg['port'])

        if not options.arp and not options.icmp and not options.dhcp and not options.dns:
            shutdown("[-] Spoof plugin requires --arp, --icmp, --dhcp or --dns")

        SystemConfig.setIpForwarding(1)

        if not options.manualiptables:
            if IpTables.getInstance().http is False:
                IpTables.getInstance().HTTP(options.listen)

        for protocol in self.protocolInstances:
            protocol.start()
Exemple #2
0
    parser.print_help()
    sys.exit(1)

args = parser.parse_args()

# Definitely a better way to do this, will need to clean this up in the future
# Checks to see if we called a plugin's options without first invoking the actual plugin
for plugin, options in arg_dict.iteritems():
    if vars(args)[plugin] is False:
        for option in options:
            if vars(args)[option.dest]:
                sys.exit("[-] Called plugin options without invoking the actual plugin (--{})".format(plugin))

#check to see if we supplied a valid interface
myip  = SystemConfig.getIP(args.interface)
mymac = SystemConfig.getMAC(args.interface)

#Start logging
log_level = logging.__dict__[args.log_level.upper()]

logging.basicConfig(level=log_level, format="%(asctime)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
logFormatter = logging.Formatter("%(asctime)s %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
mitmf_logger = logging.getLogger('mitmf')
fileHandler = logging.FileHandler("./logs/mitmf.log")
fileHandler.setFormatter(logFormatter)
mitmf_logger.addHandler(fileHandler)

#####################################################################################################

#All our options should be loaded now, initialize the plugins
print "[*] MITMf v{} online... initializing plugins".format(mitmf_version)
Exemple #3
0
    def initialize(self, options):
        '''Called if plugin is enabled, passed the options namespace'''
        self.options = options
        self.dnscfg = self.config['MITMf']['DNS']
        self.dhcpcfg = self.config['Spoof']['DHCP']
        self.targets = options.targets
        self.arpmode = options.arpmode or 'rep'
        self.manualiptables = options.manualiptables
        self.mymac = SystemConfig.getMAC(options.interface)
        self.myip = SystemConfig.getIP(options.interface)
        self.protocolInstances = []

        #Makes scapy more verbose
        debug = False

        if options.arp:

            if not options.gateway:
                shutdown("[-] --arp argument requires --gateway")

            if options.targets is None:
                #if were poisoning whole subnet, start ARP-Watch
                arpwatch = ARPWatch(options.gateway, self.myip,
                                    options.interface)
                arpwatch.debug = debug

                self.tree_info.append("ARPWatch online")
                self.protocolInstances.append(arpwatch)

            arp = ARPpoisoner(options.gateway, options.interface, self.mymac,
                              options.targets)
            arp.arpmode = self.arpmode
            arp.debug = debug

            self.protocolInstances.append(arp)

        elif options.icmp:

            if not options.gateway:
                shutdown("[-] --icmp argument requires --gateway")

            if not options.targets:
                shutdown("[-] --icmp argument requires --targets")

            icmp = ICMPpoisoner(options.interface, options.targets,
                                options.gateway, self.myip)
            icmp.debug = debug

            self.protocolInstances.append(icmp)

        elif options.dhcp:

            if options.targets:
                shutdown("[-] --targets argument invalid when DCHP spoofing")

            dhcp = DHCPServer(options.interface, self.dhcpcfg, self.myip,
                              self.mymac)
            dhcp.shellshock = options.shellshock
            dhcp.debug = debug
            self.protocolInstances.append(dhcp)

        if options.dns:

            if not options.manualiptables:
                if IpTables.getInstance().dns is False:
                    IpTables.getInstance().DNS(self.dnscfg['port'])

        if not options.arp and not options.icmp and not options.dhcp and not options.dns:
            shutdown(
                "[-] Spoof plugin requires --arp, --icmp, --dhcp or --dns")

        SystemConfig.setIpForwarding(1)

        if not options.manualiptables:
            if IpTables.getInstance().http is False:
                IpTables.getInstance().HTTP(options.listen)

        for protocol in self.protocolInstances:
            protocol.start()
Exemple #4
0
args = parser.parse_args()

# Definitely a better way to do this, will need to clean this up in the future
# Checks to see if we called a plugin's options without first invoking the actual plugin
for plugin, options in arg_dict.iteritems():
    if vars(args)[plugin] is False:
        for option in options:
            if vars(args)[option.dest]:
                sys.exit(
                    "[-] Called plugin options without invoking the actual plugin (--{})"
                    .format(plugin))

#check to see if we supplied a valid interface
myip = SystemConfig.getIP(args.interface)
mymac = SystemConfig.getMAC(args.interface)

#Start logging
log_level = logging.__dict__[args.log_level.upper()]

logging.basicConfig(level=log_level,
                    format="%(asctime)s %(message)s",
                    datefmt="%Y-%m-%d %H:%M:%S")
logFormatter = logging.Formatter("%(asctime)s %(message)s",
                                 datefmt="%Y-%m-%d %H:%M:%S")
mitmf_logger = logging.getLogger('mitmf')
fileHandler = logging.FileHandler("./logs/mitmf.log")
fileHandler.setFormatter(logFormatter)
mitmf_logger.addHandler(fileHandler)

#####################################################################################################