Esempio n. 1
0
    def wipeMediumClicked(self):

        #Get the currently selected picture
        selected_item = self.fileTreeWidget.currentItem().text(0)

        #Construct the file path based on selected item
        path = self.directory + "/" + selected_item

        #Creat and display warning box
        msgBox = QMessageBox()
        msgBox.setWindowTitle("Confirmation Window")
        msgBox.setText("Are you sure you want to wipe medium?")

        msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
        msgBox.setDefaultButton(QMessageBox.No)

        ret = msgBox.exec_()

        #If Yes was clicked
        if(ret == 16384):

            #Wipe the medium and adjust the file tree accordingly
            steg = NewSteganography(imagePath=path)
            child = self.fileTreeWidget.currentItem()
            child.takeChild(0)
            child.setForeground(0,QtGui.QBrush(Qt.blue))
            self.hidden_message_dict[child.text(0)] = None
            steg.wipeMedium()
            self.treeItemClicked()
Esempio n. 2
0
    def confirmWipe(self):
        msgBox = QMessageBox()
        msgBox.setText('Confirm Wipe')
        msgBox.setInformativeText('Are you sure you want to wipe the current medium?')
        msgBox.setStandardButtons(QMessageBox.No | QMessageBox.Yes)
        msgBox.setDefaultButton(QMessageBox.No)
        ret = msgBox.exec_()

        # If the user selects yes
        if(ret == QMessageBox.Yes):
            n = NewSteganography(imagePath = self.imagePath, direction = self.imageDirection)

            # Call the wipe medium function, repopulate the origin fileTreeWidget
            n.wipeMedium()
            self.fileTreeWidget.clear()
            self.examineImages()

            # Clear the two graphics views in the stackedWidget
            self.txtMessage.clear()
            tempScene = QGraphicsScene()
            self.viewMessage.setScene(tempScene)

            self.btnWipeMedium.setDisabled(True)
            self.btnExtract.setDisabled(True)
            self.viewMessage.setHidden(True)
            self.txtMessage.setHidden(True)
            self.lblTextMessage.setText('Text')
            self.lblImageMessage.setText('Text')
            self.lblTextMessage.setDisabled(True)
            self.lblImageMessage.setDisabled(True)
Esempio n. 3
0
    def wipeMed(self):  #the function that will wipe the medium
        #now, we will pop up a QMessageBox dialog asking the user to confirm their action.
        msgBox = QMessageBox()
        msgBox.setText(
            'Wiping the medium will remove all the contents from the medium.')
        msgBox.setInformativeText('Are you sure you want to proceed?')
        msgBox.setStandardButtons(
            QMessageBox.Yes
            | QMessageBox.No)  #yes or no option provided to the user
        ret = msgBox.exec_()  #to see what the user enters
        #print(type(ret))

        if (ret == 65536):  #i.e, the user selects the No option
            #just go back and return from the function
            return

        else:  #i.e, the user selects the Yes option

            #clear the message display unit for both image and text, whichever is applicable
            scene = QtGui.QGraphicsScene()
            scene.clear()
            self.viewMessage.setScene(scene)
            self.txtMessage.clear()

            self.btnWipeMedium.setEnabled(
                False)  #disable the wipe medium button

            #create a new NewSteg obj with any direction of rasterization, it does not matter since wiping the medium will essentially work for all the pixels. Thus for our purposes, we will use 'horizontal' as direction of rasterization. 'vertical' would also work just fine.
            self.grpMessage.setDisabled(
                True)  #diaable the stacked widget to display message

            curr = self.fileTreeWidget.currentItem()
            filename = curr.text(0)
            curr.takeChild(0)
            curr.setForeground(0, QtGui.QBrush(Qt.blue))
            for i in range(0, len(self.imgType)):
                if (filename == self.imgType[i][0]):
                    #print(self.imgType[i])
                    self.imgType[i] = (filename, (False, None))
                    #print(self.imgType[i])
                    break

            path = self.directorySelected + '/' + self.fileTreeWidget.currentItem(
            ).text(0)  #get the current image file
            stegobj = NewSteganography(
                path, 'horizontal'
            )  #create a NewSteg obj with horizontal rasterization
            stegobj.wipeMedium()  #call the function to wipe the medium
            '''
Esempio n. 4
0
    def wipe(self):
        rest = QtGui.QMessageBox.question(self, 'title', 'message',
                                          QtGui.QMessageBox.Yes,
                                          QtGui.QMessageBox.No)
        if rest == QtGui.QMessageBox.Yes:
            self.mode(False)
            item = self.fileTreeWidget.currentItem()
            subitem = item.child(0)
            dir = subitem.text(1)
            stegan = NewSteganography(self.imagepath, direction=dir)
            stegan.wipeMedium()
            item.removeChild(subitem)

            item.setForeground(0, QBrush(QColor(0, 0, 255)))
            foont = QtGui.QFont()
            foont.setBold(False)
            item.setFont(0, foont)
Esempio n. 5
0
    def wipeMed(self):#the function that will wipe the medium
        #now, we will pop up a QMessageBox dialog asking the user to confirm their action. 
        msgBox = QMessageBox()
        msgBox.setText('Wiping the medium will remove all the contents from the medium.')
        msgBox.setInformativeText('Are you sure you want to proceed?')
        msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No) #yes or no option provided to the user
        ret = msgBox.exec_() #to see what the user enters
        #print(type(ret))

        if (ret == 65536): #i.e, the user selects the No option
            #just go back and return from the function
            return

        else: #i.e, the user selects the Yes option

            #clear the message display unit for both image and text, whichever is applicable
            scene = QtGui.QGraphicsScene()
            scene.clear()
            self.viewMessage.setScene(scene)
            self.txtMessage.clear()


            self.btnWipeMedium.setEnabled(False) #disable the wipe medium button

            #create a new NewSteg obj with any direction of rasterization, it does not matter since wiping the medium will essentially work for all the pixels. Thus for our purposes, we will use 'horizontal' as direction of rasterization. 'vertical' would also work just fine.
            self.grpMessage.setDisabled(True) #diaable the stacked widget to display message

            curr = self.fileTreeWidget.currentItem() #get the current tree widget, ie the current filename
            filename = curr.text(0) #get the text filename
            curr.takeChild(0) #remove the child
            curr.setForeground(0, QtGui.QBrush(Qt.blue)) #make color of filename in tree widget to appear to blue
            for i in range(0, len(self.imgType)): #now change the imgType list for the particulae filename, ie message type is none
                if (filename == self.imgType[i][0]):
                    #print(self.imgType[i])
                    self.imgType[i] = (filename, (False, None))
                    #print(self.imgType[i])
                    break #break out of loop to save time
            

            path = self.directorySelected + '/' + self.fileTreeWidget.currentItem().text(0) #get the current image file
            stegobj = NewSteganography(path, 'horizontal') #create a NewSteg obj with horizontal rasterization
            stegobj.wipeMedium() #call the function to wipe the medium
            '''
