def start_server(self):
        if len(str(self.txt_redirect.text())) == 0:
            return QtGui.QMessageBox.warning(self, 'localhost',
                                             'Ip Address not found.')
        if self.check_server.isChecked():
            if len(popen('which php').read().split('\n')[0]) == 0:
                return QtGui.QMessageBox.warning(
                    self, 'Requirement Software',
                    'php-5 is not installed \n\ntry: install sudo apt-get install php5'
                )
        if self.check_clone.isChecked():
            if len(self.cloneLineEdit.text()) == 0:
                return QtGui.QMessageBox.warning(self, 'Clone',
                                                 'input clone empty')
            site = str(self.cloneLineEdit.text())
            if not str(self.cloneLineEdit.text()).startswith('http://'):
                site = 'http://' + str(self.cloneLineEdit.text())
            if self.checkRequests(site):
                self.ServerHTTPLoad = ServerThreadHTTP(
                    str(self.txt_redirect.text()),
                    self.BoxPort.value(),
                    redirect=str(self.cloneLineEdit.text()),
                    directory=C.TEMPLATE_CLONE,
                    session=self.session)
                self.ThreadTemplates['Server'].append(self.ServerHTTPLoad)
                self.ServerHTTPLoad.requestHTTP.connect(self.ResponseSignal)
                self.btn_start_template.setEnabled(False)
                self.btn_stop_template.setEnabled(True)
                self.ServerHTTPLoad.setObjectName('THread::: HTTP Clone')
                self.ServerHTTPLoad.start()
                self.ServerHTTPLoad.sleep(5)
                a = urlopen('http://{}:{}'.format(
                    str(self.txt_redirect.text()), self.BoxPort.value()))
                if a.getcode() == 200:
                    self.StatusServer(True)
                    self.emit(QtCore.SIGNAL('Activated( QString )'), 'started')

        elif self.check_server.isChecked():
            self.DirectoryPhishing(Path=str(self.EditDirectory.text()))
            self.emit(QtCore.SIGNAL('Activated( QString )'), 'started')

        elif self.check_custom.isChecked():
            self.html = BeautifulSoup(str(self.txt_html.toPlainText()), 'lxml')
            self.CheckHookInjection(self.html, C.TEMPLATE_PH)
            self.proc_Web_server = ProcessThread(
                {
                    'python': [
                        '-m', 'SimpleHTTPServer', '{}'.format(
                            self.BoxPort.value())
                    ]
                }, C.TEMP_CUSTOM)
            self.proc_Web_server._ProcssOutput.connect(
                self.get_output_webserver)
            self.proc_Web_server.start()
            self.ThreadTemplates['Server'].append(self.proc_Web_server)
            self.emit(QtCore.SIGNAL('Activated( QString )'), 'started')
            self.btn_start_template.setEnabled(False)
            self.btn_stop_template.setEnabled(True)
            self.StatusServer(True)
Beispiel #2
0
 def ProcessReadLogger(self):
     '''function for read log injection proxy '''
     if path.exists(C.LOG_SSLSTRIP):
         with open(C.LOG_SSLSTRIP, 'w') as bufferlog:
             bufferlog.write(''), bufferlog.close()
         self.injectionThread = ThreadPopen(['tail', '-f', C.LOG_SSLSTRIP])
         self.connect(self.injectionThread,
                      QtCore.SIGNAL('Activated ( QString ) '),
                      self.GetloggerInjection)
         self.injectionThread.setObjectName('Pump-Proxy::Capture')
         return self.injectionThread.start()
     QtGui.QMessageBox.warning(self, 'error proxy logger',
                               'Pump-Proxy::capture is not found')
