Repository navigation
Expand file tree
/
Copy pathconfig.py
More file actions
48 lines (38 loc) · 1.37 KB
/
Copy pathconfig.py
File metadata and controls
48 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright (C) 2014 Claudio Guarnieri.
# This file is part of Detekt - https://github.com/botherder/detekt
# See the file 'LICENSE' for copying permission.
import os
import shutil
import platform
from utils import get_resource
# Turn off to remove debug features.
DEBUG = True
class Config(object):
def __init__(self):
self.architecture = ''
self.driver = ''
self.service_name = 'pmem' # TODO: Randomize service name?
self.service_path = '\\\\.\\{0}'.format(self.service_name)
def get_architecture(self):
if not self.architecture:
orig = os.getenv('PROCESSOR_ARCHITECTURE')
try:
orig = os.getenv('PROCESSOR_ARCHITEW6432')
except:
pass
if orig == 'AMD64':
self.architecture = 'x64'
else:
self.architecture = 'x86'
def get_driver_path(self):
# Get architecture.
self.get_architecture()
if self.architecture == 'x64':
# Select 64 bit driver.
self.driver = get_resource(os.path.join('drivers', 'winpmem64.sys'))
elif self.architecture == 'x86':
# Delect 32 bit driver.
self.driver = get_resource(os.path.join('drivers', 'winpmem32.sys'))
if self.driver and os.path.exists(self.driver):
return True
return False