Example #1
0
    def on_view_button_clicked(self, x, folder_path=None):
        if isinstance(folder_path, QTextEdit):
            folder_path = folder_path.toPlainText()
        elif isinstance(folder_path, QtWidgets.QLineEdit):
            folder_path = folder_path.text()
        if folder_path == "":
            QMessageBox.warning(self, "No path selected",
                                "There is no path selected", QMessageBox.Ok)
            return None

        self.file_explore_thread = FileExplorerRunner(
            folder_location=folder_path)
        self.file_explore_thread.start()
Example #2
0
 def on_view_button_clicked(self, x, folder_path=None):
     if isinstance(folder_path, QTextEdit):
         folder_path = folder_path.toPlainText()
     self.file_explore_thread = FileExplorerRunner(
         folder_location=folder_path)
     self.file_explore_thread.start()
Example #3
0
class RulesWidget(QtWidgets.QWidget):
    def __init__(self, projectfolder, projectName, projectPCAPName,
                 sessionLabel, rulesDir, comment_mgr, val):
        QtWidgets.QWidget.__init__(self, parent=None)

        self.rulesDir = rulesDir
        self.comment_mgr = comment_mgr
        self.val = val

        self.outerVertBox = QtWidgets.QVBoxLayout()
        self.outerVertBox.setObjectName("outerVertBoxAnnot")

        self.setWindowTitle("RulesWidget")
        self.setObjectName("RulesWidget")

        #Label - Rules Title
        self.labelVerBoxSess = QtWidgets.QVBoxLayout()
        self.labelVerBoxSess.setObjectName("labeVerBoxPro")
        self.rulesLabel = QtWidgets.QLabel("RULES")
        labelFont = QtGui.QFont()
        labelFont.setBold(True)
        self.rulesLabel.setFont(labelFont)
        self.rulesLabel.setAlignment(Qt.AlignCenter)
        self.labelVerBoxSess.addWidget(self.rulesLabel)

        #get project pcap path

        projectpath = os.path.join(projectfolder, projectName)
        projectPCAPFolder = os.path.join(
            projectpath, ConfigurationManager.STRUCTURE_PCAP_SUBDIR)
        projectpcap = os.path.join(projectPCAPFolder, projectPCAPName)

        sessionPCAPFolder = os.path.join(projectPCAPFolder, sessionLabel)
        self.sessionPCAP = os.path.join(sessionPCAPFolder,
                                        "SessionGenerated.pcapng")

        #create a directory for session rules
        self.sessionRulesDir = os.path.join(rulesDir, sessionLabel)

        #if corresponding session dir doesnt exist, create dir
        if os.path.exists(self.sessionRulesDir) == False:
            os.mkdir(self.sessionRulesDir)

        #Project PCAP
        self.pcapHorBox = QtWidgets.QHBoxLayout()
        self.pcapHorBox.setObjectName("pcapHorBox")
        self.pcapLabel = QtWidgets.QLabel()
        self.pcapLabel.setObjectName("pcapLabel")
        self.pcapLabel.setText("Project PCAP:  ")
        self.pcapHorBox.addWidget(self.pcapLabel)

        self.pcapLineEdit = QtWidgets.QLineEdit()
        self.pcapLineEdit.setAcceptDrops(False)
        self.pcapLineEdit.setReadOnly(True)
        self.pcapLineEdit.setObjectName("pcapLineEdit")
        self.pcapLineEdit.setText(projectpcap)
        self.pcapLineEdit.setAlignment(Qt.AlignLeft)
        self.pcapHorBox.addWidget(self.pcapLineEdit)

        self.pcapPathViewButton = QPushButton("View")
        self.pcapPathViewButton.clicked.connect(
            lambda x: self.on_view_button_clicked(x, projectPCAPFolder))
        self.pcapHorBox.addWidget(self.pcapPathViewButton)

        #Annotated PCAP
        self.pcapHorBox2 = QtWidgets.QHBoxLayout()
        self.pcapHorBox2.setObjectName("pcapHorBox2")
        self.pcapLabel2 = QtWidgets.QLabel()
        self.pcapLabel2.setObjectName("pcapLabel2")
        self.pcapLabel2.setText("Annotated PCAP:  ")
        self.pcapHorBox2.addWidget(self.pcapLabel2)

        self.pcapLineEdit2 = QtWidgets.QLineEdit()
        self.pcapLineEdit2.setAcceptDrops(False)
        self.pcapLineEdit2.setReadOnly(True)
        self.pcapLineEdit2.setObjectName("pcapLineEdit2")
        self.pcapLineEdit2.setText(self.sessionPCAP)
        self.pcapLineEdit2.setAlignment(Qt.AlignLeft)
        self.pcapHorBox2.addWidget(self.pcapLineEdit2)

        self.pcapPathViewButton2 = QPushButton("View")
        self.pcapPathViewButton2.clicked.connect(
            lambda x: self.on_view_button_clicked(x, sessionPCAPFolder))
        self.pcapHorBox2.addWidget(self.pcapPathViewButton2)

        #Generate Rules Button
        self.ruleButtonHorBox = QtWidgets.QHBoxLayout()
        self.ruleButtonHorBox.setObjectName("ruleButtonHorBox")
        self.rulesButton = QPushButton("Generate Rules")
        self.rulesButton.clicked.connect(self.on_rules_button_clicked)
        self.ruleButtonHorBox.setAlignment(Qt.AlignRight)
        self.ruleButtonHorBox.addWidget(self.rulesButton)

        #Path to where the rules are going to be outputted
        self.ruleHorBox = QtWidgets.QHBoxLayout()
        self.ruleHorBox.setObjectName("ruleHorBox")
        self.rulePathLabel = QtWidgets.QLabel()
        self.rulePathLabel.setObjectName("rulePathLabel")
        self.rulePathLabel.setText("Rule Output Path: ")
        self.ruleHorBox.addWidget(self.rulePathLabel)

        self.ruleLineEdit = QtWidgets.QLineEdit()
        self.ruleLineEdit.setAcceptDrops(False)
        self.ruleLineEdit.setReadOnly(True)
        self.ruleLineEdit.setObjectName("ruleLineEdit")
        self.ruleLineEdit.setText(self.sessionRulesDir)
        self.ruleLineEdit.setAlignment(Qt.AlignLeft)
        self.ruleHorBox.addWidget(self.ruleLineEdit)

        self.rulePathViewButton = QPushButton("View")
        self.rulePathViewButton.clicked.connect(
            lambda x: self.on_view_button_clicked(x, self.sessionRulesDir))
        self.ruleHorBox.addWidget(self.rulePathViewButton)

        #put everything together
        self.outerVertBox.addLayout(self.labelVerBoxSess)
        self.outerVertBox.addLayout(self.pcapHorBox)
        self.outerVertBox.addLayout(self.pcapHorBox2)
        self.outerVertBox.addLayout(self.ruleHorBox)
        self.outerVertBox.addLayout(self.ruleButtonHorBox)

        self.outerVertBox.addStretch()

        self.setLayout(self.outerVertBox)

    def on_view_button_clicked(self, x, folder_path=None):
        if isinstance(folder_path, QTextEdit):
            folder_path = folder_path.toPlainText()
        self.file_explore_thread = FileExplorerRunner(
            folder_location=folder_path)
        self.file_explore_thread.start()

    def on_rules_button_clicked(self):
        logging.debug('on_genrules_out_start_button_clicked(): Instantiated')

        self.batch_thread = BatchThread()
        self.batch_thread.progress_signal.connect(self.update_progress_bar)
        self.batch_thread.completion_signal.connect(
            self.genrules_button_batch_completed)

        self.batch_thread.add_function(self.comment_mgr.extract_json,
                                       self.sessionPCAP)
        comment_filename = os.path.join(
            self.sessionRulesDir, ConfigurationManager.STRUCTURE_JSON_COMMENTS)
        self.batch_thread.add_function(
            self.comment_mgr.write_comment_json_to_file, comment_filename)

        self.batch_thread.add_function(self.val.extract_rules,
                                       comment_filename)
        rules_filename = os.path.join(
            self.sessionRulesDir,
            ConfigurationManager.STRUCTURE_RULES_GEN_FILE)
        self.batch_thread.add_function(self.val.write_rules_to_file,
                                       rules_filename)

        self.progress_dialog_overall = ProgressBarDialog(
            self, self.batch_thread.get_load_count())
        self.batch_thread.start()
        self.progress_dialog_overall.show()

        logging.debug('on_genrules_out_start_button_clicked(): Complete')

    def genrules_button_batch_completed(self):
        logging.debug('thread_finish(): Instantiated')

        self.progress_dialog_overall.update_progress()
        self.progress_dialog_overall.hide()

        logging.debug('thread_finish(): Completed')

    def update_progress_bar(self):
        logging.debug('update_progress_bar(): Instantiated')
        self.progress_dialog_overall.update_progress()
        logging.debug('update_progress_bar(): Complete')