Beispiel #3
0
    def __init__(self, parent, **kwargs):
        super(ProxySSLstrip, self).__init__(parent)
        self.main_method = parent
        self.urlinjected = []
        self.FSettings = SuperSettings.getInstance()
        self.mainLayout = QtGui.QVBoxLayout()
        self.dockwidget = ProxySSLstripDock(None, title=self.Name)
        self.dockwidget.setWindowTitle(self.Name)
        self.search[
            self.Name] = str('iptables -t nat -A PREROUTING -p tcp' +
                             ' --destination-port 80 -j REDIRECT --to-port ' +
                             self.FSettings.redirectport.text())

        #scroll area
        self.scrollwidget = QtGui.QWidget()
        self.scrollwidget.setLayout(self.mainLayout)
        self.scroll = QtGui.QScrollArea()
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(self.scrollwidget)

        # create widgets
        self.argsLabel = QtGui.QLabel('')
        self.hBox = QtGui.QHBoxLayout()
        self.hBoxargs = QtGui.QHBoxLayout()
        self.btnLoader = QtGui.QPushButton('Reload')
        self.btnEnable = QtGui.QPushButton('Enable')
        self.btncancel = QtGui.QPushButton('Cancel')
        self.btnbrownser = QtGui.QPushButton('Browser')

        # size buttons
        self.btnLoader.setFixedWidth(100)
        self.btnEnable.setFixedWidth(100)
        self.btncancel.setFixedWidth(100)
        self.btnbrownser.setFixedWidth(100)

        self.comboxBox = QtGui.QComboBox()
        self.log_inject = QtGui.QListWidget()
        self.docScripts = QtGui.QTextEdit()
        self.argsScripts = QtGui.QLineEdit()
        self.btncancel.setIcon(QtGui.QIcon('icons/cancel.png'))
        self.btnLoader.setIcon(QtGui.QIcon('icons/search.png'))
        self.btnEnable.setIcon(QtGui.QIcon('icons/accept.png'))
        self.btnbrownser.setIcon(QtGui.QIcon("icons/open.png"))
        self.argsScripts.setEnabled(False)
        self.btnbrownser.setEnabled(False)

        # group settings
        self.GroupSettings = QtGui.QGroupBox()
        self.GroupSettings.setTitle('settings:')
        self.SettingsLayout = QtGui.QFormLayout()
        self.hBox.addWidget(self.comboxBox)
        self.hBox.addWidget(self.btnLoader)
        self.hBox.addWidget(self.btnEnable)
        self.hBox.addWidget(self.btncancel)
        self.hBoxargs.addWidget(self.argsLabel)
        self.hBoxargs.addWidget(self.argsScripts)
        self.hBoxargs.addWidget(self.btnbrownser)
        self.SettingsLayout.addRow(self.hBox)
        self.SettingsLayout.addRow(self.hBoxargs)
        self.GroupSettings.setLayout(self.SettingsLayout)
        #self.GroupSettings.setFixedWidth(450)
        #group logger
        self.GroupLogger = QtGui.QGroupBox()
        self.GroupLogger.setTitle('Logger Injection:')
        self.LoggerLayout = QtGui.QVBoxLayout()
        self.LoggerLayout.addWidget(self.log_inject)
        self.GroupLogger.setLayout(self.LoggerLayout)
        #self.GroupLogger.setFixedWidth(450)

        #group descriptions
        self.GroupDoc = QtGui.QGroupBox()
        self.GroupDoc.setTitle('Description:')
        self.DocLayout = QtGui.QFormLayout()
        self.DocLayout.addRow(self.docScripts)
        self.GroupDoc.setLayout(self.DocLayout)
        self.GroupDoc.setFixedHeight(100)

        #connections
        self.SearchProxyPlugins()
        self.readDocScripts('html_injector')
        self.btnLoader.clicked.connect(self.SearchProxyPlugins)
        self.connect(self.comboxBox,
                     QtCore.SIGNAL('currentIndexChanged(QString)'),
                     self.readDocScripts)
        self.btnEnable.clicked.connect(self.setPluginsActivated)
        self.btncancel.clicked.connect(self.unsetPluginsConf)
        self.btnbrownser.clicked.connect(self.get_filenameToInjection)
        # add widgets
        self.mainLayout.addWidget(self.GroupSettings)
        self.mainLayout.addWidget(self.GroupDoc)
        self.mainLayout.addWidget(self.GroupLogger)
        self.layout = QtGui.QHBoxLayout()
        self.layout.addWidget(self.scroll)
        self.setLayout(self.layout)
