MCPcopy Create free account
hub / github.com/longld/peda / format_reference_chain

Function format_reference_chain

lib/utils.py:457–481  ·  view source on GitHub ↗

Colorize a chain of references

(chain)

Source from the content-addressed store, hash-verified

455
456@memoized
457def format_reference_chain(chain):
458 """
459 Colorize a chain of references
460 """
461 v = t = vn = None
462 text = ""
463 if not chain:
464 text += "Cannot access memory address"
465 else:
466 first = True
467 for (v, t, vn) in chain:
468 if t != "value":
469 text += "%s%s " % ("--> " if not first else "", format_address(v, t))
470 else:
471 text += "%s%s " % ("--> " if not first else "", v)
472 first = False
473
474 if vn:
475 text += "(%s)" % vn
476 else:
477 if v != "0x0":
478 s = hex2str(v)
479 if is_printable(s, "\x00"):
480 text += "(%s)" % string_repr(s.split(b"\x00")[0])
481 return text
482
483# vulnerable C functions, source: rats/flawfinder
484VULN_FUNCTIONS = [

Callers 8

format_search_resultMethod · 0.85
xprintMethod · 0.85
dumpargsMethod · 0.85
tracecallMethod · 0.85
traceinstMethod · 0.85
telescopeMethod · 0.85
get_reg_textMethod · 0.85
xinfoMethod · 0.85

Calls 4

format_addressFunction · 0.85
hex2strFunction · 0.85
is_printableFunction · 0.85
string_reprFunction · 0.85

Tested by

no test coverage detected