Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented unified output features #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions AdamBridge/ndispktscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import volatility.utils as utils
import volatility.win32.tasks as tasks

from volatility.renderers import TreeGrid
from volatility.renderers.basic import Address, Hex


# Add some structures
_packet_types = {
Expand Down Expand Up @@ -632,3 +635,35 @@ def render_text(self, outfd, data):
dsts_file.write(dst + '\n')
outfd.write('Written {:,} destination IPs to \'{}\'.\n'.format(
len(dsts), self._config.DSTS))

def unified_output(self, data):
if self._config.SLACK:
return TreeGrid([("Offset (V)", Address),
("Slack Data", str),],
self.generator(data))
else:
return TreeGrid([("Offset (V)", Address),
("Source MAC", str),
("Destination MAC", str),
("Prot", str),
("Source IP", str),
("Destination IP", str),
("SPort", str),
("DPort", str),
("Flags", str)],
self.generator(data))

def generator(self, data):
if self._config.SLACK:
for offset, slack in data:
better_slack = self.tidy_slack(slack)
if len(better_slack) > 1:
yield(0, [Address(offset), str(better_slack)])
else:
dsts = set()
for raw, eth, epl, pl in data:
dst_ip = epl.make_ip(epl.dst_ip)
dsts.add(dst_ip)
src_mac = eth.make_mac(eth.mac_src)

yield (0, [Address(eth.v()), str(src_mac), str(eth.make_mac(eth.mac_dst)), str('{:#04x}'.format(epl.get_proto())), str(epl.make_ip(epl.src_ip)), str(dst_ip), str(pl.src_port if pl else 'Proto'), str(pl.dst_port if pl else 'NotKn'), str(pl.get_flags() if pl else 'own')])