Example #1
0
def name_form(addr):
    out = ''
    out += '<form class="name-form" method="get" action="/set-name">'
    out += '<input type="hidden" name="addr" value="{0}" />'.format(addr)
    out += '<input type="text" name="name" value="{0}" />'.format(tag.nameForAddress(addr))
    out += '<input type="submit" value="ok" />'
    out += '</form>'
    return out
Example #2
0
    def html(self):
        out = '<h1>Procedure {0}</h1>\n'.format(tag.nameForAddress(self.start_addr));
        out += '<pre class="disasm">';
        import disasm
        for addr in sorted(self.visited):
            if addr in self.labels:
                out += html.label(addr)
            out += disasm.decodeCache(addr)[0].html(0)
        out += '</pre>\n'

        return out
Example #3
0
 def html(self):
     out = ''
     out += 'Proc graph ' + tag.nameForAddress(self.start_addr)
     out += '<pre class="disasm">'
     for i, b in enumerate(self.blocks):
         out += 'BLOCK' + str(i) + '\n'
         out += b.html()
     out += 'edges:\n'
     for x in self.vertices():
         out += str(x) + ' -> ' + ', '.join(str(y) for y in self.childs(x)) + '\n'
     out += '</pre>\n'
     return out
Example #4
0
def save_dot(procs):
    with open('data/graph.dot', 'w') as f:
        f.write("digraph crossref {\n")
        for addr in procs:
            tags = ''

            import database
            info = database.procInfo(addr)

            if info.has_switch:
                tags += ' switch'
            if info.suspicious_switch:
                tags += ' suspicious_switch'
            if info.has_nop:
                tags += ' nop'
            if info.has_ambig_calls:
                tags += ' ambig_calls'
            if info.has_suspicious_instr:
                tags += ' suspicious'

            f.write('    ' + addr_symbol(addr) + ' [label="' + tag.nameForAddress(addr) + tags + '"];\n')
            if tags:
                f.write('    ' + addr_symbol(addr) + ' [color="green"];\n')



            """"q = len(procedure.at(addr).instructions)

            if q < 32:
                intensity = 0
            elif q < 128:
                intensity = 64
            elif q < 512:
                intensity = 128
            elif q < 2048:
                intensity = 192
            else:
                intensity = 255
            """
            intensity = 0

            f.write('    ' + addr_symbol(addr) + ' [fillcolor="#FF{0:02x}{0:02x}"];\n'.format(255-intensity))
            f.write('    ' + addr_symbol(addr) + ' [style="filled"];\n')

            for c in info.calls:
                f.write('    ' + addr_symbol(addr) + ' -> ' + addr_symbol(c) + ';\n')

        f.write("}\n")
Example #5
0
 def html(self):
     out = "<h1>Procedure flow {0}</h1>\n".format(tag.nameForAddress(self.addr))
     out += '<pre class="disasm">\n'
     out += self.content.html()
     out += "</pre>\n"
     return out