MCPcopy Create free account
hub / github.com/secdev/scapy / _format_attribute

Method _format_attribute

scapy/modules/ldaphero.py:1880–1898  ·  view source on GitHub ↗

Format a LDAP attribute

(self, name, value, crop=False)

Source from the content-addressed store, hash-verified

1878 return self.new("addchild")
1879
1880 def _format_attribute(self, name, value, crop=False):
1881 """
1882 Format a LDAP attribute
1883 """
1884 if isinstance(value, list):
1885 # It's a list.
1886 return ";".join(self._format_attribute(name, v, crop=crop) for v in value)
1887 elif name == "objectSid":
1888 return WINNT_SID(value).summary()
1889 elif isinstance(value, bytes):
1890 # Catch-all for bytes values
1891 value = value.hex()
1892 else:
1893 # Catch-all
1894 value = str(value)
1895 # If cropping is enabled and requested, crop
1896 if crop and self.crop_output.get() and len(value) >= 80:
1897 return value[:80] + "... (%so)" % len(value)
1898 return value
1899
1900 def _parse_attribute(self, name, value):
1901 """

Callers 3

_showsearchresultMethod · 0.95
editentrylistMethod · 0.95
_edit_popupMethod · 0.95

Calls 4

WINNT_SIDClass · 0.90
joinMethod · 0.80
summaryMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected