forked from brad-sp/cuckoo-modified
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request brad-sp#273 from doomedraven/patch-6
Office publisher package :)
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 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
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,55 @@ | ||
# 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. | ||
|
||
from lib.common.abstracts import Package | ||
|
||
from _winreg import (OpenKey, CreateKeyEx, SetValueEx, CloseKey, QueryInfoKey, EnumKey, | ||
EnumValue, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, KEY_SET_VALUE, KEY_READ, | ||
REG_SZ, REG_DWORD) | ||
|
||
class PUB(Package): | ||
"""Word analysis package.""" | ||
PATHS = [ | ||
("ProgramFiles", "Microsoft Office", "MSPUB.EXE"), | ||
("ProgramFiles", "Microsoft Office", "Office*", "MSPUB.EXE"), | ||
("ProgramFiles", "Microsoft Office*", "root", "Office*", "MSPUB.EXE"), | ||
("ProgramFiles", "Microsoft Office", "MSPUB.EXE"), | ||
] | ||
|
||
def set_keys(self): | ||
|
||
baseOfficeKeyPath = r"Software\Microsoft\Office" | ||
installedVersions = list() | ||
try: | ||
officeKey = OpenKey(HKEY_CURRENT_USER, baseOfficeKeyPath, 0, KEY_READ) | ||
for currentKey in xrange(0, QueryInfoKey(officeKey)[0]): | ||
isVersion = True | ||
officeVersion = EnumKey(officeKey, currentKey) | ||
if "." in officeVersion: | ||
for intCheck in officeVersion.split("."): | ||
if not intCheck.isdigit(): | ||
isVersion = False | ||
break | ||
|
||
if isVersion: | ||
installedVersions.append(officeVersion) | ||
CloseKey(officeKey) | ||
except WindowsError: | ||
# Office isn't installed at all | ||
return | ||
|
||
for oVersion in installedVersions: | ||
key = CreateKeyEx(HKEY_CURRENT_USER, | ||
r"{0}\{1}\Publisher\Security".format(baseOfficeKeyPath, oVersion), | ||
0, KEY_SET_VALUE) | ||
|
||
SetValueEx(key, "VBAWarnings", 0, REG_DWORD, 1) | ||
SetValueEx(key, "AccessVBOM", 0, REG_DWORD, 1) | ||
SetValueEx(key, "ExtensionHardening", 0, REG_DWORD, 0) | ||
CloseKey(key) | ||
|
||
def start(self, path): | ||
self.set_keys() | ||
publisher = self.get_path_glob("Microsoft Office Publisher") | ||
return self.execute(publisher, "\"%s\"" % path, path) |