Esempio n. 6
0
	def wipe(self):
		box = QMessageBox()																	### Creates a cautionary message box
		reply = box.question(None,"Caution","Wiped message cannot be recovered.Do you want to proceed?",QMessageBox.Ok | QMessageBox.Cancel)
		if reply == QMessageBox.Ok:															### If okay is pressed execute the below code
			if self.selectedfile in self.v:													
				class1 = NewSteganography(self.path+"/"+self.selectedfile,"vertical")
				class1.wipeMedium()															### if the item has vertically embedded
				self.v.remove(self.selectedfile)											### message then wipe the message
				self.btnExtract.setEnabled(False)											### and remove the item and its child from
				self.btnWipeMedium.setEnabled(False)										### tree widget
				item = QTreeWidgetItem([self.selectedfile])
				olditem = self.fileTreeWidget.selectedItems()[0]
				child = olditem.takeChildren()
				self.dict[self.selectedfile] = "0"
				self.fileTreeWidget.takeTopLevelItem(self.fileTreeWidget.indexOfTopLevelItem(olditem))
				item.setText(0,"{0}".format(olditem.text(0)))
				item.setForeground(0,QtGui.QBrush(Qt.blue))
				self.blueitems.append(item)
				self.fileTreeWidget.addTopLevelItem(item)
				self.fileTreeWidget.removeItemWidget(item,0)
			else:
				class1 = NewSteganography(self.path+"/"+self.selectedfile,"horizontal")
				class1.wipeMedium()															### if the item has horizontally embedded
				self.h.remove(self.selectedfile)											### message then wipe the message and
				self.btnExtract.setEnabled(False)											### remove the item and its child from the
				self.btnWipeMedium.setEnabled(False)										### tree widget
				item = QTreeWidgetItem([self.selectedfile])
				olditem = self.fileTreeWidget.selectedItems()[0]
				child = olditem.takeChildren()
				self.dict[self.selectedfile] = "0"
				self.fileTreeWidget.takeTopLevelItem(self.fileTreeWidget.indexOfTopLevelItem(olditem))
				item.setText(0,"{0}".format(olditem.text(0)))
				item.setForeground(0,QtGui.QBrush(Qt.blue))
				self.blueitems.append(item)
				self.fileTreeWidget.addTopLevelItem(item)
				self.fileTreeWidget.removeItemWidget(item,0)
			self.extract()
 def wipe(self):
     """
     cleans the message from the medium and refreshes the item based on the new properties of the medium
     :return:
     """
     msgbox = QMessageBox()
     msgbox.setText("Are you sure you want to wipe the medium?")
     msgbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
     option = msgbox.exec_()
     if option == QMessageBox.No:
         pass
     elif option == QMessageBox.Yes:
         self.viewMessage.setHidden(True)
         self.txtMessage.setHidden(True)
         current = self.fileTreeWidget.currentItem()
         path = self.fpdict[current]
         direction = self.childdict[current][1]
         medium = NewSteganography(path, direction)
         medium.wipeMedium()
         scene = QGraphicsScene()
         self.viewMessage.setScene(scene)
         current.takeChild(0)
         self.fileTreeWidget.removeItemWidget(current, 0)
         self.additem(path, current)