Beispiel #4
0
    def __init__(self, popup, main_method, FsettingsUI=None, parent=None):
        super(ProxySSLstrip, self).__init__(parent)
        self.main_method = main_method
        self.popup = popup
        self.urlinjected = []
        self.FSettings = FsettingsUI
        self.mainLayout = QtGui.QVBoxLayout()

        #scroll area
        self.scrollwidget = QtGui.QWidget()
        self.scrollwidget.setLayout(self.mainLayout)
        self.scroll = QtGui.QScrollArea()
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(self.scrollwidget)

        # create widgets
        self.argsLabel = QtGui.QLabel('')
        self.hBox = QtGui.QHBoxLayout()
        self.hBoxargs = QtGui.QHBoxLayout()
        self.btnLoader = QtGui.QPushButton('Reload')
        self.btnEnable = QtGui.QPushButton('Enable')
        self.btncancel = QtGui.QPushButton('Cancel')
        self.btnbrownser = QtGui.QPushButton('Browser')

        # size buttons
        self.btnLoader.setFixedWidth(100)
        self.btnEnable.setFixedWidth(100)
        self.btncancel.setFixedWidth(100)
        self.btnbrownser.setFixedWidth(100)

        self.comboxBox = QtGui.QComboBox()
        self.log_inject = QtGui.QListWidget()
        self.docScripts = QtGui.QTextEdit()
        self.argsScripts = QtGui.QLineEdit()
        self.btncancel.setIcon(QtGui.QIcon('icons/cancel.png'))
        self.btnLoader.setIcon(QtGui.QIcon('icons/search.png'))
        self.btnEnable.setIcon(QtGui.QIcon('icons/accept.png'))
        self.btnbrownser.setIcon(QtGui.QIcon("icons/open.png"))
        self.argsScripts.setEnabled(False)
        self.btnbrownser.setEnabled(False)

        # group settings
        self.GroupSettings = QtGui.QGroupBox()
        self.GroupSettings.setTitle('settings:')
        self.SettingsLayout = QtGui.QFormLayout()
        self.hBox.addWidget(self.comboxBox)
        self.hBox.addWidget(self.btnLoader)
        self.hBox.addWidget(self.btnEnable)
        self.hBox.addWidget(self.btncancel)
        self.hBoxargs.addWidget(self.argsLabel)
        self.hBoxargs.addWidget(self.argsScripts)
        self.hBoxargs.addWidget(self.btnbrownser)
        self.SettingsLayout.addRow(self.hBox)
        self.SettingsLayout.addRow(self.hBoxargs)
        self.GroupSettings.setLayout(self.SettingsLayout)
        #self.GroupSettings.setFixedWidth(450)
        #group logger
        self.GroupLogger = QtGui.QGroupBox()
        self.GroupLogger.setTitle('Logger Injection:')
        self.LoggerLayout = QtGui.QVBoxLayout()
        self.LoggerLayout.addWidget(self.log_inject)
        self.GroupLogger.setLayout(self.LoggerLayout)
        #self.GroupLogger.setFixedWidth(450)

        #group descriptions
        self.GroupDoc = QtGui.QGroupBox()
        self.GroupDoc.setTitle('Description:')
        self.DocLayout = QtGui.QFormLayout()
        self.DocLayout.addRow(self.docScripts)
        self.GroupDoc.setLayout(self.DocLayout)
        self.GroupDoc.setFixedHeight(100)

        #connections
        self.SearchProxyPlugins()
        self.readDocScripts('html_injector')
        self.btnLoader.clicked.connect(self.SearchProxyPlugins)
        self.connect(self.comboxBox,
                     QtCore.SIGNAL('currentIndexChanged(QString)'),
                     self.readDocScripts)
        self.btnEnable.clicked.connect(self.setPluginsActivated)
        self.btncancel.clicked.connect(self.unsetPluginsConf)
        self.btnbrownser.clicked.connect(self.get_filenameToInjection)
        # add widgets
        self.mainLayout.addWidget(self.GroupSettings)
        self.mainLayout.addWidget(self.GroupDoc)
        self.mainLayout.addWidget(self.GroupLogger)
        self.layout = QtGui.QHBoxLayout()
        self.layout.addWidget(self.scroll)
        self.addLayout(self.layout)
