index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
36,311 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 177,178 | 173,181 | calculate | MountainLionMode | 178,181 | 178,181 | class MountainLionMode(kb.ParameterHook):
"""Windows memory image or live windows."""
name = "mode_darwin_mountain_lion_plus"
def calculate(self):
FILL_FUNC_BODY | class MountainLionMode(kb.ParameterHook):
"""Windows memory image or live windows."""
name = "mode_darwin_mountain_lion_plus"
def calculate(self):
FILL_FUNC_BODY | if self.session.profile:
return (self.session.profile.get_constant("_BootPML4", False) and
self.session.GetParameter("mode_darwin_memory"))
| if self.session.profile:
return (self.session.profile.get_constant("_BootPML4", False) and
self.session.GetParameter("mode_darwin_memory"))
| 7 | 58 | 51 | 109 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,312 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 42,43 | 39,47 | calculate | NTFSMode | 43,47 | 43,47 | class NTFSMode(kb.ParameterHook):
name = "mode_ntfs"
def calculate(self):
FILL_FUNC_BODY | class NTFSMode(kb.ParameterHook):
name = "mode_ntfs"
def calculate(self):
FILL_FUNC_BODY | return isinstance(self.session.profile, ntfs.NTFSProfile)
| return isinstance(self.session.profile, ntfs.NTFSProfile)
| 3 | 39 | 27 | 66 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,313 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 50,51 | 47,56 | calculate | TSKMode | 51,56 | 51,56 | class TSKMode(kb.ParameterHook):
name = "mode_tsk"
def calculate(self):
FILL_FUNC_BODY | class TSKMode(kb.ParameterHook):
name = "mode_tsk"
def calculate(self):
FILL_FUNC_BODY | if self.session.profile:
return isinstance(self.session.profile, tsk.TSKProfile)
| if self.session.profile:
return isinstance(self.session.profile, tsk.TSKProfile)
| 5 | 39 | 36 | 75 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,314 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 137,138 | 134,142 | calculate | VistaMode | 138,142 | 138,142 | class VistaMode(kb.ParameterHook):
name = "mode_vista_plus"
def calculate(self):
FILL_FUNC_BODY | class VistaMode(kb.ParameterHook):
name = "mode_vista_plus"
def calculate(self):
FILL_FUNC_BODY | if self.session.profile:
return self.session.profile.metadata("major", 0) >= 6
| if self.session.profile:
return self.session.profile.metadata("major", 0) >= 6
| 7 | 41 | 33 | 74 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,315 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 146,147 | 142,152 | calculate | WinMemoryMode | 147,152 | 147,152 | class WinMemoryMode(kb.ParameterHook):
"""Windows memory image or live windows."""
name = "mode_windows_memory"
def calculate(self):
FILL_FUNC_BODY | class WinMemoryMode(kb.ParameterHook):
"""Windows memory image or live windows."""
name = "mode_windows_memory"
def calculate(self):
FILL_FUNC_BODY | return (self.session.GetParameter("mode_live_memory") or
self.session.GetParameter("mode_image")) and (
self.session.GetParameter("mode_windows"))
| return (self.session.GetParameter("mode_live_memory") or
self.session.GetParameter("mode_image")) and (
self.session.GetParameter("mode_windows"))
| 7 | 50 | 53 | 103 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,316 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 75,76 | 72,80 | calculate | WinMode | 76,80 | 76,80 | class WinMode(kb.ParameterHook):
name = "mode_windows"
def calculate(self):
FILL_FUNC_BODY | class WinMode(kb.ParameterHook):
name = "mode_windows"
def calculate(self):
FILL_FUNC_BODY | if self.session.profile:
return self.session.profile.metadata("os") == "windows"
| if self.session.profile:
return self.session.profile.metadata("os") == "windows"
| 6 | 37 | 32 | 69 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,317 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/modes.py | 59,60 | 56,64 | calculate | WinXPMode | 60,64 | 60,64 | class WinXPMode(kb.ParameterHook):
name = "mode_xp"
def calculate(self):
FILL_FUNC_BODY | class WinXPMode(kb.ParameterHook):
name = "mode_xp"
def calculate(self):
FILL_FUNC_BODY | if self.session.profile:
return self.session.profile.metadata("major") == 5
| if self.session.profile:
return self.session.profile.metadata("major") == 5
| 6 | 40 | 30 | 70 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,318 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/darwin/macho.py | 134,136 | 127,138 | Initialize | MachoProfile | 136,138 | 136,138 | class MachoProfile(basic.ProfileLP64, basic.BasicClasses):
"""A profile for Mach-O files.
This profile contains types for both 32 and 64bit Mach-O files, although
only the latter is actually in use by anyone (including Apple).
"""
@classmethod
def Initialize(cls, profile):
FILL_FUNC_BODY | class MachoProfile(basic.ProfileLP64, basic.BasicClasses):
"""A profile for Mach-O files.
This profile contains types for both 32 and 64bit Mach-O files, although
only the latter is actually in use by anyone (including Apple).
"""
@classmethod
def Initialize(cls, profile):
FILL_FUNC_BODY | super(MachoProfile, cls).Initialize(profile)
profile.add_overlay(macho_vtypes)
| super(MachoProfile, cls).Initialize(profile)
profile.add_overlay(macho_vtypes)
| 3 | 96 | 35 | 131 | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 v... | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 v... |
36,319 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/tokens.py | 90,91 | 1,99 | InitializeTokenProfiles | 91,99 | 91,99 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | if profile.get_obj_offset("_TOKEN", "PrivilegeCount") != None:
# Uses XP Style Privilege array.
profile.add_overlay(xp_style_overlays)
profile.add_classes(_TOKEN=XP_TOKEN)
elif profile.get_obj_offset("_SEP_TOKEN_PRIVILEGES", "Present") != None:
# Uses Vista style Present, Enable... | if profile.get_obj_offset("_TOKEN", "PrivilegeCount") != None:
# Uses XP Style Privilege array.
profile.add_overlay(xp_style_overlays)
profile.add_classes(_TOKEN=XP_TOKEN)
elif profile.get_obj_offset("_SEP_TOKEN_PRIVILEGES", "Present") != None:
# Uses Vista style Present, Enable... | 27 | 753 | 155 | 908 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | |
36,320 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/tokens.py | 64,65 | 61,90 | GetPrivileges | VISTA_TOKEN | 66,90 | 65,90 | class VISTA_TOKEN(obj.Struct):
"""A Vista Style _TOKEN object."""
def GetPrivileges(self):
FILL_FUNC_BODY | class VISTA_TOKEN(obj.Struct):
"""A Vista Style _TOKEN object."""
def GetPrivileges(self):
"""Enumerates all privileges in this token."""
FILL_FUNC_BODY |
privilege_table = self.obj_session.GetParameter("privilege_table")
present = self.Privileges.Present.v()
enabled = self.Privileges.Enabled.v()
default = self.Privileges.EnabledByDefault.v()
for i in range(0, 64):
if i not in privilege_table:
continue... | """Enumerates all privileges in this token."""
privilege_table = self.obj_session.GetParameter("privilege_table")
present = self.Privileges.Present.v()
enabled = self.Privileges.Enabled.v()
default = self.Privileges.EnabledByDefault.v()
for i in range(0, 64):
... | 49 | 61 | 189 | 250 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,321 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/tokens.py | 44,45 | 41,61 | GetPrivileges | XP_TOKEN | 50,61 | 45,61 | class XP_TOKEN(obj.Struct):
"""XP Style privileges are just an array."""
def GetPrivileges(self):
FILL_FUNC_BODY | class XP_TOKEN(obj.Struct):
"""XP Style privileges are just an array."""
def GetPrivileges(self):
"""Enumerates all privileges in this token.
Yields:
value, flags
"""
FILL_FUNC_BODY | for privilege in self.Privileges:
flags = ["Present"]
if privilege.Attributes & 2:
flags.append("Enabled")
if privilege.Attributes & 1:
flags.append("Default")
yield privilege.Luid.v(), flags
| """Enumerates all privileges in this token.
Yields:
value, flags
"""
for privilege in self.Privileges:
flags = ["Present"]
if privilege.Attributes & 2:
flags.append("Enabled")
if privilege.Attributes & 1:
fla... | 20 | 73 | 81 | 154 | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,322 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/vista.py | 113,114 | 1,123 | InitializeVistaProfile | 114,123 | 114,123 | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... | if profile.metadata("arch") == "AMD64":
profile.add_constants(dict(PoolAlignment=16))
else:
profile.add_constants(dict(PoolAlignment=8))
profile.add_overlay(vista_overlays)
profile.add_classes(dict(
_ETHREAD=_ETHREAD,
_MMADDRESS_NODE=_MMADDRESS_NODE
))
| if profile.metadata("arch") == "AMD64":
profile.add_constants(dict(PoolAlignment=16))
else:
profile.add_constants(dict(PoolAlignment=8))
profile.add_overlay(vista_overlays)
profile.add_classes(dict(
_ETHREAD=_ETHREAD,
_MMADDRESS_NODE=_MMADDRESS_NODE
))
| 12 | 1,349 | 119 | 1,468 | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... | |
36,323 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/vista.py | 108,109 | 105,113 | owning_process | _ETHREAD | 110,113 | 109,113 | class _ETHREAD(common._ETHREAD):
"""A class for Windows 7 ETHREAD objects"""
def owning_process(self):
FILL_FUNC_BODY | class _ETHREAD(common._ETHREAD):
"""A class for Windows 7 ETHREAD objects"""
def owning_process(self):
"""Return the EPROCESS that owns this thread"""
FILL_FUNC_BODY | return self.Tcb.Process.dereference_as("_EPROCESS")
| """Return the EPROCESS that owns this thread"""
return self.Tcb.Process.dereference_as("_EPROCESS")
| 2 | 59 | 25 | 84 | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
#
# 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 ver... |
36,324 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/win10.py | 45,46 | 1,70 | InitializeWindows10Profile | 47,70 | 46,70 | from rekall.plugins.overlays.windows import win8
win10_undocumented_amd64 = {
# wi10.raw 18:05:45> dis "nt!MiSessionInsertImage"
# call 0xf8014a9d4e80 nt!memset
# ... or rax, 3 <---- Base address is ORed with 3.
# mov dword ptr [rbp + 0x3c], 1 <--- ImageCountI... | from rekall.plugins.overlays.windows import win8
win10_undocumented_amd64 = {
# wi10.raw 18:05:45> dis "nt!MiSessionInsertImage"
# call 0xf8014a9d4e80 nt!memset
# ... or rax, 3 <---- Base address is ORed with 3.
# mov dword ptr [rbp + 0x3c], 1 <--- ImageCountI... | win8.InitializeWindows8Profile(profile)
profile.add_overlay(win10_overlays)
if profile.metadata("arch") == "AMD64":
profile.add_overlay(win10_undocumented_amd64)
else:
profile.add_overlay(win10_undocumented_i386)
# Older Win10 releases include SystemNodeInformation inside
# _MI... | """Initialize windows 10 profiles."""
win8.InitializeWindows8Profile(profile)
profile.add_overlay(win10_overlays)
if profile.metadata("arch") == "AMD64":
profile.add_overlay(win10_undocumented_amd64)
else:
profile.add_overlay(win10_undocumented_i386)
# Older Win10 releases incl... | 42 | 537 | 283 | 820 | from rekall.plugins.overlays.windows import win8
win10_undocumented_amd64 = {
# wi10.raw 18:05:45> dis "nt!MiSessionInsertImage"
# call 0xf8014a9d4e80 nt!memset
# ... or rax, 3 <---- Base address is ORed with 3.
# mov dword ptr [rbp + 0x3c], 1 <--- ImageCountI... | from rekall.plugins.overlays.windows import win8
win10_undocumented_amd64 = {
# wi10.raw 18:05:45> dis "nt!MiSessionInsertImage"
# call 0xf8014a9d4e80 nt!memset
# ... or rax, 3 <---- Base address is ORed with 3.
# mov dword ptr [rbp + 0x3c], 1 <--- ImageCountI... | |
36,325 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/windows.py | 98,100 | 43,144 | Initialize | Ntoskrnl | 100,136 | 100,136 | class Ntoskrnl(pe_vtypes.BasicPEProfile):
"""A profile for Windows."""
@classmethod
def GuessVersion(cls, profile):
"""Guess the windows version of a profile."""
# If the version is provided, then just use it.
try:
major, minor = profile.metadatas("major", "minor")
... | class Ntoskrnl(pe_vtypes.BasicPEProfile):
"""A profile for Windows."""
@classmethod
def GuessVersion(cls, profile):
"""Guess the windows version of a profile."""
# If the version is provided, then just use it.
try:
major, minor = profile.metadatas("major", "minor")
... | super(Ntoskrnl, cls).Initialize(profile)
profile.add_enums(**undocumented.ENUMS)
if profile.metadata("arch") == "AMD64":
profile.add_overlay(undocumented.AMD64)
elif profile.metadata("arch") == "I386":
profile.add_overlay(undocumented.I386)
# Detect... | super(Ntoskrnl, cls).Initialize(profile)
profile.add_enums(**undocumented.ENUMS)
if profile.metadata("arch") == "AMD64":
profile.add_overlay(undocumented.AMD64)
elif profile.metadata("arch") == "I386":
profile.add_overlay(undocumented.I386)
# Detect... | 83 | 672 | 411 | 1,083 | from __future__ import division
# Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen <scudette@users.sourceforge.net>
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; y... | from __future__ import division
# Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen <scudette@users.sourceforge.net>
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; y... |
36,326 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/overlays/windows/xp.py | 111,112 | 1,118 | InitializeXPProfile | 112,118 | 112,118 | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | if profile.metadata("arch") == "AMD64":
profile.add_constants(dict(PoolAlignment=16))
else:
profile.add_constants(dict(PoolAlignment=8))
profile.add_overlay(win_xp_overlays)
profile.add_classes(dict(_MMVAD=_MMVAD))
| if profile.metadata("arch") == "AMD64":
profile.add_constants(dict(PoolAlignment=16))
else:
profile.add_constants(dict(PoolAlignment=8))
profile.add_overlay(win_xp_overlays)
profile.add_classes(dict(_MMVAD=_MMVAD))
| 9 | 1,304 | 98 | 1,402 | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | # Rekall Memory Forensics
# Copyright (c) 2008 Volatile Systems
# Copyright (c) 2008 Brendan Dolan-Gavitt <bdolangavitt@wesleyan.edu>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | |
36,327 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/darwin.py | 31,32 | 28,53 | EncodeToJsonSafe | ProcDataExport | 32,48 | 32,48 | class ProcDataExport(data_export.DataExportBaseObjectRenderer):
renders_type = "proc"
def EncodeToJsonSafe(self, task, **_):
FILL_FUNC_BODY def Summary(self, item, **_):
return "%s (%s)" % (item.get("Cybox", {}).get("Name", ""),
item.get("Cybox", {}).get("PID", ""))
| class ProcDataExport(data_export.DataExportBaseObjectRenderer):
renders_type = "proc"
def EncodeToJsonSafe(self, task, **_):
FILL_FUNC_BODY def Summary(self, item, **_):
return "%s (%s)" % (item.get("Cybox", {}).get("Name", ""),
item.get("Cybox", {}).get("PID", ""))
| result = super(ProcDataExport, self).EncodeToJsonSafe(task)
result["Cybox"] = dict(
type=u"ProcessObj:ProcessObjectType",
Name=task.name,
PID=task.pid,
Creation_Time=task.p_start,
Parent_PID=task.p_ppid,
Image_Info=dict(
... | result = super(ProcDataExport, self).EncodeToJsonSafe(task)
result["Cybox"] = dict(
type=u"ProcessObj:ProcessObjectType",
Name=task.name,
PID=task.pid,
Creation_Time=task.p_start,
Parent_PID=task.p_ppid,
Image_Info=dict(
... | 23 | 114 | 189 | 303 | # Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,328 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/darwin.py | 137,138 | 134,141 | render_full | Sockaddr_TextObjectRenderer | 138,141 | 138,141 | class Sockaddr_TextObjectRenderer(text.TextObjectRenderer):
renders_type = "sockaddr"
def render_full(self, target, **_):
FILL_FUNC_BODY | class Sockaddr_TextObjectRenderer(text.TextObjectRenderer):
renders_type = "sockaddr"
def render_full(self, target, **_):
FILL_FUNC_BODY | return text.Cell(target.address)
| return text.Cell(target.address)
| 2 | 53 | 16 | 69 | # Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,329 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/efilter.py | 48,49 | 45,50 | GetState | RowTupleDataExportObjectRenderer | 49,50 | 49,50 | class RowTupleDataExportObjectRenderer(data_export.DataExportObjectRenderer):
renders_type = "RowTuple"
def GetState(self, item, **_):
FILL_FUNC_BODY | class RowTupleDataExportObjectRenderer(data_export.DataExportObjectRenderer):
renders_type = "RowTuple"
def GetState(self, item, **_):
FILL_FUNC_BODY | return dict(items=list(item))
| return dict(items=list(item))
| 2 | 55 | 12 | 67 | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... |
36,330 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/efilter.py | 33,34 | 29,45 | render_row | RowTupleTextObjectRenderer | 34,45 | 34,45 | class RowTupleTextObjectRenderer(text.TextObjectRenderer):
renders_type = "RowTuple"
renderers = ["TextRenderer", "TestRenderer", "WideTextRenderer"]
def render_row(self, item, **_):
FILL_FUNC_BODY | class RowTupleTextObjectRenderer(text.TextObjectRenderer):
renders_type = "RowTuple"
renderers = ["TextRenderer", "TestRenderer", "WideTextRenderer"]
def render_row(self, item, **_):
FILL_FUNC_BODY | result = []
for element in item:
delegate_cls = renderer_module.ObjectRenderer.ForTarget(
element, renderer=self.renderer)
result.append(delegate_cls(
session=self.session,
renderer=self.renderer).render_row(element))
retur... | result = []
for element in item:
delegate_cls = renderer_module.ObjectRenderer.ForTarget(
element, renderer=self.renderer)
result.append(delegate_cls(
session=self.session,
renderer=self.renderer).render_row(element))
retur... | 17 | 72 | 102 | 174 | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... |
36,331 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/virtualization.py | 33,34 | 29,41 | GetState | VTxPagedMemoryObjectRenderer | 34,41 | 34,41 | class VTxPagedMemoryObjectRenderer(
json_storage.BaseAddressSpaceObjectRenderer):
renders_type = "VTxPagedMemory"
def GetState(self, item, **options):
FILL_FUNC_BODY | class VTxPagedMemoryObjectRenderer(
json_storage.BaseAddressSpaceObjectRenderer):
renders_type = "VTxPagedMemory"
def GetState(self, item, **options):
FILL_FUNC_BODY | state = super(VTxPagedMemoryObjectRenderer, self).GetState(
item, **options)
state["dtb"] = item.dtb
state["ept"] = item.ept
return state
| state = super(VTxPagedMemoryObjectRenderer, self).GetState(
item, **options)
state["dtb"] = item.dtb
state["ept"] = item.ept
return state
| 14 | 60 | 63 | 123 | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,332 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/virtualization.py | 44,45 | 41,67 | EncodeToJsonSafe | VirtualMachine_DataExportRenderer | 45,59 | 45,59 | class VirtualMachine_DataExportRenderer(data_export.DataExportObjectRenderer):
renders_type = "VirtualMachine"
def EncodeToJsonSafe(self, vm, **options):
FILL_FUNC_BODY def Summary(self, vm, **_):
if vm.get("_quick"):
return "VM [?? vCORE(s), {1}]".format(vm.get("guest_arch"))
el... | class VirtualMachine_DataExportRenderer(data_export.DataExportObjectRenderer):
renders_type = "VirtualMachine"
def EncodeToJsonSafe(self, vm, **options):
FILL_FUNC_BODY def Summary(self, vm, **_):
if vm.get("_quick"):
return "VM [?? vCORE(s), {1}]".format(vm.get("guest_arch"))
el... | result = super(VirtualMachine_DataExportRenderer,
self).EncodeToJsonSafe(vm)
result["ept"] = vm.ept
result["host_rip"] = vm.host_rip
result["name"] = vm.name
result["_quick"] = options.pop("quick", False)
result["guest_arch"] = vm.guest_arch
... | result = super(VirtualMachine_DataExportRenderer,
self).EncodeToJsonSafe(vm)
result["ept"] = vm.ept
result["host_rip"] = vm.host_rip
result["name"] = vm.name
result["_quick"] = options.pop("quick", False)
result["guest_arch"] = vm.guest_arch
... | 40 | 154 | 196 | 350 | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,333 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/virtualization.py | 70,71 | 67,106 | DecodeFromJsonSafe | VirtualMachine_JsonObjectRenderer | 71,90 | 71,90 | class VirtualMachine_JsonObjectRenderer(json_renderer.StateBasedObjectRenderer):
renders_type = "VirtualMachine"
def DecodeFromJsonSafe(self, state, options):
FILL_FUNC_BODY def GetState(self, item, **options):
state = super(VirtualMachine_JsonObjectRenderer, self).GetState(
item, **opti... | class VirtualMachine_JsonObjectRenderer(json_renderer.StateBasedObjectRenderer):
renders_type = "VirtualMachine"
def DecodeFromJsonSafe(self, state, options):
FILL_FUNC_BODY def GetState(self, item, **options):
state = super(VirtualMachine_JsonObjectRenderer, self).GetState(
item, **opti... | super_obj = super(VirtualMachine_JsonObjectRenderer, self)
state = super_obj.DecodeFromJsonSafe(state, options)
vm = hypervisors.VirtualMachine(host_rip=state.get("host_rip"),
ept=state.get("ept"),
parent=state.get(... | super_obj = super(VirtualMachine_JsonObjectRenderer, self)
state = super_obj.DecodeFromJsonSafe(state, options)
vm = hypervisors.VirtualMachine(host_rip=state.get("host_rip"),
ept=state.get("ept"),
parent=state.get(... | 43 | 249 | 240 | 489 | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,334 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/virtualization.py | 131,132 | 106,139 | render_row | VirtualizationNode_TextObjectRenderer | 132,139 | 132,139 | class VirtualizationNode_TextObjectRenderer(text.TextObjectRenderer):
"""Virtualization nodes can be Hypervisors, VirtualMachine or VMCS."""
renders_type = "VirtualizationNode"
renderers = ["TextRenderer", "WebConsoleRenderer", "TestRenderer"]
def __init__(self, *args, **options):
self.quick = ... | class VirtualizationNode_TextObjectRenderer(text.TextObjectRenderer):
"""Virtualization nodes can be Hypervisors, VirtualMachine or VMCS."""
renders_type = "VirtualizationNode"
renderers = ["TextRenderer", "WebConsoleRenderer", "TestRenderer"]
def __init__(self, *args, **options):
self.quick = ... | if isinstance(target, hypervisors.VirtualMachine):
return text.Cell("VM [{0:s} vCORE(s), {1:s}]".format(
(self.quick and "??") or str(target.num_cores),
target.guest_arch))
elif "VMCS" in target.__class__.__name__:
return text.Cell("VMCS @ {0:08X} ... | if isinstance(target, hypervisors.VirtualMachine):
return text.Cell("VM [{0:s} vCORE(s), {1:s}]".format(
(self.quick and "??") or str(target.num_cores),
target.guest_arch))
elif "VMCS" in target.__class__.__name__:
return text.Cell("VMCS @ {0:08X} ... | 26 | 275 | 140 | 415 | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... | # Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 ver... |
36,335 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/renderers/visual_aides_test.py | 7,8 | 6,34 | testRuns | MemoryMapTest | 8,34 | 8,34 | class MemoryMapTest(testlib.RekallBaseUnitTestCase):
def testRuns(self):
FILL_FUNC_BODY | class MemoryMapTest(testlib.RekallBaseUnitTestCase):
def testRuns(self):
FILL_FUNC_BODY | runs = [
dict(start=101, end=500, value="Foo"),
dict(start=0, end=100, value="Bar"),
dict(start=0, end=10, value="Foo"),
dict(start=401, end=500, value="Baz"),
dict(start=501, end=502, value="Bork")]
legend = visual_aides.MapLegend(legend=[
... | runs = [
dict(start=101, end=500, value="Foo"),
dict(start=0, end=100, value="Bar"),
dict(start=0, end=10, value="Foo"),
dict(start=401, end=500, value="Baz"),
dict(start=501, end=502, value="Bork")]
legend = visual_aides.MapLegend(legend=[
... | 72 | 35 | 426 | 461 | from rekall import testlib
from rekall.plugins.renderers import visual_aides
class MemoryMapTest(testlib.RekallBaseUnitTestCase):
def testRuns(self):
FILL_FUNC_BODY | from rekall import testlib
from rekall.plugins.renderers import visual_aides
class MemoryMapTest(testlib.RekallBaseUnitTestCase):
def testRuns(self):
FILL_FUNC_BODY |
36,336 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/response/osquery.py | 62,63 | 45,105 | try_to_find_osquery | OSQuery | 63,82 | 63,82 | class OSQuery(common.AbstractIRCommandPlugin):
"""Runs the OSQuery query and emit the results.
Note that the columns emitted depend on osquery itself so we can
not predict in advance the table format.
"""
name = "osquery"
__args = [
dict(name="query", positional=True,
help... | class OSQuery(common.AbstractIRCommandPlugin):
"""Runs the OSQuery query and emit the results.
Note that the columns emitted depend on osquery itself so we can
not predict in advance the table format.
"""
name = "osquery"
__args = [
dict(name="query", positional=True,
help... | extention = ""
if platform.system() == "Windows":
extention = ".exe"
try:
return resources.get_resource("osqueryi" + extention)
except IOError as e:
# Maybe it is installed on the system.
if platform.system() == "Windows":
... | extention = ""
if platform.system() == "Windows":
extention = ".exe"
try:
return resources.get_resource("osqueryi" + extention)
except IOError as e:
# Maybe it is installed on the system.
if platform.system() == "Windows":
... | 53 | 422 | 173 | 595 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,337 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 42,43 | 1,217 | IPython012Support | 48,56 | 43,56 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | if ipython_support:
# This must be run here because the IPython shell messes with our user
# namespace above (by adding its own help function).
user_session.PrepareLocalNamespace()
return ipython_support.Shell(user_session)
| """Launch the ipython session for post 0.12 versions.
Returns:
False if we failed to use IPython. True if the session was run and exited.
"""
if ipython_support:
# This must be run here because the IPython shell messes with our user
# namespace above (by adding its own help functi... | 28 | 1,852 | 76 | 1,928 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | |
36,338 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 81,83 | 77,95 | args | BaseSessionCommand | 83,88 | 83,88 | class BaseSessionCommand(plugin.Command):
"""Base class for all session management plugins."""
interactive = True
@classmethod
def args(cls, parser):
FILL_FUNC_BODY def __init__(self, session_id=None, **kwargs):
session = kwargs.pop("session")
super(BaseSessionCommand, self).__init__... | class BaseSessionCommand(plugin.Command):
"""Base class for all session management plugins."""
interactive = True
@classmethod
def args(cls, parser):
FILL_FUNC_BODY def __init__(self, session_id=None, **kwargs):
session = kwargs.pop("session")
super(BaseSessionCommand, self).__init__... | super(BaseSessionCommand, cls).args(parser)
parser.add_argument("session_id",
help="The session id to change to")
| super(BaseSessionCommand, cls).args(parser)
parser.add_argument("session_id",
help="The session id to change to")
| 9 | 119 | 46 | 165 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,339 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 204,205 | 195,215 | render | InteractiveShell | 205,215 | 205,215 | class InteractiveShell(plugin.ProfileCommand):
"""An interactive shell for Rekall."""
name = "shell"
# The following dependencies are optional.
PHYSICAL_AS_REQUIRED = False
PROFILE_REQUIRED = False
def render(self, renderer):
FILL_FUNC_BODY | class InteractiveShell(plugin.ProfileCommand):
"""An interactive shell for Rekall."""
name = "shell"
# The following dependencies are optional.
PHYSICAL_AS_REQUIRED = False
PROFILE_REQUIRED = False
def render(self, renderer):
FILL_FUNC_BODY | self.session.mode = "Interactive"
self.session.session_name = (
self.session.GetParameter("base_filename") or
self.session.session_name)
# Try to launch the session using ipython or bare python.
if not IPython012Support(self.session):
NativePythonSupp... | self.session.mode = "Interactive"
self.session.session_name = (
self.session.GetParameter("base_filename") or
self.session.session_name)
# Try to launch the session using ipython or bare python.
if not IPython012Support(self.session):
NativePythonSupp... | 24 | 84 | 100 | 184 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,340 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 188,189 | 184,195 | calculate | PagingLimitHook | 189,195 | 189,195 | class PagingLimitHook(kb.ParameterHook):
"""If no paging_limit specified, calculate it from cursors."""
name = "paging_limit"
def calculate(self):
FILL_FUNC_BODY | class PagingLimitHook(kb.ParameterHook):
"""If no paging_limit specified, calculate it from cursors."""
name = "paging_limit"
def calculate(self):
FILL_FUNC_BODY | if text_renderer.curses:
return text_renderer.curses.tigetnum("lines")
return int(os.environ.get("ROWS", 50))
| if text_renderer.curses:
return text_renderer.curses.tigetnum("lines")
return int(os.environ.get("ROWS", 50))
| 7 | 57 | 57 | 114 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,341 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 136,137 | 132,146 | render | SessionDelete | 137,146 | 137,146 | class SessionDelete(SessionSwitch):
"""Delete a session."""
__name = "sdel"
def render(self, renderer):
FILL_FUNC_BODY | class SessionDelete(SessionSwitch):
"""Delete a session."""
__name = "sdel"
def render(self, renderer):
FILL_FUNC_BODY | session = self.session.find_session(self.session_id)
if session == None:
renderer.format("Invalid session id.\n")
elif session == self.session:
renderer.format("You can't delete your current session.\n")
else:
self.session.session_list.remove(session)
... | session = self.session.find_session(self.session_id)
if session == None:
renderer.format("Invalid session id.\n")
elif session == self.session:
renderer.format("You can't delete your current session.\n")
else:
self.session.session_list.remove(session)
... | 22 | 45 | 94 | 139 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,342 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 99,100 | 95,106 | render | SessionList | 100,106 | 100,106 | class SessionList(BaseSessionCommand):
"""List the sessions available."""
__name = "slist"
def render(self, renderer):
FILL_FUNC_BODY | class SessionList(BaseSessionCommand):
"""List the sessions available."""
__name = "slist"
def render(self, renderer):
FILL_FUNC_BODY | for session in self.session.session_list:
renderer.format("%s [%d] %s\n" % (
"*" if (self.session == session) else " ",
session.session_id, session.session_name))
| for session in self.session.session_list:
renderer.format("%s [%d] %s\n" % (
"*" if (self.session == session) else " ",
session.session_id, session.session_name))
| 19 | 47 | 69 | 116 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,343 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 158,160 | 146,184 | args | SessionMod | 160,172 | 160,172 | class SessionMod(plugin.Command):
"""Modifies parameters of the current analysis session.
Any session parameters can be set here. For example:
smod colors="no", paging_limit=10, pager="less"
"""
__name = "smod"
interactive = True
@classmethod
def args(cls, parser):
FILL_FUNC_BODY ... | class SessionMod(plugin.Command):
"""Modifies parameters of the current analysis session.
Any session parameters can be set here. For example:
smod colors="no", paging_limit=10, pager="less"
"""
__name = "smod"
interactive = True
@classmethod
def args(cls, parser):
FILL_FUNC_BODY ... | super(SessionMod, cls).args(parser)
parser.add_argument("--filename",
help="The name of the image file to analyze.")
parser.add_argument("--profile", default=None,
help="The name of the profile to load.")
parser.add_argument("--p... | super(SessionMod, cls).args(parser)
parser.add_argument("--filename",
help="The name of the image file to analyze.")
parser.add_argument("--profile", default=None,
help="The name of the profile to load.")
parser.add_argument("--p... | 35 | 204 | 128 | 332 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,344 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 122,123 | 118,132 | render | SessionNew | 123,132 | 123,132 | class SessionNew(BaseSessionCommand):
"""Creates a new session by cloning the current one."""
__name = "snew"
def render(self, renderer):
FILL_FUNC_BODY | class SessionNew(BaseSessionCommand):
"""Creates a new session by cloning the current one."""
__name = "snew"
def render(self, renderer):
FILL_FUNC_BODY | new_session = self.session.add_session(**self.kwargs)
# Switch to the new session.
self.session.plugins.sswitch(new_session.session_id).render(renderer)
renderer.format("Created session [{0:s}] {1:s}\n",
new_session.session_id, new_session.session_name)
| new_session = self.session.add_session(**self.kwargs)
# Switch to the new session.
self.session.plugins.sswitch(new_session.session_id).render(renderer)
renderer.format("Created session [{0:s}] {1:s}\n",
new_session.session_id, new_session.session_name)
| 16 | 54 | 106 | 160 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,345 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/tools/ipython.py | 110,111 | 106,118 | render | SessionSwitch | 111,118 | 111,118 | class SessionSwitch(BaseSessionCommand):
"""Changes the current session to the session with session_id."""
__name = "sswitch"
def render(self, renderer):
FILL_FUNC_BODY | class SessionSwitch(BaseSessionCommand):
"""Changes the current session to the session with session_id."""
__name = "sswitch"
def render(self, renderer):
FILL_FUNC_BODY | new_session = self.session.find_session(self.session_id)
if new_session:
self.session.locals["session"] = new_session
else:
renderer.format("Invalid session specified.\n")
| new_session = self.session.find_session(self.session_id)
if new_session:
self.session.locals["session"] = new_session
else:
renderer.format("Invalid session specified.\n")
| 12 | 56 | 68 | 124 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,347 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/connections.py | 56,57 | 28,85 | collect | Connections | 57,85 | 57,85 | class Connections(tcpip_vtypes.TcpipPluginMixin,
common.WindowsCommandPlugin):
"""
Print list of open connections [Windows XP Only]
---------------------------------------------
This module enumerates the active connections from tcpip.sys.
Note that if you are using a hibernated ... | class Connections(tcpip_vtypes.TcpipPluginMixin,
common.WindowsCommandPlugin):
"""
Print list of open connections [Windows XP Only]
---------------------------------------------
This module enumerates the active connections from tcpip.sys.
Note that if you are using a hibernated ... | # The _TCBTable is a pointer to the hash table.
TCBTable = self.tcpip_profile.get_constant_object(
"TCBTable",
target="Pointer",
vm=self.kernel_address_space,
target_args=dict(
target="Array",
target_args=dict(
... | # The _TCBTable is a pointer to the hash table.
TCBTable = self.tcpip_profile.get_constant_object(
"TCBTable",
target="Pointer",
vm=self.kernel_address_space,
target_args=dict(
target="Array",
target_args=dict(
... | 64 | 276 | 304 | 580 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
#
# 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... | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
#
# 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... |
36,348 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/connections.py | 113,114 | 85,151 | column_types | Sockets | 114,123 | 114,123 | class Sockets(tcpip_vtypes.TcpipPluginMixin,
common.WindowsCommandPlugin):
"""
Print list of open sockets. [Windows xp only]
---------------------------------------------
This module enumerates the active sockets from tcpip.sys
Note that if you are using a hibernated image this might... | class Sockets(tcpip_vtypes.TcpipPluginMixin,
common.WindowsCommandPlugin):
"""
Print list of open sockets. [Windows xp only]
---------------------------------------------
This module enumerates the active sockets from tcpip.sys
Note that if you are using a hibernated image this might... | sock = self.tcpip_profile._ADDRESS_OBJECT()
return dict(offset_v=sock,
pid=sock.Pid,
port=sock.LocalPort,
proto=int(sock.Protocol),
protocol=sock.Protocol,
address=sock.LocalIpAddress,
... | sock = self.tcpip_profile._ADDRESS_OBJECT()
return dict(offset_v=sock,
pid=sock.Pid,
port=sock.LocalPort,
proto=int(sock.Protocol),
protocol=sock.Protocol,
address=sock.LocalIpAddress,
... | 11 | 556 | 104 | 660 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
#
# 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... | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
#
# 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... |
36,350 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/gui/windowstations.py | 114,115 | 97,146 | collect | WinDesktops | 115,146 | 115,146 | class WinDesktops(WindowsStations):
"""Print information on each desktop."""
__name = "desktops"
table_header = [
dict(name="divider", type="Divider"),
dict(name="tagDESKTOP", style="address"),
dict(name="Name", width=20),
dict(name="Sid", width=3),
dict(name="Hooks... | class WinDesktops(WindowsStations):
"""Print information on each desktop."""
__name = "desktops"
table_header = [
dict(name="divider", type="Divider"),
dict(name="tagDESKTOP", style="address"),
dict(name="Name", width=20),
dict(name="Sid", width=3),
dict(name="Hooks... | for window_station in self.stations():
for desktop in window_station.desktops():
divider = "Desktop: {0:#x}, Name: {1}\\{2}\n".format(
desktop,
window_station.Name,
desktop.Name)
divider += ("Heap: {0:#x}, S... | for window_station in self.stations():
for desktop in window_station.desktops():
divider = "Desktop: {0:#x}, Name: {1}\\{2}\n".format(
desktop,
window_station.Name,
desktop.Name)
divider += ("Heap: {0:#x}, S... | 55 | 190 | 377 | 567 | # Rekall Memory Forensics
# Copyright (C) 2007,2008 Volatile Systems
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | # Rekall Memory Forensics
# Copyright (C) 2007,2008 Volatile Systems
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
36,351 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/gui/windowstations.py | 86,87 | 48,97 | collect | WindowsStations | 87,97 | 87,97 | class WindowsStations(win32k_core.Win32kPluginMixin,
common.WindowsCommandPlugin):
"""Displays all the windows stations by following lists."""
__name = "windows_stations"
table_header = [
dict(name="WindowStation", style="address"),
dict(name="Name", width=20),
... | class WindowsStations(win32k_core.Win32kPluginMixin,
common.WindowsCommandPlugin):
"""Displays all the windows stations by following lists."""
__name = "windows_stations"
table_header = [
dict(name="WindowStation", style="address"),
dict(name="Name", width=20),
... | for window_station in self.stations():
desktops = [desk.Name for desk in window_station.desktops()]
yield dict(WindowStation=window_station,
Name=window_station.Name,
SesId=window_station.dwSessionId,
AtomTable=window_s... | for window_station in self.stations():
desktops = [desk.Name for desk in window_station.desktops()]
yield dict(WindowStation=window_station,
Name=window_station.Name,
SesId=window_station.dwSessionId,
AtomTable=window_s... | 18 | 395 | 118 | 513 | # Rekall Memory Forensics
# Copyright (C) 2007,2008 Volatile Systems
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | # Rekall Memory Forensics
# Copyright (C) 2007,2008 Volatile Systems
# Copyright (C) 2010,2011,2012 Michael Hale Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
36,352 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/interactive/profiles.py | 46,47 | 26,75 | collect | LoadWindowsProfile | 47,75 | 47,75 | class LoadWindowsProfile(common.AbstractWindowsCommandPlugin):
"""Loads the profile into the session.
If the profile does not exist in the repositories, fetch and build it from
the symbol server. This plugin allows the user to change resolution of
selected binaries by forcing the fetching of symbol fil... | class LoadWindowsProfile(common.AbstractWindowsCommandPlugin):
"""Loads the profile into the session.
If the profile does not exist in the repositories, fetch and build it from
the symbol server. This plugin allows the user to change resolution of
selected binaries by forcing the fetching of symbol fil... | if self.guid is None:
# Try to detect the GUID automatically.
module = self.session.address_resolver.GetModuleByName(
self.module_name)
if not module:
raise plugin.PluginError(
"Unknown module %s." % self.module_name)
... | if self.guid is None:
# Try to detect the GUID automatically.
module = self.session.address_resolver.GetModuleByName(
self.module_name)
if not module:
raise plugin.PluginError(
"Unknown module %s." % self.module_name)
... | 90 | 187 | 295 | 482 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,353 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/lsadecryptxp.py | 348,349 | 337,364 | decrypt | XP_CBC_DESX | 349,364 | 349,364 | class XP_CBC_DESX(object):
'''NT 5.1 and NT 5.2 lsasrv.dll CBC with DESX partial implementation.'''
def __init__(self, desx_key):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
self.desx_key = desx_key
self.DESX = XP_DESX(desx_key)
def d... | class XP_CBC_DESX(object):
'''NT 5.1 and NT 5.2 lsasrv.dll CBC with DESX partial implementation.'''
def __init__(self, desx_key):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
self.desx_key = desx_key
self.DESX = XP_DESX(desx_key)
def d... |
if len(encrypted) % 8:
raise ValueError("Encrypted length is not multiple of 8 bytes")
decrypted = self.DESX.decrypt(encrypted)
decrypted_temp = struct.unpack('<Q', decrypted)[0]
decrypted_temp ^= struct.unpack('<Q', feedback)[0]
decrypted = struct.pack('<Q', decry... |
if len(encrypted) % 8:
raise ValueError("Encrypted length is not multiple of 8 bytes")
decrypted = self.DESX.decrypt(encrypted)
decrypted_temp = struct.unpack('<Q', decrypted)[0]
decrypted_temp ^= struct.unpack('<Q', feedback)[0]
decrypted = struct.pack('<Q', decry... | 34 | 150 | 137 | 287 | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... |
36,355 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/lsadecryptxp.py | 316,317 | 305,337 | decrypt | XP_DESX | 317,337 | 317,337 | class XP_DESX(object):
'''NT 5.1 and NT 5.2 lsasrv.dll DESX implementation.'''
def __init__(self, desx_key):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
self.desx_key = desx_key
self.DES = XP_DES(desx_key[16:])
def decrypt(self, encry... | class XP_DESX(object):
'''NT 5.1 and NT 5.2 lsasrv.dll DESX implementation.'''
def __init__(self, desx_key):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
self.desx_key = desx_key
self.DES = XP_DES(desx_key[16:])
def decrypt(self, encry... |
if len(encrypted) != 8:
raise ValueError("Encrypted data length must be 8 bytes!")
eax, esi = struct.unpack('<LL', encrypted)
ecx, edx = struct.unpack('<LL', self.desx_key[8:16])
ecx ^= eax
edx ^= esi
enc_64 = struct.pack('<L', ecx) + struct.pack('<L', edx)
... |
if len(encrypted) != 8:
raise ValueError("Encrypted data length must be 8 bytes!")
eax, esi = struct.unpack('<LL', encrypted)
ecx, edx = struct.unpack('<LL', self.desx_key[8:16])
ecx ^= eax
edx ^= esi
enc_64 = struct.pack('<L', ecx) + struct.pack('<L', edx)
... | 60 | 143 | 248 | 391 | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... |
36,356 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/lsadecryptxp.py | 378,379 | 364,391 | decrypt | XP_LsaDecryptMemory | 379,391 | 379,391 | class XP_LsaDecryptMemory(object):
def __init__(self, desx_key, feedback):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
if len(feedback) != 8:
raise ValueError("feedback must be 8 bytes long!")
self.desx_key = desx_key
self... | class XP_LsaDecryptMemory(object):
def __init__(self, desx_key, feedback):
if len(desx_key) != 144:
raise ValueError("DESX KEY must be 144 bytes long!")
if len(feedback) != 8:
raise ValueError("feedback must be 8 bytes long!")
self.desx_key = desx_key
self... | if len(encrypted) % 8:
raise ValueError("Encrypted length is not multiple of 8 bytes.")
decrypted = b''
feedback = self.feedback
for i in range(0, len(encrypted) >> 3, 1):
decrypted8, feedback = self.CBC_DESX.decrypt(
encrypted[i*8:i*8+8], feedba... | if len(encrypted) % 8:
raise ValueError("Encrypted length is not multiple of 8 bytes.")
decrypted = b''
feedback = self.feedback
for i in range(0, len(encrypted) >> 3, 1):
decrypted8, feedback = self.CBC_DESX.decrypt(
encrypted[i*8:i*8+8], feedba... | 38 | 162 | 129 | 291 | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... | #!/usr/bin/python
# LsaDecryptXp
# Copyright 2015 Francesco "dfirfpi" Picasso. All Rights Reserved.
# Author email: <francesco.picasso@gmail.com>
#
# 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 Foundatio... |
36,357 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/malware/psxview.py | 62,63 | 59,85 | calculate | PsListPSScanHook | 64,85 | 63,85 | class PsListPSScanHook(common.AbstractWindowsParameterHook):
name = "pslist_PSScan"
def calculate(self):
FILL_FUNC_BODY | class PsListPSScanHook(common.AbstractWindowsParameterHook):
name = "pslist_PSScan"
def calculate(self):
"""Enumerate processes by scanning for _EPROCESS."""
FILL_FUNC_BODY | result = set()
psscan = self.session.plugins.psscan()
pslist = self.session.plugins.pslist()
for row in psscan.collect():
physical_eprocess = row["offset_p"]
if physical_eprocess.obj_vm == self.session.physical_address_space:
eprocess = pslist.vir... | """Enumerate processes by scanning for _EPROCESS."""
result = set()
psscan = self.session.plugins.psscan()
pslist = self.session.plugins.pslist()
for row in psscan.collect():
physical_eprocess = row["offset_p"]
if physical_eprocess.obj_vm == self.session.... | 42 | 61 | 202 | 263 | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... |
36,358 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/malware/psxview.py | 88,89 | 85,118 | calculate | PsListThrdprocHook | 90,118 | 89,118 | class PsListThrdprocHook(common.AbstractWindowsParameterHook):
name = "pslist_Thrdproc"
def calculate(self):
FILL_FUNC_BODY | class PsListThrdprocHook(common.AbstractWindowsParameterHook):
name = "pslist_Thrdproc"
def calculate(self):
"""Enumerate processes by scanning for threads."""
FILL_FUNC_BODY | result = set()
thrdscan_plugin = self.session.plugins.thrdscan()
for results in thrdscan_plugin.collect():
ethread = self.session.profile._ETHREAD(results[0])
if ethread.ExitTime != 0:
continue
# Bounce back to the threads owner
... | """Enumerate processes by scanning for threads."""
result = set()
thrdscan_plugin = self.session.plugins.thrdscan()
for results in thrdscan_plugin.collect():
ethread = self.session.profile._ETHREAD(results[0])
if ethread.ExitTime != 0:
continue
... | 67 | 58 | 279 | 337 | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... |
36,359 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/malware/psxview.py | 40,41 | 26,59 | render | WindowsPsxView | 41,59 | 41,59 | class WindowsPsxView(common.WinProcessFilter):
"Find hidden processes with various process listings"
__name = "psxview"
METHODS = common.WinProcessFilter.METHODS + [
"PSScan", "Thrdproc"]
__args = [
dict(name="method", choices=list(METHODS), type="ChoiceArray",
default=li... | class WindowsPsxView(common.WinProcessFilter):
"Find hidden processes with various process listings"
__name = "psxview"
METHODS = common.WinProcessFilter.METHODS + [
"PSScan", "Thrdproc"]
__args = [
dict(name="method", choices=list(METHODS), type="ChoiceArray",
default=li... | headers = [
dict(type="_EPROCESS", name="_EPROCESS"),
]
for method in self.plugin_args.method:
headers.append((method, method, "%s" % len(method)))
renderer.table_header(headers)
for eprocess in self.filter_processes():
row = [eprocess]
... | headers = [
dict(type="_EPROCESS", name="_EPROCESS"),
]
for method in self.plugin_args.method:
headers.append((method, method, "%s" % len(method)))
renderer.table_header(headers)
for eprocess in self.filter_processes():
row = [eprocess]
... | 33 | 141 | 170 | 311 | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | # Rekall Memory Forensics
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... |
36,360 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/network.py | 57,58 | 34,89 | collect | WinNetstat | 58,89 | 58,89 | class WinNetstat(tcpip_vtypes.TcpipPluginMixin, common.WindowsCommandPlugin):
"""Enumerate image for connections and sockets"""
__name = "netstat"
table_header = [
dict(name="offset", style="address"),
dict(name="protocol", width=8),
dict(name="local_addr", width=20),
dict(... | class WinNetstat(tcpip_vtypes.TcpipPluginMixin, common.WindowsCommandPlugin):
"""Enumerate image for connections and sockets"""
__name = "netstat"
table_header = [
dict(name="offset", style="address"),
dict(name="protocol", width=8),
dict(name="local_addr", width=20),
dict(... | # First list established endpoints (TcpE pooltags).
partition_table = self.tcpip_profile.get_constant_object(
"PartitionTable",
target="Pointer",
target_args=dict(
target="PARTITION_TABLE",
)
)
for partition in part... | # First list established endpoints (TcpE pooltags).
partition_table = self.tcpip_profile.get_constant_object(
"PartitionTable",
target="Pointer",
target_args=dict(
target="PARTITION_TABLE",
)
)
for partition in part... | 53 | 287 | 306 | 593 | # Rekall Memory Forensics
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 v... | # Rekall Memory Forensics
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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 v... |
36,361 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/pas2kas.py | 34,35 | 33,38 | GetTaskStruct | WinPas2VasResolver | 35,38 | 35,38 | class WinPas2VasResolver(pas2kas.Pas2VasResolver):
def GetTaskStruct(self, address):
FILL_FUNC_BODY | class WinPas2VasResolver(pas2kas.Pas2VasResolver):
def GetTaskStruct(self, address):
FILL_FUNC_BODY | return self.session.profile._EPROCESS(address)
| return self.session.profile._EPROCESS(address)
| 2 | 44 | 20 | 64 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eith... | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eith... |
36,362 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/pas2kas.py | 43,44 | 38,45 | calculate | WinPas2VasResolverHook | 44,45 | 44,45 | class WinPas2VasResolverHook(common.AbstractWindowsParameterHook):
"""Provide the Pas2Vas resolver."""
name = "physical_address_resolver"
def calculate(self):
FILL_FUNC_BODY | class WinPas2VasResolverHook(common.AbstractWindowsParameterHook):
"""Provide the Pas2Vas resolver."""
name = "physical_address_resolver"
def calculate(self):
FILL_FUNC_BODY | return WinPas2VasResolver(session=self.session)
| return WinPas2VasResolver(session=self.session)
| 2 | 62 | 18 | 80 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eith... | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eith... |
36,363 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/privileges.py | 77,78 | 65,90 | collect | Privileges | 78,90 | 78,90 | class Privileges(common.WinProcessFilter):
"""Prints process privileges."""
name = "privileges"
table_header = [
dict(name="Process", type="_EPROCESS"),
dict(name="Value", width=3, align="r"),
dict(name="Privileges", width=40),
dict(name="Attributes")
]
def collect... | class Privileges(common.WinProcessFilter):
"""Prints process privileges."""
name = "privileges"
table_header = [
dict(name="Process", type="_EPROCESS"),
dict(name="Value", width=3, align="r"),
dict(name="Privileges", width=40),
dict(name="Attributes")
]
def collect... | privilege_table = self.session.GetParameter("privilege_table")
for task in self.filter_processes():
for value, flags in task.Token.GetPrivileges():
# By default skip the privileges that are not present.
if self.plugin_args.verbosity <= 1 and "Present" not in ... | privilege_table = self.session.GetParameter("privilege_table")
for task in self.filter_processes():
for value, flags in task.Token.GetPrivileges():
# By default skip the privileges that are not present.
if self.plugin_args.verbosity <= 1 and "Present" not in ... | 37 | 120 | 125 | 245 | #!/usr/bin/python
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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 op... | #!/usr/bin/python
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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 op... |
36,364 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/privileges.py | 51,52 | 34,65 | calculate | PrivilegesHook | 52,65 | 52,65 | class PrivilegesHook(common.AbstractWindowsParameterHook):
"""Fetch the PrivilegesHook table.
In Windows, privilege values are not constant, they are actually stored in
kernel globals. We can see this kind of privilege check:
0xf800027b4e10 mov rcx, qword ptr [rip + 0x3a42a1] 0x7 nt!SeTcbPrivilege
... | class PrivilegesHook(common.AbstractWindowsParameterHook):
"""Fetch the PrivilegesHook table.
In Windows, privilege values are not constant, they are actually stored in
kernel globals. We can see this kind of privilege check:
0xf800027b4e10 mov rcx, qword ptr [rip + 0x3a42a1] 0x7 nt!SeTcbPrivilege
... | result = {}
for symbol in self.session.address_resolver.search_symbol(
"nt!Se*Privilege"):
value = self.session.address_resolver.get_constant_object(
symbol, "unsigned int")
if value != None and value < 100:
result[int(value)] = s... | result = {}
for symbol in self.session.address_resolver.search_symbol(
"nt!Se*Privilege"):
value = self.session.address_resolver.get_constant_object(
symbol, "unsigned int")
if value != None and value < 100:
result[int(value)] = s... | 27 | 249 | 117 | 366 | #!/usr/bin/python
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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 op... | #!/usr/bin/python
# Rekall Memory Forensics
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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 op... |
36,365 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/procinfo.py | 90,91 | 35,209 | render | PEInfo | 92,209 | 91,209 | class PEInfo(plugin.TypedProfileCommand, plugin.Command):
"""Print information about a PE binary."""
__name = "peinfo"
__args = [
dict(name="image_base", type="SymbolAddress", positional=True,
help="The base of the image."),
dict(name="executable", positional=True, required=F... | class PEInfo(plugin.TypedProfileCommand, plugin.Command):
"""Print information about a PE binary."""
__name = "peinfo"
__args = [
dict(name="image_base", type="SymbolAddress", positional=True,
help="The base of the image."),
dict(name="executable", positional=True, required=F... | # Get our helper object to parse the PE file.
renderer.table_header([('Attribute', 'attribute', '<30'),
('Value', 'value', '60')])
for field in ["Machine", "TimeDateStamp", "Characteristics"]:
renderer.table_row(
field,
... | """Print information about a PE file from memory."""
# Get our helper object to parse the PE file.
renderer.table_header([('Attribute', 'attribute', '<30'),
('Value', 'value', '60')])
for field in ["Machine", "TimeDateStamp", "Characteristics"]:
... | 318 | 604 | 1,421 | 2,025 | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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, ... | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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, ... |
36,366 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/procinfo.py | 221,222 | 216,249 | render | ProcInfo | 222,249 | 222,249 | class ProcInfo(common.WinProcessFilter):
"""Dump detailed information about a running process."""
__name = "procinfo"
def render(self, renderer):
FILL_FUNC_BODY | class ProcInfo(common.WinProcessFilter):
"""Dump detailed information about a running process."""
__name = "procinfo"
def render(self, renderer):
FILL_FUNC_BODY | for task in self.filter_processes():
renderer.section()
renderer.format("Pid: {0} {1}\n",
task.UniqueProcessId, task.ImageFileName)
task_address_space = task.get_process_address_space()
if not task_address_space:
render... | for task in self.filter_processes():
renderer.section()
renderer.format("Pid: {0} {1}\n",
task.UniqueProcessId, task.ImageFileName)
task_address_space = task.get_process_address_space()
if not task_address_space:
render... | 63 | 55 | 285 | 340 | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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, ... | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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, ... |
36,367 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/pstree.py | 63,64 | 28,94 | collect | PSTree | 64,94 | 64,94 | class PSTree(common.WinProcessFilter):
"""Print process list as a tree"""
__name = "pstree"
table_header = [
dict(name="_EPROCESS", type="TreeNode", max_depth=5, child=dict(
type="_EPROCESS", style="light")),
dict(name="ppid", width=6, align="r"),
dict(name="thd_count",... | class PSTree(common.WinProcessFilter):
"""Print process list as a tree"""
__name = "pstree"
table_header = [
dict(name="_EPROCESS", type="TreeNode", max_depth=5, child=dict(
type="_EPROCESS", style="light")),
dict(name="ppid", width=6, align="r"),
dict(name="thd_count",... | process_dict = self._make_process_dict()
def draw_children(pad, pid):
"""Given a pid output all its children."""
for task in sorted(list(process_dict.values()), key=lambda x: x.pid):
if task.InheritedFromUniqueProcessId != pid:
continue
... | process_dict = self._make_process_dict()
def draw_children(pad, pid):
"""Given a pid output all its children."""
for task in sorted(list(process_dict.values()), key=lambda x: x.pid):
if task.InheritedFromUniqueProcessId != pid:
continue
... | 66 | 388 | 335 | 723 | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eithe... | # Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors
# Michael Cohen <scudette@users.sourceforge.net>
#
# 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; eithe... |
36,370 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/plugins/windows/shimcache.py | 232,233 | 219,335 | collect_xp | ShimCacheMem | 243,265 | 233,265 | class ShimCacheMem(common.AbstractWindowsCommandPlugin):
"""Extract the Application Compatibility Shim Cache from kernel memory."""
name = "shimcachemem"
table_header = [
dict(name="Shim", style="address"),
dict(name="last_mod", width=30),
dict(name="last_update", hidden=True),
... | class ShimCacheMem(common.AbstractWindowsCommandPlugin):
"""Extract the Application Compatibility Shim Cache from kernel memory."""
name = "shimcachemem"
table_header = [
dict(name="Shim", style="address"),
dict(name="last_mod", width=30),
dict(name="last_update", hidden=True),
... | for row in self.session.plugins.handles(proc_regex="winlogon",
object_types="Section"):
if "ShimSharedMemory" in row["details"]:
# Found the section object.
section = row["_OBJECT_HEADER"].Object
# This ... | """Fetch the shimcache from XP.
According to the paper, on XP the cache is in shared memory inside the
process winlogon.exe. The cache begins with a header and a magic value
of 0xDEADBEEF.
For some reason the algorithm explained in the paper seems unnecessarily
complex.... | 56 | 1,013 | 243 | 1,256 | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... | # Rekall Memory Forensics
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 ... |
36,371 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/resources.py | 35,36 | 1,79 | get_resource | 50,65 | 36,65 | #!/usr/bin/env python
# Rekall
# Copyright (C) 2012 Michael Cohen <scudette@gmail.com>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | #!/usr/bin/env python
# Rekall
# Copyright (C) 2012 Michael Cohen <scudette@gmail.com>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | target = _get_pkg_resource(filename, package, prefix)
if target and os.access(target, os.R_OK):
return target
# Installing from wheel places data_files relative to sys.prefix and not
# site-packages. If we can not find in site-packages, check sys.prefix
# instead.
# https://python-packa... | """Use the pkg_resources API to extract resources.
This will extract into a temporary file in case the egg is compressed.
Args:
package: name of the package (e.g. rekall-core, rekall-gui).
filename: The filename inside the package.
prefix: The sub-directory in the source distribution whi... | 58 | 663 | 189 | 852 | #!/usr/bin/env python
# Rekall
# Copyright (C) 2012 Michael Cohen <scudette@gmail.com>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | #!/usr/bin/env python
# Rekall
# Copyright (C) 2012 Michael Cohen <scudette@gmail.com>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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... | |
36,372 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/threadpool.py | 83,84 | 75,99 | Stop | ThreadPool | 85,94 | 84,94 | class ThreadPool(object):
lock = threading.Lock()
def __init__(self, number_of_threads):
self.number_of_threads = number_of_threads
self.queue = queue.Queue(2 * number_of_threads)
self.workers = [Worker(self.queue) for _ in range(number_of_threads)]
def Stop(self):
FILL_FUNC_BODY ... | class ThreadPool(object):
lock = threading.Lock()
def __init__(self, number_of_threads):
self.number_of_threads = number_of_threads
self.queue = queue.Queue(2 * number_of_threads)
self.workers = [Worker(self.queue) for _ in range(number_of_threads)]
def Stop(self):
"""Stop ... | self.queue.join()
# Send all workers the stop message.
for worker in self.workers:
self.AddTask(None)
for worker in self.workers:
worker.join()
| """Stop all the threads when they are ready."""
self.queue.join()
# Send all workers the stop message.
for worker in self.workers:
self.AddTask(None)
for worker in self.workers:
worker.join()
| 18 | 198 | 65 | 263 | from __future__ import print_function
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
# Copyright (c) 2012
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | from __future__ import print_function
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
# Copyright (c) 2012
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... |
36,373 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/threadpool.py | 50,51 | 36,75 | run | Worker | 51,75 | 51,75 | class Worker(threading.Thread):
"""A Threadpool worker.
Reads jobs from the queue and runs them. Quits when a None job is received
on the queue.
"""
def __init__(self, queue):
super(Worker, self).__init__()
self.queue = queue
self.daemon = True
# Start the thread im... | class Worker(threading.Thread):
"""A Threadpool worker.
Reads jobs from the queue and runs them. Quits when a None job is received
on the queue.
"""
def __init__(self, queue):
super(Worker, self).__init__()
self.queue = queue
self.daemon = True
# Start the thread im... | while True:
# Get a callable from the queue.
task, args, kwargs = self.queue.get()
try:
# Stop the worker by sending it a task of None.
if task is None:
break
on_error = kwargs.pop("on_error")
... | while True:
# Get a callable from the queue.
task, args, kwargs = self.queue.get()
try:
# Stop the worker by sending it a task of None.
if task is None:
break
on_error = kwargs.pop("on_error")
... | 58 | 118 | 193 | 311 | from __future__ import print_function
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
# Copyright (c) 2012
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | from __future__ import print_function
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
# Copyright (c) 2012
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... |
36,375 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/ui/identity.py | 74,75 | 28,84 | table_row | IdentityRenderer | 75,82 | 75,82 | class IdentityRenderer(renderer_module.BaseRenderer):
columns = None
plugin_name = None
rows = None
def __init__(self, *_, **kwargs):
super(IdentityRenderer, self).__init__(session=kwargs.get("session"))
self.rows = []
self.delegated_renderer = self.session.GetRenderer()
de... | class IdentityRenderer(renderer_module.BaseRenderer):
columns = None
plugin_name = None
rows = None
def __init__(self, *_, **kwargs):
super(IdentityRenderer, self).__init__(session=kwargs.get("session"))
self.rows = []
self.delegated_renderer = self.session.GetRenderer()
de... | row = dict()
for idx, value in enumerate(values):
name = self._get_column_name(idx)
row[name] = value
self.rows.append(row)
| row = dict()
for idx, value in enumerate(values):
name = self._get_column_name(idx)
row[name] = value
self.rows.append(row)
| 15 | 434 | 59 | 493 | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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, ... | # Rekall Memory Forensics
# Copyright (C) 2012 Michael Cohen
# Copyright 2014 Google Inc. All Rights Reserved.
#
# 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, ... |
36,376 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/rekall/ui/text_test.py | 8,9 | 6,42 | testNesting | CellTest | 9,34 | 9,34 | class CellTest(testlib.RekallBaseUnitTestCase):
def testNesting(self):
FILL_FUNC_BODY def testColors(self):
# Invisible characters shouldn't affect reported width.
c1 = text.Cell(value="Hello, world!", highlights=[(0, 6, "RED", None)])
self.assertEqual(c1.width, 13)
def testPreserve... | class CellTest(testlib.RekallBaseUnitTestCase):
def testNesting(self):
FILL_FUNC_BODY def testColors(self):
# Invisible characters shouldn't affect reported width.
c1 = text.Cell(value="Hello, world!", highlights=[(0, 6, "RED", None)])
self.assertEqual(c1.width, 13)
def testPreserve... | c1 = text.Cell(value="Hello, world!", width=6, align="r")
self.assertEqual(c1.lines, ["Hello,", "world!"])
c1.rewrap(width=7)
self.assertEqual(c1.lines, [" Hello,", " world!"])
c1.rewrap(align="l")
self.assertEqual(c1.lines, ["Hello, ", "world! "])
c2 = text.Cell... | c1 = text.Cell(value="Hello, world!", width=6, align="r")
self.assertEqual(c1.lines, ["Hello,", "world!"])
c1.rewrap(width=7)
self.assertEqual(c1.lines, [" Hello,", " world!"])
c1.rewrap(align="l")
self.assertEqual(c1.lines, ["Hello, ", "world! "])
c2 = text.Cell... | 97 | 152 | 409 | 561 | from rekall import testlib
from rekall.ui import text
class CellTest(testlib.RekallBaseUnitTestCase):
def testNesting(self):
FILL_FUNC_BODY def testColors(self):
# Invisible characters shouldn't affect reported width.
c1 = text.Cell(value="Hello, world!", highlights=[(0, 6, "RED", None)])
... | from rekall import testlib
from rekall.ui import text
class CellTest(testlib.RekallBaseUnitTestCase):
def testNesting(self):
FILL_FUNC_BODY def testColors(self):
# Invisible characters shouldn't affect reported width.
c1 = text.Cell(value="Hello, world!", highlights=[(0, 6, "RED", None)])
... |
36,377 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/setup.py | 41,42 | 1,185 | find_data_files | 42,54 | 42,54 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
# These versions are fixed to the exact tested configuration. Prior to release,
# please use "setup.py pip_upgrade" to test with the ... | result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
# These versions are fixed to the exact tested configuration. Prior to release,
# please use "setup.py pip_upgrade" to test with the ... | 70 | 1,635 | 134 | 1,769 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | |
36,378 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/setup.py | 135,136 | 124,142 | run | CleanCommand | 136,142 | 136,142 | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
FILL_FUNC_BODY | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
FILL_FUNC_BODY | if os.getcwd() != self.cwd:
raise RuntimeError('Must be in package root: %s' % self.cwd)
os.system('rm -rf ./build ./dist')
| if os.getcwd() != self.cwd:
raise RuntimeError('Must be in package root: %s' % self.cwd)
os.system('rm -rf ./build ./dist')
| 17 | 95 | 60 | 155 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... |
36,379 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-core/setup.py | 103,104 | 93,124 | run | PIPUpgrade | 104,124 | 104,124 | class PIPUpgrade(Command):
description = "Upgrade all the dependencies in the current virtualenv."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
FILL_FUNC_BODY | class PIPUpgrade(Command):
description = "Upgrade all the dependencies in the current virtualenv."
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
FILL_FUNC_BODY | required = [x.split()[0] for x in install_requires]
output = subprocess.check_output(
["pip", "install", "--upgrade"] + required)
# Print the current versions.
output = subprocess.check_output(
["pip", "freeze"], errors="ignore")
result = []
for ... | required = [x.split()[0] for x in install_requires]
output = subprocess.check_output(
["pip", "install", "--upgrade"] + required)
# Print the current versions.
output = subprocess.check_output(
["pip", "freeze"], errors="ignore")
result = []
for ... | 48 | 77 | 169 | 246 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... |
36,380 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-gui/_version.py | 76,77 | 1,105 | tag_version_data | 77,105 | 77,105 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | current_hash = get_current_git_hash()
# Not in a git repository.
if current_hash is None:
version_data["error"] = "Not in a git repository."
else:
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_sin... | current_hash = get_current_git_hash()
# Not in a git repository.
if current_hash is None:
version_data["error"] = "Not in a git repository."
else:
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_sin... | 97 | 791 | 371 | 1,162 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | |
36,381 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-gui/manuskript/shell.py | 37,38 | 26,46 | Exec | Shell | 38,46 | 38,46 | class Shell(object):
"""Implementation of a shell cell."""
def __init__(self, global_context=None, local_context=None,
filename="<unknown>"):
super(Shell, self).__init__()
self.global_context = global_context or {}
self.local_context = local_context or {}
self.f... | class Shell(object):
"""Implementation of a shell cell."""
def __init__(self, global_context=None, local_context=None,
filename="<unknown>"):
super(Shell, self).__init__()
self.global_context = global_context or {}
self.local_context = local_context or {}
self.f... | self.execution_count += 1
process = subprocess.Popen(
["bash"], stdout=subprocess.PIPE, cwd=cwd,
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
result = process.communicate(source)
return result[0], result[1], str(process.returncode)
| self.execution_count += 1
process = subprocess.Popen(
["bash"], stdout=subprocess.PIPE, cwd=cwd,
stderr=subprocess.PIPE, stdin=subprocess.PIPE)
result = process.communicate(source)
return result[0], result[1], str(process.returncode)
| 18 | 126 | 98 | 224 | import subprocess
class Error(Exception):
"""shell-specific error."""
class ParseError(Error):
"""Thrown when supplied code can't be parsed."""
def __init__(self, original_error):
super(ParseError, self).__init__()
self.original_error = original_error
class ExecError(Error):
"""Th... | import subprocess
class Error(Exception):
"""shell-specific error."""
class ParseError(Error):
"""Thrown when supplied code can't be parsed."""
def __init__(self, original_error):
super(ParseError, self).__init__()
self.original_error = original_error
class ExecError(Error):
"""Th... |
36,382 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-gui/setup.py | 35,36 | 1,101 | find_data_files_directory | 36,43 | 36,43 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| 21 | 936 | 62 | 998 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | |
36,383 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-gui/setup.py | 66,67 | 58,73 | run | CleanCommand | 67,73 | 67,73 | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
FILL_FUNC_BODY | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
self.cwd = os.getcwd()
def run(self):
FILL_FUNC_BODY | if os.getcwd() != self.cwd:
raise RuntimeError('Must be in package root: %s' % self.cwd)
os.system('rm -rf ./build ./dist')
| if os.getcwd() != self.cwd:
raise RuntimeError('Must be in package root: %s' % self.cwd)
os.system('rm -rf ./build ./dist')
| 17 | 92 | 60 | 152 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... |
36,384 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/_version.py | 67,68 | 1,105 | get_current_git_hash | 68,76 | 68,76 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | try:
return subprocess.check_output(
["git", "log", "--no-merges", "-n", "1", "--pretty=format:%H"],
stderr=subprocess.PIPE, cwd=MY_DIR,
).strip()
except (OSError, subprocess.CalledProcessError):
return None
| try:
return subprocess.check_output(
["git", "log", "--no-merges", "-n", "1", "--pretty=format:%H"],
stderr=subprocess.PIPE, cwd=MY_DIR,
).strip()
except (OSError, subprocess.CalledProcessError):
return None
| 17 | 1,046 | 96 | 1,142 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | |
36,385 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/collections.py | 82,83 | 59,96 | insert | CollectionSpec | 84,86 | 83,86 | class CollectionSpec(serializer.SerializedObject):
"""A Collection specification.
This is used as the base class for all collections.
"""
# Define tables inline for extended collections.
_tables = None
schema = [
# Allow the collection to specify its name.
dict(name="id",
... | class CollectionSpec(serializer.SerializedObject):
"""A Collection specification.
This is used as the base class for all collections.
"""
# Define tables inline for extended collections.
_tables = None
schema = [
# Allow the collection to specify its name.
dict(name="id",
... | raise NotImplementedError()
| """Insert a row into the collection."""
raise NotImplementedError()
| 2 | 268 | 12 | 280 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen scudette@google.com
#
# 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... |
36,386 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/location.py | 39,40 | 34,43 | read_file | DevNull | 40,43 | 40,43 | class DevNull(Location):
"""Just swallow all data."""
def write_file(self, data):
pass
def read_file(self):
FILL_FUNC_BODY | class DevNull(Location):
"""Just swallow all data."""
def write_file(self, data):
pass
def read_file(self):
FILL_FUNC_BODY | return ""
| return ""
| 2 | 50 | 9 | 59 | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... |
36,387 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/location.py | 22,23 | 16,34 | to_path | Location | 23,25 | 23,25 | class Location(serializer.SerializedObject):
"""A type specifying a location to upload/download files."""
# This one object can represent a number of location types.
schema = []
def to_path(self):
FILL_FUNC_BODY def read_file(self):
"""Gets the contents of location as a string."""
r... | class Location(serializer.SerializedObject):
"""A type specifying a location to upload/download files."""
# This one object can represent a number of location types.
schema = []
def to_path(self):
FILL_FUNC_BODY def read_file(self):
"""Gets the contents of location as a string."""
r... | return ""
| return ""
| 2 | 130 | 7 | 137 | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... |
36,388 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/location.py | 130,131 | 127,136 | Start | NotificationLocation | 135,136 | 131,136 | class NotificationLocation(HTTPLocation):
"""A location which notifies when it changes."""
def Start(self, callback):
FILL_FUNC_BODY | class NotificationLocation(HTTPLocation):
"""A location which notifies when it changes."""
def Start(self, callback):
"""Start the loop. Never returns.
callback is called with each notification.
"""
FILL_FUNC_BODY | raise NotImplementedError()
| """Start the loop. Never returns.
callback is called with each notification.
"""
raise NotImplementedError()
| 2 | 64 | 10 | 74 | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
return self.code == 200
class Location(serializer.Seria... |
36,389 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/location.py | 12,13 | 5,16 | ok | Status | 13,16 | 13,16 | class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
FILL_FUNC_BODY | class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
FILL_FUNC_BODY | return self.code == 200
| return self.code == 200
| 4 | 69 | 15 | 84 | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
FILL_FUNC_BODYclass Location(serializer.SerializedObject):
""... | from builtins import object
from rekall_lib import serializer
class Status(object):
"""Represents the status of a network operation."""
def __init__(self, code=200, data=""):
self.code = code
self.data = data
def ok(self):
FILL_FUNC_BODYclass Location(serializer.SerializedObject):
""... |
36,390 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/resources.py | 31,32 | 25,34 | check | Quota | 33,34 | 32,34 | class Quota(Resources):
schema = [
dict(name="used", type=Resources,
doc="The resources actually used."),
]
def check(self):
FILL_FUNC_BODY | class Quota(Resources):
schema = [
dict(name="used", type=Resources,
doc="The resources actually used."),
]
def check(self):
"""Ensure our resource use does not exceed the quota."""
FILL_FUNC_BODY | raise NotImplementedError()
| """Ensure our resource use does not exceed the quota."""
raise NotImplementedError()
| 2 | 72 | 10 | 82 | from rekall_lib import serializer
class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
... | from rekall_lib import serializer
class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
... |
36,391 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/rekall_lib/rekall_types/resources.py | 13,14 | 4,25 | start | Resources | 15,17 | 14,17 | class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
def start(self):
FILL_FUNC_BODY... | class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
def start(self):
"""Res... | raise NotImplementedError()
| """Reset internal resource counters and start measuring."""
raise NotImplementedError()
| 2 | 167 | 12 | 179 | from rekall_lib import serializer
class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
... | from rekall_lib import serializer
class Resources(serializer.SerializedObject):
"""Measure resource usage."""
schema = [
dict(name="user_time", type="float", default=60.0),
dict(name="system_time", type="float", default=60.0),
dict(name="wall_time", type="float", default=60.0),
]
... |
36,392 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/setup.py | 35,36 | 1,97 | find_data_files | 36,43 | 36,43 | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... | result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| 21 | 888 | 62 | 950 | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... | |
36,393 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/rekall-lib/setup.py | 61,62 | 55,69 | finalize_options | CleanCommand | 62,63 | 62,63 | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
FILL_FUNC_BODY def run(self):
if os.getcwd() != self.cwd... | class CleanCommand(Command):
description = ("custom clean command that forcefully removes "
"dist/build directories")
user_options = []
def initialize_options(self):
self.cwd = None
def finalize_options(self):
FILL_FUNC_BODY def run(self):
if os.getcwd() != self.cwd... | self.cwd = os.getcwd()
| self.cwd = os.getcwd()
| 3 | 132 | 14 | 146 | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... | #!/usr/bin/env python
# Rekall
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.com>
#
# 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 vers... |
36,394 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/setup.py | 81,82 | 1,134 | find_data_files | 82,90 | 82,90 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| result = []
for directory, _, files in os.walk(source):
files = [os.path.join(directory, x) for x in files]
result.append((directory, files))
return result
| 21 | 1,214 | 64 | 1,278 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | |
36,395 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/setup.py | 68,69 | 67,81 | run | develop | 69,81 | 69,81 | class develop(_develop):
def run(self):
FILL_FUNC_BODY | class develop(_develop):
def run(self):
FILL_FUNC_BODY | path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py"))
if os.access(path, os.F_OK):
print("Installing rekall-core from local directory.")
subprocess.check_call([sys.executable, "setup.py", "develop"],
... | path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py"))
if os.access(path, os.F_OK):
print("Installing rekall-core from local directory.")
subprocess.check_call([sys.executable, "setup.py", "develop"],
... | 19 | 23 | 132 | 155 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... |
36,396 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/setup.py | 52,53 | 51,67 | do_egg_install | install | 53,67 | 53,67 | class install(_install):
def do_egg_install(self):
FILL_FUNC_BODY | class install(_install):
def do_egg_install(self):
FILL_FUNC_BODY | path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py"))
if os.access(path, os.F_OK):
print("Installing rekall-core from local directory.")
subprocess.check_call([sys.executable, "setup.py", "install"],
... | path = os.path.abspath(
os.path.join(os.path.dirname(__file__), "rekall-core", "setup.py"))
if os.access(path, os.F_OK):
print("Installing rekall-core from local directory.")
subprocess.check_call([sys.executable, "setup.py", "install"],
... | 38 | 28 | 166 | 194 | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... | #!/usr/bin/env python
# Rekall
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@gmail.com>
#
# 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 versi... |
36,397 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/installers/fix_deps.py | 16,17 | 1,35 | load_pycryptodome_raw_lib | 17,34 | 17,34 | """Patch Rekall's dependencies.
This file patches some of Rekall's dependencies which are not
pyinstaller friendly. Typically the problems are that these
dependencies use __file__ to try to locate their dlls but this
variable does not exist when running from inside a pyinstaller bundle.
"""
from Crypto.Util import _r... | """Patch Rekall's dependencies.
This file patches some of Rekall's dependencies which are not
pyinstaller friendly. Typically the problems are that these
dependencies use __file__ to try to locate their dlls but this
variable does not exist when running from inside a pyinstaller bundle.
"""
from Crypto.Util import _r... | for ext in _raw_api.extension_suffixes:
try:
# On OSX, Pyinstaller copies the module into the root as
# eg Crypto.Cipher._Salsa20.so. Unfortunately this may
# clash with other modules of the same name. For example,
# Crypto.Hash._SHA256.so clashes with the sta... | for ext in _raw_api.extension_suffixes:
try:
# On OSX, Pyinstaller copies the module into the root as
# eg Crypto.Cipher._Salsa20.so. Unfortunately this may
# clash with other modules of the same name. For example,
# Crypto.Hash._SHA256.so clashes with the sta... | 74 | 190 | 209 | 399 | """Patch Rekall's dependencies.
This file patches some of Rekall's dependencies which are not
pyinstaller friendly. Typically the problems are that these
dependencies use __file__ to try to locate their dlls but this
variable does not exist when running from inside a pyinstaller bundle.
"""
from Crypto.Util import _r... | """Patch Rekall's dependencies.
This file patches some of Rekall's dependencies which are not
pyinstaller friendly. Typically the problems are that these
dependencies use __file__ to try to locate their dlls but this
variable does not exist when running from inside a pyinstaller bundle.
"""
from Crypto.Util import _r... | |
36,398 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/_version.py | 76,77 | 1,105 | tag_version_data | 77,105 | 77,105 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | current_hash = get_current_git_hash()
# Not in a git repository.
if current_hash is None:
version_data["error"] = "Not in a git repository."
else:
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_sin... | current_hash = get_current_git_hash()
# Not in a git repository.
if current_hash is None:
version_data["error"] = "Not in a git repository."
else:
version_data["revisionid"] = current_hash
version_data["dirty"] = is_tree_dirty()
version_data["dev"] = number_of_commit_sin... | 97 | 791 | 371 | 1,162 |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... |
# Machine Generated - do not edit!
# This file is produced when the main "version.py update" command is run. That
# command copies this file to all sub-packages which contain
# setup.py. Configuration is maintain in version.yaml at the project's top
# level.
def get_versions():
return tag_version_data(raw_versio... | |
36,399 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/builtins/functions_test.py | 114,115 | 34,164 | test_get_type_independent_functions_with_equal | TestGet64BitFunctions | 115,120 | 115,120 | class TestGet64BitFunctions(unittest.TestCase):
def setUp(self):
self.functions = functions.get_arithmetic_functions()
self.evaluator = lambda x: x
def test_get_type_independent_functions_with_unary_plus(self):
actual = self.functions['+'](self.evaluator, 42)
self.assertEqual(a... | class TestGet64BitFunctions(unittest.TestCase):
def setUp(self):
self.functions = functions.get_arithmetic_functions()
self.evaluator = lambda x: x
def test_get_type_independent_functions_with_unary_plus(self):
actual = self.functions['+'](self.evaluator, 42)
self.assertEqual(a... | equal = self.functions['==']
self.assertEqual(equal(self.evaluator, 4, 5), False)
self.assertEqual(equal(self.evaluator, 5, 4), False)
self.assertEqual(equal(self.evaluator, 4, 4), True)
| equal = self.functions['==']
self.assertEqual(equal(self.evaluator, 4, 5), False)
self.assertEqual(equal(self.evaluator, 5, 4), False)
self.assertEqual(equal(self.evaluator, 4, 4), True)
| 15 | 1,882 | 79 | 1,961 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,401 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/builtins/gcc_constants.py | 31,32 | 1,87 | get_x86_64_kernel_compile_object_likes | 32,87 | 32,87 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | return {
'__STDC__': pre_ast.DefineObjectLike(
name='__STDC__',
replacement='1',
),
'__STDC_VERSION__': pre_ast.DefineObjectLike(
name='__STDC_VERSION__',
replacement='201112L',
),
'_XOPEN_SOURCE': pre_ast.DefineObjectLike(
... | return {
'__STDC__': pre_ast.DefineObjectLike(
name='__STDC__',
replacement='1',
),
'__STDC_VERSION__': pre_ast.DefineObjectLike(
name='__STDC_VERSION__',
replacement='201112L',
),
'_XOPEN_SOURCE': pre_ast.DefineObjectLike(
... | 67 | 320 | 589 | 909 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | |
36,402 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/c_ast/visitor_mixin.py | 32,33 | 1,136 | camel_case_to_lower_underscore | 33,38 | 33,38 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | # Taken from StackOverflow.
s1 = re.sub('([^_])([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
| # Taken from StackOverflow.
s1 = re.sub('([^_])([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
| 13 | 1,096 | 84 | 1,180 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | |
36,403 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/c_ast/visitor_mixin.py | 86,87 | 73,136 | visit_c_type_definition | CASTVisitorWalker | 87,89 | 87,89 | class CASTVisitorWalker(object):
"""A base class for visitors of c_ast objects.
Implements all the common methods to visit the AST.
"""
def visit(self, node):
return node.accept(self)
def visit_c_program(self, program):
for element in program.content:
element.accept(se... | class CASTVisitorWalker(object):
"""A base class for visitors of c_ast objects.
Implements all the common methods to visit the AST.
"""
def visit(self, node):
return node.accept(self)
def visit_c_program(self, program):
for element in program.content:
element.accept(se... | type.type_definition.accept(self)
| type.type_definition.accept(self)
| 1 | 476 | 15 | 491 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,404 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/c_ast/visitor_mixin.py | 45,46 | 38,73 | accept | VisitorMixin | 62,73 | 46,73 | class VisitorMixin(object):
"""A mixin that provides Visitor Pattern.
This is mixed into AST node to provide visitor pattern. Used in both ASTs.
"""
def accept(self, visitor, *args, **kwargs):
FILL_FUNC_BODY | class VisitorMixin(object):
"""A mixin that provides Visitor Pattern.
This is mixed into AST node to provide visitor pattern. Used in both ASTs.
"""
def accept(self, visitor, *args, **kwargs):
"""Accepts a visitor from Visitor Pattern.
Args:
visitor: a visitor with .visit_C... | lower_underscore_cls_name = camel_case_to_lower_underscore(
self.__class__.__name__,
)
visitor_method_name = 'visit_' + lower_underscore_cls_name
visitor_method = getattr(visitor, visitor_method_name)
result = visitor_method(self, *args, **kwargs)
#print("%s:... | """Accepts a visitor from Visitor Pattern.
Args:
visitor: a visitor with .visit_CLASSNAME(type_reference_node) method
where CLASSNAME is the name of a visited class.
*args: additional positional arguments to be passed to the visitor
call.
**kwarg... | 26 | 184 | 131 | 315 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,405 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/common/data_container_test.py | 85,86 | 33,153 | test_setattr_and_getattr_state_with_new_field | TestDataContainer | 86,98 | 86,98 | class TestDataContainer(unittest.TestCase):
def test_getattr_with_fields(self):
data_container = data_container_module.DataContainer(
field1='value1',
field2=42,
)
self.assertEqual(data_container.field1, 'value1')
self.assertEqual(data_container.field2, 42)
... | class TestDataContainer(unittest.TestCase):
def test_getattr_with_fields(self):
data_container = data_container_module.DataContainer(
field1='value1',
field2=42,
)
self.assertEqual(data_container.field1, 'value1')
self.assertEqual(data_container.field2, 42)
... | data_container = data_container_module.DataContainer(
field1='value1',
field2=42,
)
data_container.field3 = 33
expected = {
'field1': 'value1',
'field2': 42,
'field3': 33,
}
self.assertEqual(data_container.state,... | data_container = data_container_module.DataContainer(
field1='value1',
field2=42,
)
data_container.field3 = 33
expected = {
'field1': 'value1',
'field2': 42,
'field3': 33,
}
self.assertEqual(data_container.state,... | 21 | 1,122 | 111 | 1,233 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,406 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/config_parser/config_parser.py | 42,43 | 33,87 | parse | ConfigParser | 55,67 | 43,67 | class ConfigParser(object):
"""A class for parsing Linux kernel .config files."""
def __init__(self):
flag = r'(?P<flag>\w+)'
value = r'(?P<value>[^\n]*)'
self._flag_and_value_regex = re.compile(
r'^' + flag + r'=' + value + r'$')
def parse(self, config):
FILL_FUNC_BODY... | class ConfigParser(object):
"""A class for parsing Linux kernel .config files."""
def __init__(self):
flag = r'(?P<flag>\w+)'
value = r'(?P<value>[^\n]*)'
self._flag_and_value_regex = re.compile(
r'^' + flag + r'=' + value + r'$')
def parse(self, config):
"""A m... | flags = {}
for line in config.split('\n'):
match = self._flag_and_value_regex.match(line)
if match:
self._process_flag_and_value_line(line, match, flags)
elif not line or line.isspace() or line[0] == '#':
pass
else:
... | """A method for parsing Linux kernel .config files.
Args:
config: a string with the content of a Linux kernel .config file.
Returns:
A dict from flag names to flag values for the defined flags.
Raises:
UnknownConfigLineFormatException: raised when the lin... | 30 | 422 | 116 | 538 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,407 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/config_parser/config_parser_test.py | 74,75 | 33,150 | test_parse_with_hexadecimal_integer_flag | TestConfigParser | 75,82 | 75,82 | class TestConfigParser(unittest.TestCase):
def setUp(self):
self.parser = config_parser.ConfigParser()
def test_parse_with_empty_config(self):
config = ''
actual = self.parser.parse(config)
expected = {}
self.assertEqual(actual, expected)
def test_parse_with_whites... | class TestConfigParser(unittest.TestCase):
def setUp(self):
self.parser = config_parser.ConfigParser()
def test_parse_with_empty_config(self):
config = ''
actual = self.parser.parse(config)
expected = {}
self.assertEqual(actual, expected)
def test_parse_with_whites... | config = 'CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000'
actual = self.parser.parse(config)
expected = {
'CONFIG_ILLEGAL_POINTER_VALUE': c_ast.CNumber(0xdead000000000000),
}
self.assertEqual(actual, expected)
| config = 'CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000'
actual = self.parser.parse(config)
expected = {
'CONFIG_ILLEGAL_POINTER_VALUE': c_ast.CNumber(0xdead000000000000),
}
self.assertEqual(actual, expected)
| 14 | 1,132 | 109 | 1,241 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,408 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/layout/layout_to_vtype_converter.py | 36,37 | 29,69 | to_vtype | LayoutToVTypeConverter | 37,46 | 37,46 | class LayoutToVTypeConverter(object):
"""A class representing a converter from layout to vtype format."""
def __init__(self, type_description_visitor):
self._type_description_visitor = type_description_visitor
def to_vtype(self, layout, type_definition, types):
FILL_FUNC_BODY def _get_type_des... | class LayoutToVTypeConverter(object):
"""A class representing a converter from layout to vtype format."""
def __init__(self, type_description_visitor):
self._type_description_visitor = type_description_visitor
def to_vtype(self, layout, type_definition, types):
FILL_FUNC_BODY def _get_type_des... | byte_size = layout.bit_size // 8
fields = {}
for field_layout, field in zip(layout.fields, type_definition.content):
byte_offset = field_layout.bit_offset // 8
type_description = self._get_type_description(
field_layout, field, types)
fields[fi... | byte_size = layout.bit_size // 8
fields = {}
for field_layout, field in zip(layout.fields, type_definition.content):
byte_offset = field_layout.bit_offset // 8
type_description = self._get_type_description(
field_layout, field, types)
fields[fi... | 32 | 319 | 120 | 439 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... |
36,409 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/parsers/trimming_parser.py | 109,110 | 1,176 | build_snippets | 119,176 | 110,176 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | type_manager = type_manager_module.TypeManager()
pyparsing.ParserElement.disablePackrat() # Packrat caching slows us down
# here.
context = {}
# We store global constants here (e.g. from enums). This is required because
# enum field names are global and un-typed and may be used by any struct... | """Builds a snippets dict.
Args:
c_file_text: The text of the pre-processed C file to use.
Returns:
a dict with keys being the name of the type defined in each snippet and
value being the snippet itself.
"""
type_manager = type_manager_module.TypeManager()
pyparsing.ParserE... | 215 | 1,174 | 715 | 1,889 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | |
36,410 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_loader/preprocessing_loader_test.py | 39,40 | 32,51 | _get_file_content | MockPreprocessingLoader | 40,47 | 40,47 | class MockPreprocessingLoader(preprocessing_loader.PreprocessingLoader):
# A lookup between file name and file contents.
def __init__(self, *args, **kwargs):
super(MockPreprocessingLoader, self).__init__(*args, **kwargs)
self.mock_files = {}
self.mock_opened_files = []
def _get_file... | class MockPreprocessingLoader(preprocessing_loader.PreprocessingLoader):
# A lookup between file name and file contents.
def __init__(self, *args, **kwargs):
super(MockPreprocessingLoader, self).__init__(*args, **kwargs)
self.mock_files = {}
self.mock_opened_files = []
def _get_file... | self.mock_opened_files.append(file_path)
content = self.mock_files.get(file_path)
if content is None:
raise IOError()
return content
| self.mock_opened_files.append(file_path)
content = self.mock_files.get(file_path)
if content is None:
raise IOError()
return content
| 12 | 138 | 59 | 197 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,411 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_loader/preprocessing_loader_test.py | 64,65 | 51,154 | test_load_with_quoted_include_in_the_same_directory | TestPreprocessingLoader | 65,93 | 65,93 | class TestPreprocessingLoader(unittest.TestCase):
def setUp(self):
self.preprocessing_loader = MockPreprocessingLoader([])
def test_load_with_file_with_no_includes(self):
self.preprocessing_loader.mock_files = {
'dir_1/file_1': '',
}
self.preprocessing_loader.load(f... | class TestPreprocessingLoader(unittest.TestCase):
def setUp(self):
self.preprocessing_loader = MockPreprocessingLoader([])
def test_load_with_file_with_no_includes(self):
self.preprocessing_loader.mock_files = {
'dir_1/file_1': '',
}
self.preprocessing_loader.load(f... | self.preprocessing_loader.include_directories = [
'dir_5',
'dir_6',
]
self.preprocessing_loader.mock_files = {
'dir_1/dir_2/file_1': '''
#include "../dir_3/file_2"
#include "../dir_4/file_3"
#include "file_4"
''',
'd... | self.preprocessing_loader.include_directories = [
'dir_5',
'dir_6',
]
self.preprocessing_loader.mock_files = {
'dir_1/dir_2/file_1': '''
#include "../dir_3/file_2"
#include "../dir_4/file_3"
#include "file_4"
''',
'd... | 60 | 852 | 379 | 1,231 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
36,412 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_parser/preprocessing_parser.py | 90,91 | 66,128 | _get_object_like_macros | Macros | 92,106 | 91,106 | class Macros(object):
"""A class to manage all the macros we know about."""
def __init__(self, config_flags=None):
self.config_flags = config_flags or {}
self.object_likes = {}
# Macro function_likes.
self.function_likes = {}
# Built in functions.
self.function... | class Macros(object):
"""A class to manage all the macros we know about."""
def __init__(self, config_flags=None):
self.config_flags = config_flags or {}
self.object_likes = {}
# Macro function_likes.
self.function_likes = {}
# Built in functions.
self.function... | # Add object like intrinsics from gcc.
result = gcc_constants.get_x86_64_kernel_compile_object_likes()
# Append config vars.
for flag, value in self.config_flags.iteritems():
result[flag] = pre_ast.DefineObjectLike(
name=flag,
# Macros replace... | """A function that produces object like macros from config flags."""
# Add object like intrinsics from gcc.
result = gcc_constants.get_x86_64_kernel_compile_object_likes()
# Append config vars.
for flag, value in self.config_flags.iteritems():
result[flag] = pre_ast.... | 40 | 520 | 145 | 665 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... |
36,413 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_parser/preprocessing_parser.py | 213,214 | 165,337 | pop_node | PreprocessingParser | 214,216 | 214,216 | class PreprocessingParser(object):
"""Preprocess header files and build a preprocessor AST."""
def __init__(self):
pyparsing.ParserElement.disablePackrat()
pyparsing.ParserElement.resetCache()
self._define_parser = (self._define_function_like()
| self._de... | class PreprocessingParser(object):
"""Preprocess header files and build a preprocessor AST."""
def __init__(self):
pyparsing.ParserElement.disablePackrat()
pyparsing.ParserElement.resetCache()
self._define_parser = (self._define_function_like()
| self._de... | return self.stack.pop(-1)
| return self.stack.pop(-1)
| 2 | 1,728 | 14 | 1,742 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... |
36,414 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_parser/preprocessing_parser.py | 59,60 | 47,66 | transform | Sanitizer | 60,66 | 60,66 | class Sanitizer(object):
"""Clean up source by removing problematic idioms.
Developing a more complete parser to deal with the fine edge cases is not
worth it. We transform certain rare idioms to more standard idioms.
"""
transforms = [
("gcc_header(__GNUC__)", "<linux/compiler-gcc4.h>"),
... | class Sanitizer(object):
"""Clean up source by removing problematic idioms.
Developing a more complete parser to deal with the fine edge cases is not
worth it. We transform certain rare idioms to more standard idioms.
"""
transforms = [
("gcc_header(__GNUC__)", "<linux/compiler-gcc4.h>"),
... | for source, replacement in self.transforms:
text = text.replace(source, replacement)
return text
| for source, replacement in self.transforms:
text = text.replace(source, replacement)
return text
| 11 | 130 | 37 | 167 | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... | # -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obt... |
36,415 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_visitors/include_collecting_visitor.py | 53,54 | 14,65 | visit_composite_block | IncludeCollectingVisitor | 54,56 | 54,56 | class IncludeCollectingVisitor(object):
"""A visitor class that collects all the includes from a tree."""
def collect_includes(self, node):
return node.accept(self)
def visit_file(self, file_):
return file_.content.accept(self)
def visit_include(self, include):
return [include... | class IncludeCollectingVisitor(object):
"""A visitor class that collects all the includes from a tree."""
def collect_includes(self, node):
return node.accept(self)
def visit_file(self, file_):
return file_.content.accept(self)
def visit_include(self, include):
return [include... | return self._get_results(composite_block.content)
| return self._get_results(composite_block.content)
| 2 | 385 | 19 | 404 | """A module containing a visitor that collects all the includes from a tree.
It is used to visit all the nodes of the AST to detect includes and therefore
load all files. We ignore any ifdef here because we dont have config variables
yet - so we end up with a fully expanded forest of ast for each parsed file.
"""
fro... | """A module containing a visitor that collects all the includes from a tree.
It is used to visit all the nodes of the AST to detect includes and therefore
load all files. We ignore any ifdef here because we dont have config variables
yet - so we end up with a fully expanded forest of ast for each parsed file.
"""
fro... |
36,416 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_visitors/include_linking_visitor.py | 34,35 | 14,61 | visit_define_object_like | IncludeLinkingVisitor | 35,38 | 35,38 | class IncludeLinkingVisitor(object):
"""A visitor class that links includes with their content."""
def resolve(self, node, files):
node.accept(self, files)
def visit_file(self, file_, files):
self.resolve(file_.content, files)
def visit_include(self, include, files):
include.c... | class IncludeLinkingVisitor(object):
"""A visitor class that links includes with their content."""
def resolve(self, node, files):
node.accept(self, files)
def visit_file(self, file_, files):
self.resolve(file_.content, files)
def visit_include(self, include, files):
include.c... | _ = define_object_like
_ = files
| _ = define_object_like
_ = files
| 6 | 402 | 18 | 420 | """A module containing a visitor that links includes with their content.
This visitor connects include nodes in the AST with the AST forest that we
already have - it could be done during computation but its easier to mutate
the AST to directly link each include node's AST.
"""
from __future__ import absolute_import
f... | """A module containing a visitor that links includes with their content.
This visitor connects include nodes in the AST with the AST forest that we
already have - it could be done during computation but its easier to mutate
the AST to directly link each include node's AST.
"""
from __future__ import absolute_import
f... |
36,417 | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall | /home/hieuvd/dung_repo/raw/stars_02/google_rekall/rekall/tools/layout_expert/layout_expert/preprocessing_visitors/macro_expander.py | 149,150 | 56,228 | _is_known_function | MacroParser | 150,182 | 150,182 | class MacroParser(object):
def __init__(self, macros, eval_mode=False, progress_cb=None):
self.macros = macros
self.progress_cb = progress_cb or (lambda *_: None)
self.eval_mode = eval_mode
self.frames = []
self._expression = self.expression()
self._token_replacer = _... | class MacroParser(object):
def __init__(self, macros, eval_mode=False, progress_cb=None):
self.macros = macros
self.progress_cb = progress_cb or (lambda *_: None)
self.eval_mode = eval_mode
self.frames = []
self._expression = self.expression()
self._token_replacer = _... | if tok.function == "defined":
name = tok.func_args.first
return str(int(name in self.macros.symbols))
# If the function is not known then we can not expand it.
func_definition = self.macros.function_likes.get(tok.function)
if func_definition is not None:
... | if tok.function == "defined":
name = tok.func_args.first
return str(int(name in self.macros.symbols))
# If the function is not known then we can not expand it.
func_definition = self.macros.function_likes.get(tok.function)
if func_definition is not None:
... | 131 | 1,324 | 406 | 1,730 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Google Inc. All Rights Reserved.
#
# Authors:
# Arkadiusz Socała <as277575@mimuw.edu.pl>
# Michael Cohen <scudette@google.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.