Files
volatilityfoundation-volati…/volatility/plugins/linux/keyboard_notifier.py
T

63 lines
2.2 KiB
Python

# Volatility
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
@author: Joe Sylve
@license: GNU General Public License 2.0 or later
@contact: joe.sylve@gmail.com
@organization: 504ENSICS Labs
"""
import volatility.obj as obj
import volatility.debug as debug
import volatility.plugins.linux.common as linux_common
class linux_keyboard_notifier(linux_common.AbstractLinuxCommand):
"""Parses the keyboard notifier call chain"""
def calculate(self):
linux_common.set_plugin_members(self)
knl_addr = self.get_profile_symbol("keyboard_notifier_list")
if not knl_addr:
debug.error("Symbol keyboard_notifier_list not found in kernel")
knl = obj.Object("atomic_notifier_head", offset = knl_addr, vm = self.addr_space)
for callback in linux_common.walk_internal_list("notifier_block", "next", knl.head):
yield callback.notifier_call
def render_text(self, outfd, data):
symbol_cache = {}
self.table_header(outfd, [("Address", "[addrpad]"), ("Symbol", "<30")])
for call_addr in data:
if symbol_cache.has_key(call_addr):
sym_name = symbol_cache[call_addr]
else:
sym_name = self.profile.get_symbol_by_address("kernel", call_addr)
if not sym_name:
sym_name = "HOOKED"
symbol_cache[call_addr] = sym_name
self.table_row(outfd, call_addr, sym_name)