Ejemplo n.º 1
0
def getLocalIp(ip):
    """Find local ip using SymbolInfo."""

    if SymbolInfo.isopen():
        sym = SymbolInfo.lookup(ip)  # Type: SymbolInfo

        if sym is not None:
            if sym.img.dynamic:
                return ip - sym.img.lower
    return ip
Ejemplo n.º 2
0
 def doprint(self, text, ip, leak):
     self.outstream.write(" " * self.depth)
     if len(text) > 0:
         self.outstream.write(text + " ")
     if SymbolInfo.isopen():
         sym = SymbolInfo.lookup(ip)
         if sym is not None:
             self.outstream.write(sym.strat(ip))
         else:
             self.outstream.write(hex(ip))
     else:
         self.outstream.write(hex(ip))
     self.outstream.write("\n")
     if leak is not None:
         leak.doprint(self)
Ejemplo n.º 3
0
def getCtxName(ip):
    """Find context name of ip.

    Returns:
        A string containing the context name, or the hex presentation
        of the ip of no SymbolInfo is available.
    """
    if SymbolInfo.isopen():
        sym = SymbolInfo.lookup(ip)  # Type: SymbolInfo

        if sym is not None:
            name = ""
            if sym.img is not None and sym.img.dynamic:
                name += "(+%x)" % (ip - sym.img.lower)

            name += " %s(%s)" % (sym.getname(), sym.type)
            return name
        else:
            return hex(ip)
    else:
        return hex(ip)