Beispiel #5
0
    def __init__(self, parent, **kwargs):
        super(CaptivePortal, self).__init__(parent)
        self.mainLayout = QtGui.QVBoxLayout()
        self.config = SettingsINI(C.CAPTIVEPORTAL_INI)
        self.plugins = []
        self.plugin_activated = None
        self.main_method = parent
        self.bt_SettingsDict = {}
        self.check_PluginDict = {}
        self.ClientsLogged = {}
        self.btn_previewSettings = {}
        self.search_all_ProxyPlugins()
        #scroll area
        self.scrollwidget = QtGui.QWidget()
        self.scrollwidget.setLayout(self.mainLayout)
        self.scroll = QtGui.QScrollArea()
        self.scroll.setWidgetResizable(True)
        self.scroll.setWidget(self.scrollwidget)
        self.dockwidget = CaptivePortalDock(None, title=self.Name)

        # create for add dock logging
        self.tabcontrol = QtGui.QTabWidget()
        self.tab1 = QtGui.QWidget()
        self.tab2 = QtGui.QWidget()
        self.page_1 = QtGui.QVBoxLayout(self.tab1)
        self.page_2 = QtGui.QVBoxLayout(self.tab2)

        self.tabcontrol.addTab(self.tab1, 'Plugins')
        self.tabcontrol.addTab(self.tab2, 'Manager')
        self.TabCtrlClients = QtGui.QTableWidget()
        self.TabCtrlClients.setColumnCount(3)
        #self.TabCtrlClients.setRowCount(len(self.plugins))
        self.TabCtrlClients.resizeRowsToContents()
        self.TabCtrlClients.setSizePolicy(QtGui.QSizePolicy.Preferred,
                                          QtGui.QSizePolicy.Preferred)
        self.TabCtrlClients.horizontalHeader().setStretchLastSection(True)
        self.TabCtrlClients.setSelectionBehavior(
            QtGui.QAbstractItemView.SelectRows)
        self.TabCtrlClients.setEditTriggers(
            QtGui.QAbstractItemView.NoEditTriggers)
        self.TabCtrlClients.verticalHeader().setVisible(False)
        self.TabCtrlClients.verticalHeader().setDefaultSectionSize(27)
        self.TabCtrlClients.setSortingEnabled(True)
        self.THeadersCtrlClients = OrderedDict([('IpAddress', []),
                                                ('MacAddress', []),
                                                ('Status Internet', [])])
        self.TabCtrlClients.setHorizontalHeaderLabels(
            self.THeadersCtrlClients.keys())

        self.mainLayout_settings = QtGui.QVBoxLayout()
        #scroll area
        self.scrollwidget_settings = QtGui.QWidget()
        self.scrollwidget_settings.setLayout(self.mainLayout_settings)
        self.scroll_settings = QtGui.QScrollArea()
        self.scroll_settings.setWidgetResizable(True)
        self.scroll_settings.setWidget(self.scrollwidget_settings)

        # create widgets
        self.argsLabel = QtGui.QLabel('')
        self.hBox = QtGui.QHBoxLayout()
        self.btnEnable = QtGui.QPushButton('Allow')
        self.btncancel = QtGui.QPushButton('Deny')

        # size buttons
        self.btnEnable.setFixedWidth(100)
        self.btncancel.setFixedWidth(100)

        self.comboxBoxIPAddress = QtGui.QComboBox()
        self.btncancel.setIcon(QtGui.QIcon('icons/cancel.png'))
        self.btnEnable.setIcon(QtGui.QIcon('icons/accept.png'))

        # group settings
        self.GroupSettings = QtGui.QGroupBox()
        self.GroupSettings.setTitle('Manage clients access:')
        self.SettingsLayout = QtGui.QFormLayout()
        self.hBox.addWidget(self.comboxBoxIPAddress)
        self.hBox.addWidget(self.btnEnable)
        self.hBox.addWidget(self.btncancel)
        self.SettingsLayout.addRow(self.hBox)
        self.GroupSettings.setLayout(self.SettingsLayout)
        #self.GroupSettings.setFixedWidth(450)

        #group logger
        self.GroupLogger = QtGui.QGroupBox()
        self.logger_portal = QtGui.QListWidget()
        self.GroupLogger.setTitle('Logger events:')
        self.LoggerLayout = QtGui.QVBoxLayout()
        self.LoggerLayout.addWidget(self.logger_portal)
        self.GroupLogger.setLayout(self.LoggerLayout)
        #self.GroupLogger.setFixedWidth(450)

        #connections
        # self.btnLoader.clicked.connect(self.SearchProxyPlugins)
        self.connect(self.comboxBoxIPAddress,
                     QtCore.SIGNAL('currentIndexChanged(QString)'),
                     self.checkStatusClient)
        self.btnEnable.clicked.connect(self.enableInternetConnection)
        self.btncancel.clicked.connect(self.disableInternetConnection)
        # self.btnbrownser.clicked.connect(self.get_filenameToInjection)
        # add widgets
        self.mainLayout_settings.addWidget(self.GroupSettings)
        self.mainLayout_settings.addWidget(self.GroupLogger)

        self.TabPlugins = QtGui.QTableWidget()
        self.TabPlugins.setColumnCount(5)
        self.TabPlugins.setRowCount(len(self.plugins))
        self.TabPlugins.resizeRowsToContents()
        self.TabPlugins.setSizePolicy(QtGui.QSizePolicy.Preferred,
                                      QtGui.QSizePolicy.Preferred)
        self.TabPlugins.horizontalHeader().setStretchLastSection(True)
        self.TabPlugins.setSelectionBehavior(
            QtGui.QAbstractItemView.SelectRows)
        self.TabPlugins.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.TabPlugins.verticalHeader().setVisible(False)
        self.TabPlugins.verticalHeader().setDefaultSectionSize(27)
        self.TabPlugins.setSortingEnabled(True)
        self.THeaders = OrderedDict([('Captive Name', []), ('Preview', []),
                                     ('Author', []), ('Settings', []),
                                     ('Description', [])])
        self.TabPlugins.setHorizontalHeaderLabels(self.THeaders.keys())
        self.TabPlugins.horizontalHeader().resizeSection(0, 158)
        self.TabPlugins.horizontalHeader().resizeSection(1, 80)

        # add on tab
        self.page_1.addWidget(self.TabPlugins)
        self.page_2.addWidget(self.scroll_settings)

        # get all plugins and add into TabWidget
        Headers = []
        for plugin in self.plugins:
            if plugin.ConfigParser:
                self.bt_SettingsDict[plugin.Name] = QtGui.QPushButton(
                    'Settings')
                self.bt_SettingsDict[plugin.Name].clicked.connect(
                    partial(self.setSettingsPlgins, plugin.Name))
            else:
                self.bt_SettingsDict[plugin.Name] = QtGui.QPushButton('None')

            if (path.isfile(plugin.Preview)):
                self.btn_previewSettings[plugin.Name] = QtGui.QPushButton(
                    'Preview')
                self.btn_previewSettings[plugin.Name].setObjectName(
                    plugin.Preview)
                self.btn_previewSettings[plugin.Name].clicked.connect(
                    partial(self.showPreviewCaptivePortal, plugin.Name))
            else:
                self.btn_previewSettings[plugin.Name] = QtGui.QPushButton(
                    'Not found')

            self.check_PluginDict[plugin.Name] = QtGui.QRadioButton(
                plugin.Name)
            self.check_PluginDict[plugin.Name].setObjectName(plugin.Name)
            self.check_PluginDict[plugin.Name].clicked.connect(
                partial(self.setPluginOption, plugin.Name))
            self.THeaders['Captive Name'].append(
                self.check_PluginDict[plugin.Name])
            self.THeaders['Preview'].append(
                self.btn_previewSettings[plugin.Name])
            self.THeaders['Author'].append(plugin.Author)
            self.THeaders['Settings'].append({'name': plugin.Name})
            self.THeaders['Description'].append(plugin.Description)
        for n, key in enumerate(self.THeaders.keys()):
            Headers.append(key)
            for m, item in enumerate(self.THeaders[key]):
                if type(item) == type(QtGui.QRadioButton()):
                    self.TabPlugins.setCellWidget(m, n, item)
                elif type(item) == type(dict()):
                    self.TabPlugins.setCellWidget(
                        m, n, self.bt_SettingsDict[item['name']])
                elif type(item) == type(QtGui.QPushButton()):
                    self.TabPlugins.setCellWidget(m, n, item)
                else:
                    item = QtGui.QTableWidgetItem(item)
                    self.TabPlugins.setItem(m, n, item)
        self.TabPlugins.setHorizontalHeaderLabels(self.THeaders.keys())

        # check status all checkbox plugins
        for box in self.check_PluginDict.keys():
            self.check_PluginDict[box].setChecked(
                self.config.get_setting('plugins', box, format=bool))

        self.btn_updateCaptive = QtGui.QPushButton("Update")
        self.btn_updateCaptive.setIcon(QtGui.QIcon('icons/updates_.png'))
        self.btn_updateCaptive.setFixedWidth(130)
        self.btn_updateCaptive.clicked.connect(self.disableBtnForUpdates)

        self.mainLayout.addWidget(self.tabcontrol)
        self.mainLayout.addWidget(self.btn_updateCaptive)
        self.layout = QtGui.QHBoxLayout()
        self.layout.addWidget(self.scroll)
        self.setLayout(self.layout)