-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoF.py
More file actions
877 lines (785 loc) · 31.6 KB
/
Copy pathAutoF.py
File metadata and controls
877 lines (785 loc) · 31.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
# Forensic case automater
import tkinter as tk
from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
from tkinter import messagebox
from tkinter import scrolledtext
from shutil import copyfile
import sqlite3
import ctypes
import sys
import os
from AutoS import convertPath, jenkinsSettingsWindow, aboutWindow, indexWindow, getXways, imageXSort, \
generalOptionsWindow, now, create_settings
from AutoX import processImages, xCompound, caseMode, xCombine, xConcurrent
from AutoJ import xnodeMode
from AutoN import processImagesN, nCompound, nConcurrent
from NuixRepath import repath
from CaseInfo import caseInfo
import logging
from autologging import TRACE, traced
import win32com.client
import psutil
from pathlib import Path
from DualTool import dualTool
import re
logging.basicConfig(level=TRACE, filename=('settings\logs\RunLog ' + now() + '.txt'),
format="%(asctime)s:%(levelname)s:%(filename)s,%(lineno)d:%(name)s.%(funcName)s:%(message)s")
@traced
def clearAll(event=None):
global savedPath
global images
global versOption
images = []
savedPath = ''
caseSaveText.delete(0, END)
imageFolderText.config(state=NORMAL)
imageFolderText.delete(0, END)
imageFolderText.config(state=DISABLED)
compoundCaseName.config(state=NORMAL)
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
cMode.set(0)
nMode.set(0)
compound.set(0)
xComb.set(0)
iMonitor.set(0)
dtMode.set(0)
ufdrFilter.set(0)
xConc.set(0)
imageList.config(state=NORMAL)
compCheck.config(state=NORMAL)
cModeCheck.config(state=NORMAL)
nModeCheck.config(state=NORMAL)
xCombCheck.config(state=NORMAL)
ufdrFilterCheck.config(state=NORMAL)
xConcCheck.config(state=NORMAL)
versOption.config(state=NORMAL)
profOption.config(state=NORMAL)
versOption.destroy()
versOption = OptionMenu(window, vers, *xVersions, command=xProfile)
vers.set(xVersions[0])
versOption.place(x=30, y=190)
xProfile(profOption)
ufdrFilter.set(0)
threadCountSet.set(threadCount[0])
threadMenu.config(state="disabled")
@traced
def exitAF(event=None):
sys.exit(0)
# Checks if software is running as admin
@traced
def isAdmin():
try:
is_admin = (os.getuid() == 0)
except AttributeError:
is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
return is_admin
# Forces a scan for x-ways installs and CFG
@traced
def forceScan(event=None):
global xVersions
global xInstalls
global xCFG
global versOption
MsgBox = tk.messagebox.askquestion('Force Scan', 'You are about to scan your machine '
'for all processing tools & needed config files. '
'This may take some time. Are you sure?',
icon='warning')
if MsgBox == 'yes':
fconn = sqlite3.connect('settings\\settings.db ')
fcur = fconn.cursor()
fcur.execute("DELETE FROM Xways")
fconn.commit()
fcur.execute("DELETE FROM CFG")
fconn.commit()
xInstalls, xVersions, xCFG = getXways()
versOption.destroy()
versOption = OptionMenu(window, vers, *xVersions, command=xProfile)
vers.set(xVersions[0])
versOption.place(x=30, y=190)
xProfile(profOption)
window.update_idletasks()
messagebox.showinfo("Force scan", "Scan complete")
# Select where to save created cases COMPLETE
@traced
def caseSaveLocation():
caseSave = filedialog.askdirectory(title="Select Root folder to save all cases")
if caseSave == '':
messagebox.showinfo("ERROR", "No case save path selected!")
else:
caseSaveText.delete(0, END)
caseSaveText.insert(0, caseSave)
# Select all images to process COMPLETE
@traced
def imageSelect():
global images
global folderSkip
global savedPath
myPath = filedialog.askdirectory(title="select images")
imageFolderText.config(state=NORMAL)
imageFolderText.delete(0, END)
imageFolderText.insert(0, myPath)
imageFolderText.config(state=DISABLED)
if iMonitor.get() == 0 and dtMode.get() == 0:
images = imageXSort(folderSkip, myPath, vers.get(), ufdrFilter.get())
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in images:
imageList.insert(END, x + '\n\n')
imageList.config(state=DISABLED)
if len(images) == 0:
imageFolderText.config(state=NORMAL)
imageFolderText.delete(0, END)
imageFolderText.config(state=DISABLED)
messagebox.showinfo('ERROR', 'No compatible images found.')
# Find x-ways profiles COMPLETE
@traced
def xProfile(self):
global xProfiles
global vers
getxProfiles = []
if 'X-ways' in vers.get():
if os.path.exists('Settings\\X-ways profiles\\') is False:
profRoot = tk.Tk()
profRoot.withdraw()
messagebox.showerror('Error!',
'Profiles directory does not exist. Perhaps the install is not complete')
sys.exit(1)
for i in os.listdir('Settings\\X-ways profiles\\'):
if i.endswith('.cfg'):
getxProfiles.append(i)
else:
for p in os.listdir('Settings\\Nuix\\Scripts\\'):
if '.rb' in p:
getxProfiles.append(p)
if len(getxProfiles) == 0:
messagebox.showerror('Error!',
'No processing profiles found. AutoF will now close')
prof.set('')
profOption['menu'].delete(0, 'end')
for opt in getxProfiles:
profOption['menu'].add_command(label=opt, command=tk._setit(prof, opt))
prof.set(getxProfiles[0])
if imageFolderText.get() == '':
return
else:
myPath = imageFolderText.get()
if ufdrFilter.get() == 1:
images = imageXSort(folderSkip, myPath, 'ufdr', ufdrFilter.get())
else:
images = imageXSort(folderSkip, myPath, vers.get(), ufdrFilter.get())
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in images:
imageList.insert(END, x + '\n\n')
# Manages compound tick box behaviour COMPLETE
@traced
def compoundBox():
if xComb.get() == 1:
messagebox.showinfo("ERROR", "Single Case Mode is not supported for xCombine!")
compound.set(0)
elif compound.get() == 1:
compoundCaseName.config(state=NORMAL)
elif compound.get() == 0:
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
# Manages caseMode tick box behaviour COMPLETE
@traced
def caseModeBox():
casePath = caseSaveText.get()
if casePath == '':
messagebox.showinfo("ERROR", "Select root folder of cases first")
cMode.set(0)
return
# When un-ticked clears list and enable select image
elif cMode.get() == 0:
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
elif xComb.get() == 1:
messagebox.showinfo("ERROR", "Node Mode is not supported for Case Mode!")
cMode.set(0)
# Disables image select button and populates case list
elif cMode.get() == 1:
if nMode.get() == 1:
messagebox.showinfo("ERROR", "Case Mode is not supported for cases!")
cMode.set(0)
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
return
version = vers.get()
if 'nuix' in version.lower():
messagebox.showinfo("ERROR", "Nuix is not supported for cases!")
cMode.set(0)
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
return
global images
images = []
cases = []
myPath = caseSaveText.get()
for cRoot, directories, files in os.walk(myPath, topdown=False):
for name in files:
if '.xfc' in name[-4:]:
cases.append(convertPath(os.path.join(cRoot, name)))
selectImagesButton.config(state=DISABLED)
imageFolderText.config(state=NORMAL)
imageFolderText.delete(0, END)
imageFolderText.config(state=DISABLED)
compoundCaseName.config(state=NORMAL)
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
compound.set(0)
compoundBox()
compCheck.config(state=DISABLED)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in cases:
imageList.insert(END, x + '\n')
imageList.config(state=DISABLED)
# Manages caseMode tick box behaviour COMPLETE
@traced
def nodeModeBox():
nconn = sqlite3.connect('settings\\settings.db ')
ncur = nconn.cursor()
ncur.execute("Select * FROM Node")
nconn.commit()
nrows = ncur.fetchall()
if not nrows:
messagebox.showinfo("ERROR", "Jenkins settings do not exist")
nMode.set(0)
return
elif cMode.get() == 1:
messagebox.showinfo("ERROR", "Node Mode is not supported for cases!")
nMode.set(0)
elif xComb.get() == 1:
messagebox.showinfo("ERROR", "Node Mode is not supported for xCombine!")
nMode.set(0)
# Manges image monitor box
@traced
def imageMonitorBox():
if iMonitor.get() == 1:
cMode.set(0)
compound.set(0)
xComb.set(0)
compCheck.config(state=DISABLED)
cModeCheck.config(state=DISABLED)
xCombCheck.config(state=DISABLED)
compoundCaseName.config(state=NORMAL)
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
elif iMonitor.get() == 0:
compCheck.config(state=NORMAL)
cModeCheck.config(state=NORMAL)
xCombCheck.config(state=NORMAL)
# Managed UFDR filtering behaviour
@traced
def ufdrFilterBox():
global images
if ufdrFilter.get() == 1:
myPath = imageFolderText.get()
images = imageXSort(folderSkip, myPath, 'ufdr', ufdrFilter.get())
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in images:
imageList.insert(END, x + '\n\n')
elif ufdrFilter.get() == 0:
myPath = imageFolderText.get()
images = imageXSort(folderSkip, myPath, vers.get(), ufdrFilter.get())
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in images:
imageList.insert(END, x + '\n\n')
# Manages dual tool Box
def dtBox():
if dtMode.get() == 1:
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
cMode.set(0)
nMode.set(0)
compound.set(0)
xComb.set(0)
iMonitor.set(0)
ufdrFilter.set(0)
xConc.set(0)
imageList.config(state=DISABLED)
compCheck.config(state=DISABLED)
cModeCheck.config(state=DISABLED)
nModeCheck.config(state=DISABLED)
xCombCheck.config(state=DISABLED)
ufdrFilterCheck.config(state=DISABLED)
xConcCheck.config(state=DISABLED)
versOption.config(state=DISABLED)
profOption.config(state=DISABLED)
compoundCaseName.config(state=NORMAL)
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
threadCountSet.set(threadCount[0])
threadMenu.config(state="disabled")
elif dtMode.get() == 0:
imageList.config(state=NORMAL)
compCheck.config(state=NORMAL)
cModeCheck.config(state=NORMAL)
nModeCheck.config(state=NORMAL)
xCombCheck.config(state=NORMAL)
ufdrFilterCheck.config(state=NORMAL)
xConcCheck.config(state=NORMAL)
versOption.config(state=NORMAL)
profOption.config(state=NORMAL)
myPath = imageFolderText.get()
if ufdrFilter.get() == 1:
images = imageXSort(folderSkip, myPath, 'ufdr', ufdrFilter.get())
else:
images = imageXSort(folderSkip, myPath, vers.get(), ufdrFilter.get())
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in images:
imageList.insert(END, x + '\n\n')
# Manages concurrent box
@traced
def concurrentBox():
if xConc.get() == 1:
messagebox.showwarning("Warning", "This is experimental, for X-Ways special settings are required in the CFG")
threadMenu.config(state="normal")
else:
threadCountSet.set(threadCount[0])
threadMenu.config(state="disabled")
# Skip menu COMPLETE
@traced
def folderSkipWindow(event=None):
def folderSave():
global folderSkip
folderSkip.clear()
folderSkip = folderSkipText.get("1.0", END).split('\n')
sconn = sqlite3.connect('settings\\settings.db ')
scur = sconn.cursor()
scur.execute("DELETE FROM Skip")
sconn.commit()
# Clears empty list elements
folderSkip = list(filter(None, folderSkip))
for line in folderSkip:
scur.execute('INSERT INTO Skip VALUES(?)', (line,))
sconn.commit()
fsconn = sqlite3.connect('settings\\settings.db ')
fscur = fsconn.cursor()
fscur.execute("SELECT * FROM Skip")
frows = fscur.fetchall()
folderSkipWin = Toplevel()
folderSkipWin.title("Folder Skip")
folderSkipWin.geometry("300x440")
folderSkipWin.resizable(width=False, height=False)
folderSkipWin.grab_set()
try:
folderSkipWin.iconbitmap('settings\\ax.ico')
except:
messagebox.showerror('Error!',
'Can not find AutoF.ico file. Perhaps the install is not complete')
folderSkipText = Text(folderSkipWin, width=30, height=20, bg="lightgrey", wrap=WORD)
folderSkipText.pack(pady=10)
folderSkipText.tag_config('justified', justify=CENTER)
folderSkipText.config(bg='white')
folderSkipSave = Button(folderSkipWin, text='Save', command=folderSave)
folderSkipSave.pack(pady=5, padx=5)
folderSkipExit = Button(folderSkipWin, text='Exit', command=folderSkipWin.destroy)
folderSkipExit.pack(pady=5)
for ind in frows:
folderSkipText.insert(INSERT, ind[0] + '\n')
# manages xCombine box behaviour
@traced
def xCombineBox():
versCheck = re.sub("[^0-9.]", "", vers.get())
if "Nuix" in vers.get():
messagebox.showinfo("ERROR", "Combining of cases is only supported in X-Ways version 20.3 and later")
xComb.set(0)
return
versCheck = versCheck[:4]
versCheck = float(versCheck)
if versCheck < 20.3:
messagebox.showinfo("ERROR", "Combining of cases is only supported in X-Ways version 20.3 and later")
xComb.set(0)
return
casePath = caseSaveText.get()
if casePath == '':
messagebox.showinfo("ERROR", "Select root folder of cases first")
xComb.set(0)
return
elif nMode.get() == 1:
messagebox.showinfo("ERROR", "xCombine is not supported for Node Mode!")
xComb.set(0)
elif cMode.get() == 1:
messagebox.showinfo("ERROR", "xCombine is not supported for Case Mode!")
xComb.set(0)
elif compound.get() == 1:
messagebox.showinfo("ERROR", "xCombine is not supported for Single Case Mode!")
xComb.set(0)
# When un-ticked clears list and enable select image
elif xComb.get() == 0:
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
compoundCaseName.config(state=NORMAL)
compoundCaseName.delete(0, END)
compoundCaseName.config(state=DISABLED)
compound.set(0)
compoundBox()
# Disables image select button and populates case list
elif xComb.get() == 1:
if nMode.get() == 1:
messagebox.showinfo("ERROR", "Case Mode is not supported for combining X-Ways cases!")
xComb.set(0)
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
return
version = vers.get()
if 'nuix' in version.lower():
messagebox.showinfo("ERROR", "Nuix is not supported for combining X-Ways cases!")
xComb.set(0)
selectImagesButton.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
imageList.config(state=DISABLED)
compCheck.config(state=NORMAL)
return
global images
images = []
cases = []
myPath = caseSaveText.get()
for cRoot, directories, files in os.walk(myPath, topdown=False):
for name in files:
if '.xfc' in name[-4:]:
cases.append(convertPath(os.path.join(cRoot, name)))
selectImagesButton.config(state=DISABLED)
imageFolderText.config(state=NORMAL)
imageFolderText.delete(0, END)
imageFolderText.config(state=DISABLED)
compoundCaseName.config(state=NORMAL)
imageList.config(state=NORMAL)
imageList.delete('1.0', END)
for x in cases:
imageList.insert(END, x + '\n')
imageList.config(state=DISABLED)
# Run Automation
@traced
def run():
def __init__(self):
self.__log.info("initialized")
global xInstalls
global xVersions
global xCFG
path = ''
if dtMode.get() == 1:
if imageFolderText.get() == '' or caseSaveText.get() == '':
messagebox.showerror("ERROR", "Ensure image path and case path are selected")
return
else:
dualTool(caseSaveText.get(),imageFolderText.get(),xInstalls,xVersions,xCFG, folderSkip)
clearAll()
return
if 'Check scan drive' in vers.get():
messagebox.showerror("ERROR", "Processing tools not found")
return
version = vers.get()
if 'x-ways' in version.lower():
tool = 'xways'
else:
tool = 'nuix'
if tool == 'xways':
vidpid =[]
wmi = win32com.client.GetObject("winmgmts:")
for usb in wmi.InstancesOF("win32_usbcontrollerdevice"):
if "VID_096E" in usb.Dependent:
vidpid.append(usb)
if len(vidpid) == 0:
MsgBox = tk.messagebox.askquestion('Possible missing dongle', 'AutoF could not detect a '
'license dongle, do you wish to continue? ',
icon='warning')
if MsgBox == 'no':
return
else:
sconn = sqlite3.connect('settings\\settings.db ')
scur = sconn.cursor()
scur.execute("Select NuixLicense FROM Settings")
sconn.commit()
nuixLicenseSetting = scur.fetchall()
if 'dongle' in nuixLicenseSetting[0][0]:
drps = psutil.disk_partitions()
drives = [dp.device for dp in drps if dp.fstype == 'FAT']
nuixDongle = []
for i in drives:
nuixLicense = Path(i + 'licence.dat')
if nuixLicense.is_file():
nuixDongle.append(nuixLicense)
if len(nuixDongle) == 0:
MsgBox = tk.messagebox.askquestion('Possible missing dongle', 'AutoF could not detect a '
'license dongle, do you wish to continue? ',
icon='warning')
if MsgBox == 'no':
return
if caseSaveText.get() == '':
messagebox.showerror("ERROR", "Select case save path")
return
if imageFolderText.get() == '' and cMode.get() == 0 and xComb.get() == 0:
messagebox.showerror("ERROR", "Select images")
return
if compoundCaseName.get() == '' and compound.get() == 1:
messagebox.showerror("ERROR", "Insert compound name")
return
if xComb.get() == 1:
if compoundCaseName.get() == '':
messagebox.showerror("ERROR", "Insert Master name in Compound field")
else:
for x in range(len(xVersions)):
if str(xVersions[x]) == version:
path = xInstalls[x]
cases = []
myPath = caseSaveText.get()
for fRoot, directories, files in os.walk(myPath, topdown=False):
for name in files:
if '.xfc' in name[-4:]:
cases.append(convertPath(os.path.join(fRoot, name)))
xCombine(path, cases, compoundCaseName.get(), caseSaveText.get())
clearAll()
return
profile = prof.get()
# Goes through version list and matches to select the version selected
if nMode.get() == 0:
for x in range(len(xVersions)):
if str(xVersions[x]) == version:
path = xInstalls[x]
if 'xwforensics' in path.lower():
for file in xCFG:
try:
copyfile('Settings\\X-ways profiles\\Concurrent.dlg', os.path.dirname(file[0]) + '\\Concurrent.dlg')
copyfile('Settings\\X-ways profiles\\' + profile, file[0])
except:
messagebox.showinfo("ERROR", "CFG failed to copy, selected profile not used.")
# If case mode run in said mode
if cMode.get() == 1:
MsgBox = tk.messagebox.askquestion('Run over cases', 'You are about to run the selected '
'config over all cases selected. '
'Are you sure?',
icon='warning')
if MsgBox == 'yes':
cases = []
myPath = caseSaveText.get()
for fRoot, directories, files in os.walk(myPath, topdown=False):
for name in files:
if '.xfc' in name[-4:]:
cases.append(convertPath(os.path.join(fRoot, name)))
window.withdraw()
caseMode(path, cases, caseSaveText.get())
window.deiconify()
else:
return
# Check if running in node mode
elif nMode.get() == 1:
if compound.get() == 0:
saveLocation = caseSaveText.get()
if saveLocation == '':
messagebox.showinfo("ERROR", "No case save location selected")
return None
elif len(images) == 0:
messagebox.showinfo("ERROR", "No images selected")
xnodeMode(tool, 'individual', 0, images, caseSaveText.get(), 0, profile)
else:
saveLocation = caseSaveText.get()
if saveLocation == '':
messagebox.showinfo("ERROR", "No case save location selected")
return None
elif compoundCaseName.get() == '':
messagebox.showinfo("ERROR", "No case Name input")
return None
elif len(images) == 0:
messagebox.showinfo("ERROR", "No images selected")
return None
elif len(images) == 1:
messagebox.showinfo("ERROR", "Compound selected with only 1 image")
return None
xnodeMode(tool, 'compound', 0, images, caseSaveText.get(), compoundCaseName.get(), profile)
# Check if compound, then run images individually
elif compound.get() == 0:
window.withdraw()
if 'xwforensics' in path.lower():
if xConc.get() ==1:
xConcurrent(path, images,caseSaveText.get(), threadCountSet.get())
else:
processImages(path, images, caseSaveText.get(), 2)
elif 'nuix' in path.lower():
if xConc.get() == 1:
nConcurrent(path, images, caseSaveText.get(), profile, threadCountSet.get())
else:
processImagesN(path, images, caseSaveText.get(), profile, 2)
window.deiconify()
# Runs compound mode
else:
window.withdraw()
if 'x-ways' in path.lower():
xCompound(path, images, caseSaveText.get(), compoundCaseName.get(),2)
elif 'nuix' in path.lower():
nCompound(path, images, caseSaveText.get(), profile, compoundCaseName.get(),2)
window.deiconify()
clearAll()
# Stops if not running as admin
if not isAdmin():
root = tk.Tk()
root.withdraw()
messagebox.showerror('Error!',
'You must run as Administrator')
sys.exit(1)
# Checks for settings.db creates one if missing
settingsDbCheck = os.path.exists('Settings\\settings.db')
if settingsDbCheck == False:
create_settings()
# scans for X-Ways
xInstalls, xVersions, xCFG = getXways()
# Image list place holder
images = []
savedPath = ''
conn = sqlite3.connect('settings\\settings.db ')
cur = conn.cursor()
cur.execute("SELECT * FROM Skip")
rows = cur.fetchall()
folderSkip = []
for i in rows:
folderSkip.append(i[0])
# Main window
window = Tk()
window.title("AutoF")
window.geometry("800x300")
window.resizable(width=False, height=False)
try:
window.iconbitmap('settings\\ax.ico')
except:
window.withdraw()
messagebox.showerror('Error!',
'Can not find AutoF.ico file. Perhaps the install is not complete')
window.deiconify()
# Menu bar
menuBar = Menu(window)
fileMenu = Menu(window, tearoff=0)
fileMenu.add_command(label="Exit", command=exitAF, accelerator='Ctrl+Q')
menuBar.add_cascade(label="File", menu=fileMenu)
settingsMenu = Menu(window, tearoff=False)
settingsMenu.add_command(label="Force scan", command=forceScan, accelerator="Ctrl+F")
settingsMenu.add_command(label="Folder skip", command=folderSkipWindow, accelerator="Ctrl+S")
settingsMenu.add_command(label="Node config", command=jenkinsSettingsWindow, accelerator="Ctrl+N")
settingsMenu.add_command(label="General options", command=generalOptionsWindow, accelerator="Ctrl+G")
menuBar.add_cascade(label="Settings", menu=settingsMenu)
toolMenu = Menu(menuBar, tearoff=0)
toolMenu.add_command(label="Nuix Repath", command=repath, accelerator="Ctrl+R")
toolMenu.add_command(label="Case Info", command=caseInfo, accelerator="Ctrl+I")
menuBar.add_cascade(label="Tools", menu=toolMenu)
helpMenu = Menu(menuBar, tearoff=0)
helpMenu.add_command(label="Help Index", command=indexWindow, accelerator="Ctrl+H")
helpMenu.add_command(label="About...", command=aboutWindow, accelerator="Ctrl+I")
menuBar.add_cascade(label="Help", menu=helpMenu)
window.config(menu=menuBar)
settingsMenu.bind_all("<Control-q>", exitAF)
settingsMenu.bind_all("<Control-f>", forceScan)
settingsMenu.bind_all("<Control-s>", folderSkipWindow)
settingsMenu.bind_all("<Control-n>", jenkinsSettingsWindow)
settingsMenu.bind_all("<Control-g>", generalOptionsWindow)
settingsMenu.bind_all("<Control-h>", indexWindow)
settingsMenu.bind_all("<Control-i>", aboutWindow)
settingsMenu.bind_all("<Control-r>", repath)
settingsMenu.bind_all("<Control-i>", caseInfo)
# Image selection
Label(window, text="Image folder path:").place(x=25, y=20)
imageFolderText = Entry(window, width=20, bg="white", state=DISABLED)
imageFolderText.place(x=30, y=40)
selectImagesButton = Button(window, text="Select Images", command=imageSelect, state=tk.NORMAL)
selectImagesButton.place(x=30, y=65)
# Image Monitor
iMonitor = tk.IntVar()
iMonitorCheck = Checkbutton(window, text="Image Monitor", variable=iMonitor, onvalue=1, offvalue=0,
command=imageMonitorBox)
# iMonitorCheck.place(x=25, y=90)
# Image List
imageList = scrolledtext.ScrolledText(window, width=45, height=12, state=DISABLED, bg="lightgrey", wrap=WORD,
font="calibre 8")
imageList.place(x=475, y=40)
# Case save location
Label(window, text="Case save location:").place(x=200, y=20)
caseSaveText = Entry(window, width=40, bg="white")
caseSaveText.place(x=205, y=40)
caseSaveButton = Button(window, text="Select save", command=caseSaveLocation)
caseSaveButton.place(x=205, y=65)
# Compound
compound = tk.IntVar()
compCheck = Checkbutton(window, text="One Case Only", variable=compound, onvalue=1, offvalue=0, command=compoundBox)
compCheck.place(x=335, y=59)
Label(window, text="Single Case Name:").place(x=195, y=100)
compoundCaseName = Entry(window, width=20, bg="white", state=DISABLED)
compoundCaseName.place(x=200, y=125)
# Profile select and Version select
vers = StringVar(window)
vers.set(xVersions[0])
prof = StringVar(window)
xProfiles = '0'
profOption = OptionMenu(window, prof, *xProfiles)
xProfile(profOption)
Label(window, text="Profile selection:").place(x=25, y=115)
profOption.place(x=30, y=135)
Label(window, text="Processing tool:").place(x=25, y=170)
versOption = OptionMenu(window, vers, *xVersions, command=xProfile)
versOption.place(x=30, y=190)
# Case mode
cMode = tk.IntVar()
cModeCheck = Checkbutton(window, text="Case mode", variable=cMode, onvalue=1, offvalue=0, command=caseModeBox)
cModeCheck.place(x=335, y=79)
# Node mode
nMode = tk.IntVar()
nModeCheck = Checkbutton(window, text="Node mode", variable=nMode, onvalue=1, offvalue=0, command=nodeModeBox)
nModeCheck.place(x=335, y=99)
# XCombine
xComb = tk.IntVar()
xCombCheck = Checkbutton(window, text="xCombine", variable=xComb, onvalue=1, offvalue=0, command=xCombineBox)
xCombCheck .place(x=335, y=119)
# UFDR Filter
ufdrFilter = tk.IntVar()
ufdrFilterCheck = Checkbutton(window, text="UFDR", variable=ufdrFilter, onvalue=1, offvalue=0, command=ufdrFilterBox)
ufdrFilterCheck.place(x=335, y=139)
# Dual Tool Mode
dtMode = tk.IntVar()
dtModeCheck = Checkbutton(window, text="Dual tool", variable=dtMode, onvalue=1, offvalue=0, command=dtBox)
dtModeCheck.place(x=335, y=159)
# Concurrent mode
xConc = tk.IntVar()
xConcCheck = Checkbutton(window, text="Concurrent", variable=xConc, onvalue=1, offvalue=0, command=concurrentBox)
xConcCheck.place(x=335, y=179)
threadCount = [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32]
threadCountSet = StringVar(window)
threadCountSet.set(threadCount[0])
threadMenu= OptionMenu(window, threadCountSet, *threadCount)
threadMenu.config(state="disabled")
threadMenu.place(x=335, y=199)
# exit and run buttons
exitButton = Button(window, text="Exit", fg="red", command=exitAF)
exitButton.place(x=25, y=235)
clearButton = Button(window, text="Clear", fg="blue", command=clearAll)
clearButton.place(x=690, y=235)
window.bind("<Control-w>", clearAll)
runButton = Button(window, text='Run', fg="green", command=run)
runButton.place(x=735, y=235)
window.mainloop()