Skip to content
This repository was archived by the owner on Oct 18, 2020. It is now read-only.

Commit 43021ce

Browse files
committed
Pre-release fixes.
* Added a file() efilter function. * Updated version script to control Debian package version. * Added osquery to the linux deb build. Run it off the system otherwise. Review URL: https://codereview.appspot.com/322480043 .
1 parent e1de106 commit 43021ce

File tree

14 files changed

+88
-37
lines changed

14 files changed

+88
-37
lines changed

debian/changelog

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,4 @@ rekall-forensic (1.7.0) RELEASED; urgency=low
33
[ Rekall Team ]
44
* Release 1.7.0 Hurricane Ridge
55

6-
-- Rekall Team <[email protected]> Fri, 4 August 2017 8:46:37 +0000
7-
8-
9-
rekall-forensic (1.6.0) RELEASED; urgency=low
10-
11-
[ Rekall Team ]
12-
* Release 1.6.0 Gotthard
13-
14-
-- Rekall Team <[email protected]> Fri, 4 November 2016 8:46:37 +0000
15-
16-
rekall-forensic (1.5.3) RELEASED; urgency=low
17-
18-
[ Rekall Team ]
19-
* Release 1.5.3 Etzel
20-
21-
-- Rekall Team <[email protected]> Wed, 10 August 2016 8:46:37 +0000
6+
-- Rekall Team <[email protected]> Mon, 7 Aug 2017 3:38:43 -0000

debian/changelog.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rekall-forensic (%(version)s) RELEASED; urgency=low
2+
3+
[ Rekall Team ]
4+
* Release %(version)s %(codename)s
5+
6+
-- Rekall Team <[email protected]> %(debian_ts)s

debian/rules

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ override_dh_strip:
88

99
override_dh_virtualenv:
1010
dh_virtualenv --python python2.7 --preinstall 'setuptools>36' --preinstall 'pip>=9.0' --preinstall 'wheel'
11+
12+
13+
override_dh_prep:
14+
echo "Copy osquery into the resources tree"
15+
cp /usr/bin/osqueryi rekall-core/resources

rekall-agent/rekall_agent/agent.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,20 +569,21 @@ def _Notify(self, event):
569569
pass
570570

571571

572-
class AgentInfo(common.AbstractAgentCommand):
572+
class SystemInfo(plugin.TypedProfileCommand, plugin.Command):
573573
"""Just emit information about the agent.
574574
575575
The output format is essentially key value pairs. This is useful for efilter
576576
queries.
577577
"""
578-
name = "agent_info"
578+
name = "system_info"
579+
mode = "mode_live"
579580

580581
table_header = [
581-
dict(name="key"),
582+
dict(name="key", width=20),
582583
dict(name="value")
583584
]
584585

585586
def collect(self):
586587
uname = UnameImpl.from_current_system(session=self.session)
587-
for k, v in uname.to_primitive().iteritems():
588+
for k, v in uname.to_primitive(with_type=False).iteritems():
588589
yield dict(key=k, value=v)

rekall-core/rekall/plugins/common/efilter_plugins/ipython.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ def pager(self, line, cell=None):
4040
if " " in line:
4141
_, line_end = line.split(" ", 1)
4242
else:
43+
# A bare pager magic with pager already set, means to clear it.
44+
if session.GetParameter("pager"):
45+
session.SetParameter("pager", None)
46+
return
47+
4348
line_end = "less"
4449

4550
session.SetParameter("pager", line_end)

rekall-core/rekall/plugins/common/efilter_plugins/search.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@
8787

8888
from efilter.protocols import applicative
8989
from efilter.protocols import associative
90-
from efilter.protocols import counted
9190
from efilter.protocols import repeated
9291
from efilter.protocols import structured
9392

9493
from rekall import obj
9594
from rekall import plugin
9695
from rekall import testlib
96+
from rekall.plugins.response import common
9797
from rekall.plugins.overlays import basic
9898
from rekall.plugins.common.efilter_plugins import helpers
9999
from rekall.ui import identity as identity_renderer
@@ -443,6 +443,14 @@ def _get_scopes(self):
443443
scopes["timestamp"] = api.user_func(
444444
lambda x, **_: basic.UnixTimeStamp(value=x, session=self.session),
445445
arg_types=[float, int, long])
446+
447+
# This function is used to indicate that the string represents
448+
# a filename. This will cause the agent to upload it if the
449+
# user requested uploading files.
450+
# > select file(path.filename.name).filename.name from glob("/*")
451+
scopes["file"] = api.user_func(
452+
lambda x: common.FileInformation(session=self.session, filename=x),
453+
arg_types=[unicode, str])
446454
return scopes
447455

448456
# IStructured implementation for EFILTER:

rekall-core/rekall/plugins/overlays/basic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ def v(self, vm=None):
8686
vm = vm or self.obj_vm
8787
data = vm.read(self.obj_offset, length)
8888
if self.term is not None:
89-
left, sep, _ = data.partition(self.term)
90-
data = left + sep
89+
try:
90+
left, sep, _ = data.partition(self.term)
91+
data = left + sep
92+
# We can not split it, just return the full length.
93+
except ValueError:
94+
pass
9195

9296
return data
9397

rekall-core/rekall/plugins/response/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def __init__(self, filename, filesystem=u"API", path_sep=None):
8989
self.path_sep = path_sep or self.default_path_sep
9090

9191
else:
92-
raise TypeError("Filename must be a string or file spec.")
92+
raise TypeError("Filename must be a string or file spec not %s." % type(
93+
filename))
9394

9495
@property
9596
def dirname(self):

rekall-core/rekall/plugins/response/files.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class IRStat(common.AbstractIRCommandPlugin):
6969

7070
__args = [
7171
dict(name="paths", positional=True, type="Array",
72-
help="Paths to hash."),
72+
help="Paths to stat."),
7373
]
7474

7575
table_header = [
@@ -123,8 +123,10 @@ def calculate_hashes(self, hashes, file_info):
123123
for hasher in hashers.values():
124124
hasher.update(data)
125125

126-
return [Hash(type=name, value=hasher.digest())
127-
for name, hasher in hashers.iteritems()]
126+
for key in list(hashers):
127+
hashers[key] = hashers[key].hexdigest()
128+
129+
return hashers
128130

129131
def collect(self):
130132
for path in self.plugin_args.paths:

rekall-core/rekall/plugins/response/osquery.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
import platform
3636
import subprocess
3737

38+
from distutils import spawn
39+
40+
from rekall import plugin
3841
from rekall import resources
3942
from rekall.plugins.response import common
4043

@@ -70,6 +73,10 @@ def try_to_find_osquery(self):
7073
if os.access(result, os.R_OK):
7174
return result
7275

76+
else:
77+
# Try to find it somewhere on the system.
78+
return spawn.find_executable("osqueryi")
79+
7380
raise e
7481

7582
def render(self, renderer):
@@ -79,6 +86,9 @@ def render(self, renderer):
7986
if osquery_path == None:
8087
osquery_path = self.try_to_find_osquery()
8188

89+
if not self.plugin_args.query:
90+
raise plugin.PluginError("Query must be provided")
91+
8292
self.session.logging.debug("Found OSQuery at %s" % osquery_path)
8393
self.json_result = json.loads(
8494
subprocess.check_output(

0 commit comments

Comments
 (0)