Exemplo n.º 1
0
 def render(self):
     clear()
     print(gray("( To exit, hit Ctrl + C )\n\n"))
     count = "(" + str(len(
         self.used_incorrect_letters)) + "/" + str(CHANCES) + ")"
     if (CHANCES - len(self.used_incorrect_letters) < 3):
         count = red(count)
     else:
         count = gray(count)
     render_noose(len(self.used_incorrect_letters))
     print("Used " + count + ": " + " ".join(self.used_incorrect_letters))
     print(self.make_word_bar())
     print(self.make_message_box())
Exemplo n.º 2
0
    def draw(self):
        if self.draw_cancel:
            self.draw_cancel = False
        else:
            coordinates = [self.origin,
                           self.origin + (self.xlength,0,0),
                           self.origin + (self.xlength,0,self.zlength),
                           self.origin + (0,0,self.zlength)
                           ]

            color.gray()
            glBegin(GL_QUADS)
            glNormal3f(0,1,0)
            for x in coordinates:
                glVertex3fv(x)
            glEnd()
Exemplo n.º 3
0
    def __build_find_cmd(self):
        # create a find command expression
        audio_ext = ['mp3', 'ogg', 'wma']
        video_ext = [
            'mpg', 'mpeg', 'avi', 'mov', 'm4v', 'mp4', 'wmv', 'flv', 'mkv'
        ]
        audio = "\( %s \)" % " -o ".join(
            ["-iname '*.%s'" % ext for ext in audio_ext])
        video = "\( %s \)" % " -o ".join(
            ["-iname '*.%s'" % ext for ext in video_ext])
        if self.first_find:
            log.info("audio extensions: %s" % color.bold(str(audio_ext)))
            log.info("video extensions: %s" % color.bold(str(video_ext)))
        video = "\( %s -and -size +5M -not -iwholename '*sample*' \)" % video

        findstring = "-type f -and \( %s -or %s \)" % (video, audio)

        find_cmd = "/usr/bin/find -L '%(where)s' %(find)s" % {
            'where': "' '".join(self.dirs),
            'find': findstring
        }
        if self.first_find:
            log.debug(color.gray(find_cmd))
            self.first_find = False
        return find_cmd
Exemplo n.º 4
0
def TWindbg(args):
    """TWindbg: List all the command in TWindbg """
    if len(args) != 0:
        raise CmdExecError("Invalid argument number")
    banner = color.yellow("TWindbg: PEDA-like debugger UI for WinDbg\n")
    banner += color.gray("For latest update, check the project page: ")
    banner += color.white("https://github.com/bruce30262/TWindbg\n")
    banner += color.orange("Use \"[cmd] help\" for further command usage\n")
    pykd.dprintln(banner, dml=True)
    print_all_usage()
Exemplo n.º 5
0
 def enhance_type(self, ptr, val):
     ret_str = ""
     if is_executable(ptr):  # code page
         symbol = pykd.findSymbol(ptr) + ":"
         asm_str = disasm(ptr)[1]
         ret_str = "{:#x}".format(ptr)
         ret_str += color.gray(" ({:45s}{})".format(symbol, asm_str))
     else:
         ret_str = "{:#x} --> {:#x}".format(ptr, val)
         val_str = get_string(ptr)
         if val_str:  # val is probably a string
             ret_str += color.white(" (\"{}\")".format(val_str))
     return ret_str
Exemplo n.º 6
0
def binarize(pixels, threshold=15):
    """ Binarizes the image using the given threshold """
    width = len(pixels[0])
    height = len(pixels)

    output = numpy.zeros((height, width))

    for x in range(0, width):
        for y in range(0, height):
            current_pixel = pixels[y][x]
            current_pixel_gray = gray(current_pixel)

            if current_pixel_gray >= threshold:
                output[y][x] = 0
            else:
                output[y][x] = 255

    return output