Example #4
0
class ProjectWidget(QtWidgets.QWidget):
    def __init__(self, projectname, projectpcap, projectpath):
        QtWidgets.QWidget.__init__(self, parent=None)
        #self.statusBar = statusBar
        self.projectItemNames = {}
        self.outerVertBox = QtWidgets.QVBoxLayout()
        self.outerVertBox.setObjectName("outerVertBox")

        self.setWindowTitle("ProjectWidget")
        self.setObjectName("ProjectWidget")

        #LABEL
        self.labelVerBox = QtWidgets.QVBoxLayout()
        self.labelVerBox.setObjectName("labelVerBox")
        self.projectLabel = QtWidgets.QLabel("PROJECT INFO")
        labelFont = QtGui.QFont()
        labelFont.setBold(True)
        self.projectLabel.setFont(labelFont)
        self.projectLabel.setAlignment(Qt.AlignCenter)
        self.labelVerBox.addWidget(self.projectLabel)

        #material widget - res
        #Project Name
        self.nameHorBox = QtWidgets.QHBoxLayout()
        self.nameHorBox.setObjectName("nameHorBox")
        self.nameLabel = QtWidgets.QLabel()
        self.nameLabel.setObjectName("nameLabel")
        self.nameLabel.setText("Project Name:")
        self.nameHorBox.addWidget(self.nameLabel)

        self.nameLineEdit = QtWidgets.QLineEdit()
        self.nameLineEdit.setObjectName("nameLineEdit")
        self.nameLineEdit.setText(projectname)
        self.nameHorBox.addWidget(self.nameLineEdit)

        #Project Path
        self.pathHorBox = QtWidgets.QHBoxLayout()
        self.pathHorBox.setObjectName("pathHorBox")
        self.pathLabel = QtWidgets.QLabel()
        self.pathLabel.setObjectName("pathLabel")
        self.pathLabel.setText("Project Path:  ")
        self.pathHorBox.addWidget(self.pathLabel)

        self.pathLineEdit = QtWidgets.QLineEdit()
        self.pathLineEdit.setAcceptDrops(False)
        self.pathLineEdit.setReadOnly(True)
        self.pathLineEdit.setObjectName("pathLineEdit")
        self.pathLineEdit.setText(projectpath)
        self.pathHorBox.addWidget(self.pathLineEdit)

        self.projectPathViewButton = QPushButton("View")
        self.projectPathViewButton.clicked.connect(
            lambda x: self.on_view_button_clicked(x, projectpath))
        self.pathHorBox.addWidget(self.projectPathViewButton)

        #Project PCAP
        self.pcapHorBox = QtWidgets.QHBoxLayout()
        self.pcapHorBox.setObjectName("pcapHorBox")
        self.pcapLabel = QtWidgets.QLabel()
        self.pcapLabel.setObjectName("pcapLabel")
        self.pcapLabel.setText("Project PCAP:  ")
        self.pcapHorBox.addWidget(self.pcapLabel)

        self.pcapLineEdit = QtWidgets.QLineEdit()
        self.pcapLineEdit.setAcceptDrops(False)
        self.pcapLineEdit.setReadOnly(True)
        self.pcapLineEdit.setObjectName("pcapLineEdit")
        self.pcapLineEdit.setText(projectpcap)
        self.pcapLineEdit.setAlignment(Qt.AlignLeft)
        self.pcapHorBox.addWidget(self.pcapLineEdit)

        self.pcapPathViewButton = QPushButton("View")
        pcap_folder = os.path.dirname(projectpcap)
        self.pcapPathViewButton.clicked.connect(
            lambda x: self.on_view_button_clicked(x, pcap_folder))
        self.pcapHorBox.addWidget(self.pcapPathViewButton)

        #put all the components together
        self.outerVertBox.addLayout(self.labelVerBox)
        self.outerVertBox.addLayout(self.nameHorBox)
        self.outerVertBox.addLayout(self.pathHorBox)
        self.outerVertBox.addLayout(self.pcapHorBox)

        self.outerVertBox.addStretch()

        self.setLayout(self.outerVertBox)

    def on_view_button_clicked(self, x, folder_path=None):
        if isinstance(folder_path, QTextEdit):
            folder_path = folder_path.toPlainText()
        self.file_explore_thread = FileExplorerRunner(
            folder_location=folder_path)
        self.file_explore_thread.start()

    def addProjectItem(self, configname):
        logging.debug("addProjectItem(): retranslateUi(): instantiated")
        if configname in self.projectItemNames:
            logging.error("addprojectItem(): Item already exists in tree: " +
                          str(configname))
            return

        logging.debug("addprojectItem(): retranslateUi(): Completed")
