Example #1
0
 def validate(self):
             
     #def walk_nested_dict(d):
         #for key1, value1 in d.items():
             #if isinstance(value1, dict):
                 #for key2, value2 in walk_nested_dict(value1):
                     #yield [key1, key2], value2
             #else:
                 #yield [key1,], value1
     
     for key1, value1 in self.entrydict.items():
         if not isinstance(value1, dict): # shouldn't happen
             if key1.find('Password') == -1:
                 self.settings[key1] = value1.getvalue()
             else:
                 self.settings[key1] = myutils.password_obfuscate(value1.getvalue())
         else:
             for key2, value2 in value1.items():
                 if not isinstance(value2, dict):
                     if key2.find('Password') == -1:
                         self.settings[key1][key2] = value2.getvalue()
                     else:
                         self.settings[key1][key2] = myutils.password_obfuscate(value2.getvalue())
                 else:
                     for key3, value3 in value2.items():
                         if not isinstance(value3, dict):
                             if key3.find('Password') == -1:
                                 self.settings[key1][key2][key3] = value3.getvalue()
                             else:
                                 self.settings[key1][key2][key3] = myutils.password_obfuscate(value3.getvalue())
                         else:
                             pass # shouldn't happen
             
     errortext=["Some of your input contains errors. "
                 "Detailed error output below.",]
     
     val = Validator()
     val.functions['log_filename_check'] = myutils.validate_log_filename
     val.functions['image_filename_check'] = myutils.validate_image_filename
     valresult=self.settings.validate(val, preserve_errors=True)
     if valresult != True:
         for section_list, key, error in flatten_errors(self.settings, 
                                                             valresult):
             if key is not None:
                 section_list.append(key)
             else:
                 section_list.append('[missing section]')
             section_string = ','.join(section_list)
             if error == False:
                 error = 'Missing value or section.'
             errortext.append('%s: %s' % (section_string, error))
         tkMessageBox.showerror("Erroneous input. Please try again.", 
                     '\n\n'.join(errortext), parent=self.dialog.interior())
         self.settings = self.read_settings()
         return False
     else:
         return True
Example #2
0
 def validate(self):
             
     #def walk_nested_dict(d):
         #for key1, value1 in d.items():
             #if isinstance(value1, dict):
                 #for key2, value2 in walk_nested_dict(value1):
                     #yield [key1, key2], value2
             #else:
                 #yield [key1,], value1
     
     for key1, value1 in self.entrydict.items():
         if not isinstance(value1, dict): # shouldn't happen
             if key1.find('Password') == -1:
                 self.settings[key1] = value1.getvalue()
             else:
                 self.settings[key1] = myutils.password_obfuscate(value1.getvalue())
         else:
             for key2, value2 in value1.items():
                 if not isinstance(value2, dict):
                     if key2.find('Password') == -1:
                         self.settings[key1][key2] = value2.getvalue()
                     else:
                         self.settings[key1][key2] = myutils.password_obfuscate(value2.getvalue())
                 else:
                     for key3, value3 in value2.items():
                         if not isinstance(value3, dict):
                             if key3.find('Password') == -1:
                                 self.settings[key1][key2][key3] = value3.getvalue()
                             else:
                                 self.settings[key1][key2][key3] = myutils.password_obfuscate(value3.getvalue())
                         else:
                             pass # shouldn't happen
             
     errortext=["Some of your input contains errors. "
                 "Detailed error output below.",]
     
     val = Validator()
     val.functions['log_filename_check'] = myutils.validate_log_filename
     val.functions['image_filename_check'] = myutils.validate_image_filename
     valresult=self.settings.validate(val, preserve_errors=True)
     if valresult != True:
         for section_list, key, error in flatten_errors(self.settings, 
                                                             valresult):
             if key is not None:
                 section_list.append(key)
             else:
                 section_list.append('[missing section]')
             section_string = ','.join(section_list)
             if error == False:
                 error = 'Missing value or section.'
             errortext.append('%s: %s' % (section_string, error))
         tkMessageBox.showerror("Erroneous input. Please try again.", 
                     '\n\n'.join(errortext), parent=self.dialog.interior())
         self.settings = self.read_settings()
         return False
     else:
         return True
Example #3
0
    def NagscreenLogic(self):
        '''Show the nagscreen (or not).'''

        # Congratulations, you have found the nag control.
        # See, that wasn't so hard, was it? :)
        # While I have deliberately made it easy to stop all this nagging and
        # expiration stuff here, and you are quite entitled to doing just that,
        # I would like to take this final moment and encourage you once more to
        # support the PyKeylogger project by making a donation.

        # Set this to False to get rid of all nagging.
        NagMe = False

        if NagMe == True:
            # first, show the support screen
            root = tkinter.Tk()
            #root.geometry("100x100+200+200")
            root.withdraw()
            warn = SupportScreen(root, title="Please Support PyKeylogger")
            root.destroy()
            del (warn)

            # set the timer if first use
            utfnd = self.settings['General']['_Usage Time Flag']
            if myutils.password_recover(utfnd) == "firstuse":
                self.settings['General']['_Usage Time Flag'] = \
                   myutils.password_obfuscate(str(time.time()))
                self.settings.write()

            # then, see if we have "expired"
            utfnd = self.settings['General']['_Usage Time Flag']
            if abs(time.time() - float(myutils.password_recover(utfnd))) > \
               3600 * 24 * 4:
                root = tkinter.Tk()
                #root.geometry("100x100+200+200")
                root.withdraw()
                warn = ExpirationScreen(root, title="PyKeylogger Has Expired")
                root.destroy()
                del (warn)
                sys.exit()
Example #4
0
	def validate(self):
		
		for key in self.entrydict.keys():
			if key.find("Password") == -1:
				self.settings[self.section][key] = self.entrydict[key].get()
			else:
				self.settings[self.section][key] = myutils.password_obfuscate(self.entrydict[key].get())
		
		errortext="Some of your input contains errors. Detailed error output below.\n\n"
		
		val = Validator()
		valresult=self.settings.validate(val, preserve_errors=True)
		if valresult != True:
			if valresult.has_key(self.section):
				sectionval = valresult[self.section]
				for key in sectionval.keys():
					if sectionval[key] != True:
						errortext += "Error in item \"" + str(key) + "\": " + str(sectionval[key]) + "\n"
				tkMessageBox.showerror("Erroneous input. Please try again.", errortext)
			return 0
		else:
			return 1