Esempio n. 1
0
def stan():

        cl = int(input("> "))
        payload_dir = "/home/kenroku/Pictures/Stenography/3.png"
        out_dir = "/home/kenroku/Pictures/Stenography/out.png"
        enigma = "hiTELOMERES"
        terminator = "TELOMERES"


        if cl == 0:
            text.encode(payload_dir, out_dir, enigma, terminator)
        elif cl == 1:
            text.decode(out_dir, terminator)
Esempio n. 2
0
    def log(self, level, message, *args):
        if isinstance(level, basestring):
            try:
                level = LEVELS.index(level)
            except NoTrap:
                raise
            except:
                level = len(LEVELS)
        if level >= self.level:

            # make sure this is unicode
            message = decode(message, self.encoding)

            # apply any format args.. try not to lose them if there is a problem
            if args:
                try:
                    message = message % tuple(decode(arg, self.encoding)
                                              if isinstance(arg, str) else arg
                                              for arg in args)
                except NoTrap:
                    raise
                except:
                    try:
                        message = u'message=%r, args=%r' % (message, args)
                    except NoTrap:
                        raise
                    except:
                        message = u"couldn't format message!!"

            try:
                level_name = LEVELS[level]
            except IndexError:
                level_name = 'UNKNOWN'

            self.level_count[level_name] += 1

            # make multi-line timestamped so stuff lines up regularly
            timestamp = datetime.now().strftime(self.time_format)
            for line in message.splitlines():
                line = line.rstrip()
                if line:
                    line = self.format % {'message': line, 'time': timestamp, 'level': level_name}
                    for handler in self.handlers:
                        if level >= handler.level:
                            with lock:
                                handler.write(line + '\n')
                    if self.store_errors and level_name == 'ERROR':
                        self.stored_errors.append(line)
                    if self.store_warnings and level_name == 'WARN':
                        self.stored_warnings.append(line)
Esempio n. 3
0
def convert(data, headers=None):
    """Return unicode object of data"""
    if not isinstance(data, unicode):
        try:
            encoding = detect(data, headers)
        except (SystemExit, KeyboardInterrupt):
            raise
        except:
            encoding = None
        data = decode(data, encoding)
    return data
Esempio n. 4
0
def convert(data, headers=None):
    """Return unicode object of data"""
    if not isinstance(data, unicode):
        try:
            encoding = detect(data, headers)
        except (SystemExit, KeyboardInterrupt):
            raise
        except:
            encoding = None
        data = decode(data, encoding)
    return data
Esempio n. 5
0
 def get_passwd(self):
     if os.path.exists(self.path):
         with open(self.path, 'rb') as file:
             data = file.read()
     else:
         data = ''
     passwd = {}
     for line in data.splitlines():
         line = line.strip()
         if not line:
             continue
         username, password, flags = decode(line).split(':', 2)
         passwd[username] = {'password': password, 'flags': flags}
     return passwd
Esempio n. 6
0
 def encrypt(self, plain):
     digest, salt = self.get_digest(encode(plain))
     return decode(b64encode(salt + digest))
Esempio n. 7
0
def superscript(text):
    if isinstance(text, str):
        text = decode(text, 'utf-8')
    return text.translate(SUPER_MAP)
Esempio n. 8
0
def superscript(text):
    if isinstance(text, str):
        text = decode(text, 'utf-8')
    return text.translate(SUPER_MAP)