forked from 504ensicsLabs/regdecoderlive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguimain.py
More file actions
157 lines (110 loc) · 4.6 KB
/
Copy pathguimain.py
File metadata and controls
157 lines (110 loc) · 4.6 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#
# Registry Decoder
# Copyright (c) 2011 Digital Forensics Solutions, LLC
#
# Contact email: registrydecoder@digitalforensicssolutions.com
#
# Authors:
# Andrew Case - andrew@digitalforensicssolutions.com
# Lodovico Marziale - vico@digitalforensicssolutions.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 the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# contains all of the code for the case creation UI and event handlers
import exception_handler
import sys, os, stat, time
# If we're in a pyinstaller executable, from volatility
if hasattr(sys, "frozen"):
try:
import iu, _mountzlib
mei = os.path.abspath(os.environ["_MEIPASS2"])
sys.path.append(mei)
os.environ['PATH'] = mei + ";" + os.environ['PATH']
except ImportError:
pass
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtNetwork import *
from uifiles.reglive_ui import Ui_MainWindow
import acquire_files
guidrawn = 0
class regDecoderLiveGUI(QMainWindow, Ui_MainWindow):
def __init__(self, app, parent = None):
# setup GUI
QMainWindow.__init__(self, parent)
Ui_MainWindow.__init__(self)
self.setupUi(self)
self.app = app
self.connect(self.browsePushButton, SIGNAL("clicked()"), self.outputDirBrowse)
self.connect(self.acquireFilesPushButton, SIGNAL("clicked()"), self.acquireFiles)
def outputDirBrowse(self):
directory = QFileDialog.getExistingDirectory(parent=self, caption="Choose Case Save Directory")
self.outputDirectoryLineEdit.setText(directory)
# gets input from the GUI and sends to acquire_files, switches to results label
def acquireFiles(self):
compDesc = unicode(self.compDescLineEdit.text())
if compDesc == "":
self.msgBox("No computer descrption was entered")
return
directory = unicode(self.outputDirectoryLineEdit.text())
if not self.check_directory(directory):
return
acquire_current = self.currentFilesCheckBox.isChecked()
acquire_backups = self.backupFilesCheckBox.isChecked()
if not acquire_current and not acquire_backups:
self.msgBox("Both acquire current and acquire backups were unchecked. Cannot proceed")
return
self.stackedWidget.setCurrentIndex(1)
aq = acquire_files.acquire_files(directory, acquire_current, acquire_backups, compDesc, self)
ret = aq.acquire_files()
if ret == False:
self.stackedWidget.setCurrentIndex(0)
return ret
# write out log file
fd = open(os.path.join(directory, "logfile.txt"), "w")
files = aq.added_files
runtime = time.strftime('%Y/%m/%d %H:%M:%S')
cur = ["No", "Yes"][acquire_current]
back = ["No", "Yes"][acquire_backups]
logdata = "Computer Descrption: %s\nCurrent Files Acquired: %s\nBackup Files Acquired: %s\nAcquisition Time: %s\nAcquired Files: %d\n" % \
(compDesc, cur, back, runtime , files)
fd.write(logdata)
fd.close()
return True
def check_directory(self, directory):
ret = 0
good = 0
try:
mode = os.stat(directory)[stat.ST_MODE]
good = 1
except:
self.msgBox("Specified Directory Does not Exist")
if good:
if not mode & stat.S_IWUSR:
self.msgBox("Unable to write to specific directory")
elif os.listdir(directory):
self.msgBox("Non-empty directory specificied. Pleaes choose another.")
else:
ret = 1
return ret
def msgBox(self, msg):
QMessageBox.critical(self, "Error", msg)
def main():
app = QApplication(sys.argv)
window = regDecoderLiveGUI(app)
window.showMaximized()
app.exec_()
if __name__ == "__main__":
main()