-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved handling of routine process dumps, misc bugfixes.
- Loading branch information
1 parent
d708f93
commit 62c2c5c
Showing
18 changed files
with
331 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright (C) 2010-2015 Cuckoo Foundation. | ||
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org | ||
# See the file 'docs/LICENSE' for copying permission. | ||
|
||
import os | ||
|
||
from lib.cuckoo.common.abstracts import Processing | ||
from lib.cuckoo.common.config import Config | ||
from lib.cuckoo.common.objects import File | ||
from lib.cuckoo.common.utils import convert_to_printable | ||
|
||
class ProcDump(Processing): | ||
"""ProcDump files analysis.""" | ||
|
||
def run(self): | ||
"""Run analysis. | ||
@return: list of process dumps with related information. | ||
""" | ||
self.key = "procdump" | ||
procdump_files = [] | ||
buf = self.options.get("buffer", 8192) | ||
|
||
if not os.path.exists(self.procdump_path): | ||
return None | ||
file_names = os.listdir(self.procdump_path) | ||
for file_name in file_names: | ||
file_path = os.path.join(self.procdump_path, file_name) | ||
if not os.path.isfile(file_path): | ||
continue | ||
if file_name.endswith("_info.txt"): | ||
continue | ||
with open(file_path + "_info.txt", 'r') as f: | ||
metastring = f.readline() | ||
file_info = File(file_path=file_path,guest_paths=metastring, file_name=file_name).get_all() | ||
metastrings = metastring.split(",") | ||
file_info["process_path"] = metastrings[2] | ||
file_info["module_path"] = metastrings[3] | ||
file_info["process_name"] = file_info["process_path"].split("\\")[-1] | ||
file_info["pid"] = metastrings[1] | ||
texttypes = [ | ||
"ASCII", | ||
"Windows Registry text", | ||
"XML document text", | ||
"Unicode text", | ||
] | ||
readit = False | ||
for texttype in texttypes: | ||
if texttype in file_info["type"]: | ||
readit = True | ||
break | ||
if readit: | ||
with open(file_info["path"], "r") as drop_open: | ||
filedata = drop_open.read(buf + 1) | ||
if len(filedata) > buf: | ||
file_info["data"] = convert_to_printable(filedata[:buf] + " <truncated>") | ||
else: | ||
file_info["data"] = convert_to_printable(filedata) | ||
|
||
procdump_files.append(file_info) | ||
|
||
return procdump_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.