MCPcopy Index your code
hub / github.com/secdev/scapy / json

Method json

scapy/packet.py:1796–1809  ·  view source on GitHub ↗

Returns a JSON representing the packet. Please note that this cannot be used for bijective usage: data loss WILL occur, so it will not make sense to try to rebuild the packet from the output. This must only be used for a grepping/displaying purpose.

(self)

Source from the content-addressed store, hash-verified

1794 return c
1795
1796 def json(self):
1797 # type: () -> str
1798 """
1799 Returns a JSON representing the packet.
1800
1801 Please note that this cannot be used for bijective usage: data loss WILL occur,
1802 so it will not make sense to try to rebuild the packet from the output.
1803 This must only be used for a grepping/displaying purpose.
1804 """
1805 dump = json.dumps({k: v for (k, v) in self._command(json=True)})
1806 pc = self.payload.json()
1807 if pc:
1808 dump = dump[:-1] + ", \"payload\": %s}" % pc
1809 return dump
1810
1811
1812class NoPayload(Packet):

Callers

nothing calls this directly

Calls 1

_commandMethod · 0.95

Tested by

no test coverage detected