Example #5
0
class ResultsWidget(QtWidgets.QWidget):

    def __init__(self, projectfolder, projectName, sessionLabel, resultsDir, val):
        QtWidgets.QWidget.__init__(self, parent=None)

        self.resultsDir = resultsDir
        self.val = val

        self.outerVertBox = QtWidgets.QVBoxLayout()
        self.outerVertBox.setObjectName("outerVertBoxAnnot")

        self.setWindowTitle("ResultsWidget")
        self.setObjectName("ResultsWidget")

        #Label - Results Title
        self.labelVerBoxSess = QtWidgets.QVBoxLayout()
        self.labelVerBoxSess.setObjectName("labeVerBoxPro")
        self.resultLabel = QtWidgets.QLabel("RESULTS")
        labelFont = QtGui.QFont()
        labelFont.setBold(True)
        self.resultLabel.setFont(labelFont)
        self.resultLabel.setAlignment(Qt.AlignCenter)
        self.labelVerBoxSess.addWidget(self.resultLabel)

        #get project-session rules path
        projectpath = os.path.join(projectfolder, projectName)
        projectPCAPFolder = os.path.join(projectpath, ConfigurationManager.STRUCTURE_PCAP_SUBDIR)
        sessionPCAPFolder = os.path.join(projectPCAPFolder, sessionLabel)
        self.sessionPCAP = os.path.join(sessionPCAPFolder, "SessionGenerated.pcapng")

        self.suspectPCAP = os.path.join(sessionPCAPFolder, "SuspectPCAP.pcapng")

        #Create dir for session alerts
        self.sessionAlertsDir = os.path.join(resultsDir, sessionLabel)

        try:
            if os.path.exists(self.sessionAlertsDir):
                shutil.rmtree(self.sessionAlertsDir, ignore_errors=True)
            os.makedirs(self.sessionAlertsDir)
        except Exception as e:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            logging.error("comment_to_json(): An error occured ")
            traceback.print_exception(exc_type, exc_value, exc_traceback)

        #get session rules
        self.sessionRulesDir = os.path.join(projectpath, ConfigurationManager.STRUCTURE_RULES_GEN_PATH)
        self.sessionRulesDir = os.path.join(self.sessionRulesDir, sessionLabel)
        self.rules_filename = os.path.join(self.sessionRulesDir, ConfigurationManager.STRUCTURE_RULES_GEN_FILE)

        #Path to where the rules stored
        self.ruleHorBox = QtWidgets.QHBoxLayout()
        self.ruleHorBox.setObjectName("ruleHorBox")
        self.rulePathLabel = QtWidgets.QLabel()
        self.rulePathLabel.setObjectName("rulePathLabel")
        self.rulePathLabel.setText("Rule Path: ")
        self.ruleHorBox.addWidget(self.rulePathLabel)

        self.ruleLineEdit = QtWidgets.QLineEdit()
        self.ruleLineEdit.setAcceptDrops(False)
        self.ruleLineEdit.setReadOnly(True)
        self.ruleLineEdit.setObjectName("ruleLineEdit")
        self.ruleLineEdit.setText(self.sessionRulesDir)
        self.ruleLineEdit.setAlignment(Qt.AlignLeft)
        self.ruleHorBox.addWidget(self.ruleLineEdit)

        self.rulePathViewButton = QPushButton("View")
        self.rulePathViewButton.clicked.connect(lambda x: self.on_view_button_clicked(x, self.sessionRulesDir))
        self.ruleHorBox.addWidget(self.rulePathViewButton)

        #Annotated/Suspect PCAP
        self.pcapHorBox2 = QtWidgets.QHBoxLayout()
        self.pcapHorBox2.setObjectName("pcapHorBox2")
        self.pcapLabel2 = QtWidgets.QLabel()
        self.pcapLabel2.setObjectName("pcapLabel2")
        self.pcapLabel2.setText("Apply Rules to PCAP:  ")
        self.pcapHorBox2.addWidget(self.pcapLabel2)

        self.pcapLineEdit2 = QtWidgets.QLineEdit()
        self.pcapLineEdit2.setFixedWidth(150)
        #self.pcapLineEdit2.setFixedHeight(25)
        if os.path.exists(self.suspectPCAP):
            self.pcapLineEdit2.setText(self.suspectPCAP)
        self.pcapLineEdit2.setAcceptDrops(False)
        self.pcapLineEdit2.setReadOnly(True)
        self.pcapLineEdit2.setObjectName("pcapLineEdit2") 
        self.pcapLineEdit2.setAlignment(Qt.AlignLeft)
        self.pcapHorBox2.addWidget(self.pcapLineEdit2)
        
        #view and ... button
        self.suspViewButton = QPushButton("View")
        self.suspPathButton = QPushButton("...")
        self.pcapHorBox2.addWidget(self.suspPathButton)
        self.pcapHorBox2.addWidget(self.suspViewButton)

        #on buttons clicked
        self.suspViewButton.clicked.connect(lambda x: self.on_view_button_clicked(x, self.pcapLineEdit2))
        self.suspPathButton.clicked.connect(self.on_path_button_clicked)

        #Show path to the alert folder
        self.alertHorBox = QtWidgets.QHBoxLayout()
        self.alertHorBox.setObjectName("alertHorBox")
        self.alertPathLabel = QtWidgets.QLabel()
        self.alertPathLabel.setObjectName("alertPathLabel")
        self.alertPathLabel.setText("Alert Output Path: ")
        self.alertHorBox.addWidget(self.alertPathLabel)

        self.alertLineEdit = QtWidgets.QLineEdit()
        self.alertLineEdit.setAcceptDrops(False)
        self.alertLineEdit.setReadOnly(True)
        self.alertLineEdit.setObjectName("alertLineEdit")
        self.alertLineEdit.setText(self.sessionAlertsDir)
        self.alertLineEdit.setAlignment(Qt.AlignLeft)
        self.alertHorBox.addWidget(self.alertLineEdit)

        self.alertPathViewButton = QPushButton("View")
        self.alertPathViewButton.clicked.connect(lambda x: self.on_view_button_clicked(x, self.sessionAlertsDir))
        self.alertHorBox.addWidget(self.alertPathViewButton)

        #Generate Alerts Button
        self.alertButtonHorBox = QtWidgets.QHBoxLayout()
        self.alertButtonHorBox.setObjectName("alertButtonHorBox")
        self.alertButton = QPushButton("Generate Alerts")
        self.alertButton.clicked.connect(self.on_alert_button_clicked)
        self.alertButtonHorBox.setAlignment(Qt.AlignRight)
        self.alertButtonHorBox.addWidget(self.alertButton)
        if self.pcapLineEdit2 == "":
            self.alertButton.setEnabled(False)

        self.outerVertBox.addLayout(self.labelVerBoxSess)
        self.outerVertBox.addLayout(self.ruleHorBox)
        self.outerVertBox.addLayout(self.pcapHorBox2)
        self.outerVertBox.addLayout(self.alertHorBox)
        self.outerVertBox.addLayout(self.alertButtonHorBox)

        self.outerVertBox.addStretch()

        self.setLayout(self.outerVertBox)

    def on_view_button_clicked(self, x, folder_path=None):
        if isinstance(folder_path, QTextEdit):
            folder_path = folder_path.toPlainText()
        elif isinstance(folder_path, QtWidgets.QLineEdit):
            folder_path = folder_path.text()
        if folder_path == "":
            QMessageBox.warning(self, 
                                "No path selected",
                                "There is no path selected",
                                QMessageBox.Ok)
            return None

        self.file_explore_thread = FileExplorerRunner(folder_location=folder_path)
        self.file_explore_thread.start()

    def on_alert_button_clicked(self):
        logging.debug('on_analyze_out_start_button_clicked(): Instantiated')
        
        self.batch_thread = BatchThread()
        self.batch_thread.progress_signal.connect(self.update_progress_bar)
        self.batch_thread.completion_signal.connect(self.analyze_button_batch_completed)
        alertOutPath = os.path.join(self.sessionAlertsDir)
        try:
            if os.path.exists(alertOutPath):
                shutil.rmtree(self.sessionAlertsDir, ignore_errors=True)
            os.makedirs(alertOutPath)
        except Exception as e:
                exc_type, exc_value, exc_traceback = sys.exc_info()
                logging.error("comment_to_json(): An error occured ")
                traceback.print_exception(exc_type, exc_value, exc_traceback)

        suricata_config_filename = ConfigurationManager.get_instance().read_config_abspath("VALIDATOR", "SURICATA_CONFIG_FILENAME")
        self.batch_thread.add_function( self.val.run_suricata_with_rules, None, suricata_config_filename, alertOutPath, self.rules_filename, self.pcapLineEdit2.text())
        logging.debug("SUSPECT PCAP: " + self.pcapLineEdit2.text())

        self.progress_dialog_overall = ProgressBarDialog(self, self.batch_thread.get_load_count())
        self.batch_thread.start()
        self.progress_dialog_overall.show()

        logging.debug('on_analyze_out_start_button_clicked(): Complete')

    def analyze_button_batch_completed(self):
        logging.debug('thread_finish(): Instantiated')

        self.progress_dialog_overall.update_progress()
        self.progress_dialog_overall.hide()
        alertOutFile = os.path.join(self.sessionAlertsDir, ConfigurationManager.STRUCTURE_ALERT_GEN_FILE)
        if os.path.exists(alertOutFile) == False or os.stat(alertOutFile).st_size < 10:
            QMessageBox.about(self, "IDS Alerts", "No alerts generated")
        else:
            res = QMessageBox.question(self,
                                            "Alerts written.\r\n",
                                            "Open File?",
                                            QMessageBox.Yes | QMessageBox.No)
            
            if res == QMessageBox.Yes:
                logging.debug("analyze_button_batch_completed(): Opening Alerts File")
                self.on_view_button_clicked(None, alertOutFile)
    
    def update_progress_bar(self):
        logging.debug('update_progress_bar(): Instantiated')
        self.progress_dialog_overall.update_progress()
        logging.debug('update_progress_bar(): Complete')

    def on_path_button_clicked(self):
        logging.debug('on_path_button_clicked(): Instantiated')
        choose_file = QFileDialog()
        filenames, _ = QFileDialog.getOpenFileNames(choose_file, "Select Suspect File")
        if len(filenames) < 0:
            logging.debug("File choose cancelled")
            return
        
        if len(filenames) > 0:
            suspect_pcap_chosen = filenames[0]
            session_pcaps = os.path.dirname(os.path.abspath(self.sessionPCAP))
            self.suspect_pcap_path = os.path.join(session_pcaps, "SuspectPCAP.pcapng")
            self.batch_thread = BatchThread()
            self.batch_thread.progress_signal.connect(self.update_progress_bar)
            self.batch_thread.completion_signal.connect(self.copy_suspect_complete)
            self.batch_thread.add_function(self.copy_file, suspect_pcap_chosen, self.suspect_pcap_path)
            #shutil.copy(suspect_pcap_chosen, suspect_pcap_path)

            self.progress_dialog_overall = ProgressBarDialog(self, self.batch_thread.get_load_count())
            self.batch_thread.start()
            self.progress_dialog_overall.show()

        logging.debug('on_path_button_clicked(): Complete')

    def copy_file(self, file, dst):
        shutil.copy(file, dst)

    def copy_suspect_complete(self):
        self.pcapLineEdit2.setText(self.suspect_pcap_path)
        self.progress_dialog_overall.update_progress()
        self.progress_dialog_overall.hide()
        self.alertButton.setEnabled(True)
Example #6
0
class ExportDialog(QtWidgets.QDialog):
    def __init__(self, parent, project_path, project_data_path):
        logging.debug("ExportDialog(): instantiated")
        super(ExportDialog, self).__init__(parent)
        self.parent = parent

        # quit = QAction("Quit", self)
        # quit.triggered.connect(self.closeEvent)
        # self.cancel_pressed = False

        self.project_path = project_path
        self.project_data_path = project_data_path

        #Title of window
        self.outerVertBoxPro = QtWidgets.QVBoxLayout()
        self.outerVertBoxPro.setObjectName("outerVertBox")
        self.setWindowTitle("Export Project")
        self.setObjectName("ExportProjectDialog")

        #Label - New Project Title
        self.labelVerBoxPro = QtWidgets.QVBoxLayout()
        self.labelVerBoxPro.setObjectName("labeVerBoxPro")
        self.newProjectLabel = QLabel("Exporting Project Settings")
        labelFont = QtGui.QFont()
        labelFont.setBold(True)
        self.newProjectLabel.setFont(labelFont)
        self.newProjectLabel.setAlignment(Qt.AlignCenter)
        self.labelVerBoxPro.addWidget(self.newProjectLabel)

        self.nameHorBox = QtWidgets.QHBoxLayout()
        self.nameHorBox.setObjectName("nameVerBoxPro")
        self.nameLabel = QtWidgets.QLabel()
        self.nameLabel.setObjectName("nameLabel")
        self.nameLabel.setText("Output Path:")
        self.nameHorBox.addWidget(self.nameLabel)

        self.exportOutputPath = QtWidgets.QLineEdit()
        self.exportOutputPath.setFixedWidth(200)
        self.exportOutputPath.setAcceptDrops(False)
        self.exportOutputPath.setReadOnly(True)
        self.exportOutputPath.setObjectName("exportOutputPath")
        self.nameHorBox.addWidget(self.exportOutputPath)

        self.exportPathButton = QPushButton("...")
        self.exportPathButton.clicked.connect(self.on_path_button_clicked)
        self.nameHorBox.addWidget(self.exportPathButton)

        self.exportPathViewButton = QPushButton("View")
        self.exportPathViewButton.clicked.connect(
            lambda x: self.on_view_button_clicked(x, self.exportOutputPath))
        self.nameHorBox.addWidget(self.exportPathViewButton)

        self.buttonsLayout = QtWidgets.QHBoxLayout()
        self.exportButton = QPushButton("Export")
        self.exportButton.setFixedWidth(60)
        self.exportButton.setEnabled(False)
        self.exportButton.clicked.connect(self.on_export_clicked)
        self.buttonsLayout.addWidget(self.exportButton)
        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setFixedWidth(60)
        self.cancelButton.clicked.connect(self.on_cancel_button_clicked)
        self.buttonsLayout.addWidget(self.cancelButton)
        self.buttonsLayout.setAlignment(QtCore.Qt.AlignBottom
                                        | QtCore.Qt.AlignRight)

        self.outerVertBoxPro.addLayout(self.labelVerBoxPro)
        self.outerVertBoxPro.addLayout(self.nameHorBox)
        #self.outerVertBoxPro.addLayout(self.spacer)
        self.outerVertBoxPro.addLayout(self.buttonsLayout)

        self.setFixedHeight(90)
        self.setFixedWidth(500)

        self.setLayout(self.outerVertBoxPro)

    def on_view_button_clicked(self, x, folder_path=None):
        if isinstance(folder_path, QTextEdit):
            folder_path = folder_path.toPlainText()
        elif isinstance(folder_path, QtWidgets.QLineEdit):
            folder_path = folder_path.text()
        if folder_path == "":
            QMessageBox.warning(self, "No path selected",
                                "There is no path selected", QMessageBox.Ok)
            return None

        self.file_explore_thread = FileExplorerRunner(
            folder_location=folder_path)
        self.file_explore_thread.start()

    def on_path_button_clicked(self):
        logging.debug('on_log_out_path_button_clicked(): Instantiated')
        folder_chosen = str(
            QFileDialog.getExistingDirectory(self,
                                             "Select Directory to Store Data"))
        if folder_chosen == "":
            logging.debug("File choose cancelled")
            return
        self.exportOutputPath.setText(folder_chosen)
        self.exportButton.setEnabled(True)

    def on_export_clicked(self):
        out_path = self.exportOutputPath.text()
        #initialize package manager without any values in args
        package_mgr = PackageManager()
        zip_function = package_mgr.zip

        self.batch_thread = BatchThread()
        self.batch_thread.progress_signal.connect(self.update_progress_bar)
        self.batch_thread.completion_signal.connect(self.export_complete)
        self.batch_thread.add_function(zip_function, out_path,
                                       self.project_path,
                                       self.project_data_path)
        self.progress_dialog_overall = ProgressBarDialog(
            self, self.batch_thread.get_load_count())
        self.batch_thread.start()
        self.progress_dialog_overall.show()

    def update_progress_bar(self):
        logging.debug('update_progress_bar(): Instantiated')
        self.progress_dialog_overall.update_progress()
        logging.debug('update_progress_bar(): Complete')

    def export_complete(self):
        logging.debug("export_complete(): Instantiated")
        self.progress_dialog_overall.update_progress()
        QMessageBox.information(self, "Export Complete!",
                                "Success! Project Exported", QMessageBox.Ok)
        self.progress_dialog_overall.hide()
        self.hide()
        logging.debug("export_complete(): Complete")

    def on_cancel_button_clicked(self, event):
        logging.debug('on_cancel_button_clicked(): Instantiated')
        self.hide()
        logging.debug('on_cancel_button_clicked(): Complete')

    def exec_(self):
        logging.debug("ExportDialog(): exec_() instantiated")
        result = super(ExportDialog, self).exec_()
        if str(result) == str(1):
            logging.debug("dialog_response(): OK was pressed")
            self.hide()
            return (QMessageBox.Ok)
        return (QMessageBox.Cancel)