-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathddAuto-1.0.pl
More file actions
2396 lines (2003 loc) · 85.6 KB
/
ddAuto-1.0.pl
File metadata and controls
2396 lines (2003 loc) · 85.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
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl
# Script: ddAuto.pl
# Authors: Thamir Alshammari
# Organization: Rochester Institute of Technology
#
# This script is designed to automate the function of DD command line tool in a simple graphic user interface.
##########
use Net::hostent;
use IO::Socket;
use Tk; # require install for Windows via PPM, open the Command Prompt and type (ppm install Tk)
use Tk::ProgressBar;
use Tk::ROText;
use Tk::LabFrame;
use Tk::BrowseEntry;
use threads;
use threads 'exit' => 'threads_only';
use strict;
no strict "vars";
use Cwd;
require Win32::Process if ($^O eq 'MSWin32'); # required if the OS is Windows
require Win32::Process::List if ($^O eq 'MSWin32'); # require install via PPM in ActiveState (>ppm install Win32-Process-List)
########### Required only for Windows Platforms, you have to specify the wright path for Cygwin, Netcat, Cryptcat
my $cygwinPath='C:\cygwin\bin\\' if ($^O eq 'MSWin32');
my $ncPath='C:\cygwin\bin\\' if ($^O eq 'MSWin32');
my $cryptcatPath='C:\cygwin\bin\nt\\' if ($^O eq 'MSWin32');
#########################################################
my $defaultPort = 9090;
# Generl Variables
my $src_file_size=0;
my $dst_file_size=0;
my $cmd_title = 'Start';
my $path = getcwd();
my $t;
my $src_file_path;
my $dst_file_path;
my $status;
my $browse_src;
my $browse_dst;
my $mode;
my %defs;
my $network;
my $transfer;
my $dd_cmd;
my $ipaddress;
my $port;
my $connStatus;
my $key;
#Widgets Variables
my $mw;
my $summaryTxt;
my $mbar;
my $percent_done = 0;
my $file_m;
my $edit_m;
my $help_m;
my $srcLabel;
my $srcTxt;
my $dstLabel;
my $dstTxt;
my $progress;
my $img_openFolder;
my $LoadDialog;
my $cmd_next;
my $cmd_back;
my $cmd_start;
my $cmd_stop;
my $cmd_viewreport;
my $cmd_go;
my $level;
my $cmd_local;
my $cmd_remote;
my $ratePerSec;
my $dd_all_options;
my $reportTitle;
my $reportAuthor;
my $reportOrg;
my $ddThread;
my $remoteImagingControl;
my $percentage;
my $connection;
my %devicesListNames;
my %devicesListHardware;
my @hashList;
my @hashValues;
my @hashValues_remote;
@colors = ( 0, '#FF4545', 1, '#FF4845', 2, '#FF5145', 3, '#FF5B45', 4, '#FF6D45',
5, '#FF7345', 6, '#FF7D45', 7, '#FF8345', 8, '#FF9945', 9, '#FF9C45',
10, '#FFA245', 11, '#FFA545', 12, '#FFA845', 13, '#FFAE45', 14, '#FFB245',
15, '#FFB845', 16, '#FFBB45', 17, '#FFC445', 18, '#FFC745', 19, '#FFCD45',
20, '#FFD145', 21, '#FFD445', 22, '#FFDA45', 23, '#FFDD45', 24, '#FFE645',
25, '#FFF045', 26, '#FFF345', 27, '#FFFC45', 28, '#F9FF45', 29, '#F0FF45',
30, '#E6FF45', 31, '#E0FF45', 32, '#D7FF45', 33, '#D1FF45', 34, '#CAFF45',
35, '#C4FF45', 36, '#C1FF45', 37, '#BBFF45', 38, '#B8FF45', 39, '#B5FF45',
40, '#AEFF45', 41, '#A5FF45', 42, '#A2FF45', 43, '#99FF45', 44, '#96FF45',
45, '#8FFF45', 46, '#8CFF45', 47, '#89FF45', 48, '#83FF45', 49, '#80FF45',
50, '#7AFF45');
&determainOS;
&build_main_gui;
&build_welcome_win;
&build_imageMode_win;
&build_connection_win;
&build_transfer_win;
&build_io_win;
&build_ddOptions_win;
&build_checksum_win;
&build_confirmation_win;
&build_status_win;
&definitions;
MainLoop();
sub build_main_gui{
$maxStep = 5;
$mw = MainWindow->new(-title => 'ddAuto v 1.0');
$mw->geometry('625x450');
$mw->geometry (sprintf "+%d+%d", ($mw->screenwidth() - 625) / 2,($mw->screenheight() - 450) / 2);
$mw->resizable( 0, 0 );
$icon = $mw->Photo(-file=>$path.'/src/img/logo.gif');
$mw->Icon(-image=> $icon);
$mw->fontCreate('courier',
-family=>'courier',
-size=> 15
);
$bottom = $mw->Frame->pack (-side => 'bottom', -fill => 'x', -pady => 5, -padx => 2);
$main = $mw->Frame->pack (-side => 'bottom', -fill => 'both', -expand => 1);
$levels = $main->Frame->pack (-fill => 'both', -expand => 1);
$level_1 = $levels->Frame ()->pack (-fill => 'both', -expand => 1);
$level_2 = $levels->Frame ();
$level_3 = $levels->Frame ();
$level_4 = $levels->Frame ();
$level_5 = $levels->Frame ();
$level_6 = $levels->Frame ();
$level_7 = $levels->Frame ();
$level_8 = $levels->Frame ();
$level_9 = $levels->Frame ();
$cmd_start = $bottom->Button(-text => "Start", -width => 10, -command => \&next, -relief => 'groove', -takefocus => 1)->pack();
$cmd_next = $bottom->Button(-text => "Next >", -width => 10, -command => \&next, -takefocus => 1,-relief => 'groove');
$cmd_back = $bottom->Button(-text => "< Back", -width => 10, -command => \&back, -relief => 'groove');
$cmd_go= $bottom->Button(-text => "Go >", -width => 10, -command => \&go, -takefocus => 1, -relief => 'groove');
$center_frame= $bottom->Frame()->pack(-anchor=>'center');
$cmd_stop= $bottom->Button(-text => "Stop", -width => 10, -command => \&stop, -relief => 'groove');
$cmd_exit= $center_frame->Button(-text => "Exit", -width => 10, -command => \&exit_, -relief => 'groove');
$cmd_startover= $center_frame->Button(-text => "Start Over", -width => 10, -command => \&startover, -relief => 'groove');
$cmd_viewreport= $center_frame->Button(-text => "View Report", -width => 10, -command => \&viewReport, -relief => 'groove');
$steps = $bottom->Label (
-textvariable => \$step
);
$level = 1;
$currentStep= 1;
$step = "Step: $currentStep | $maxStep";
}
sub next {
if ($level == 1) { # imaging mode win
$level_1->packForget();
$level_2->pack(-fill => "both", -expand => 1);
$cmd_start->packForget();
$cmd_next->pack(-side => 'right', -anchor => 'se');
$cmd_back->pack(-side => 'left', -anchor => 'sw');
$steps->pack(-fill => "x", -expand => 1);
$level = 2;
}elsif ($level == 2) { # connection mode win
if ($mode eq 'Remote') {
$level_2->packForget();
$level_3->pack(-fill => "both", -expand => 1);
$mw->update();
$level = 3;
$maxStep = 7;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}else{
$level_2->packForget();
$level_5->pack(-fill => "both", -expand => 1);
$mw->update();
$level = 5;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}
}elsif ($level == 3) { # transfer mode win
$level_3->packForget();
$level_4->pack(-fill => "both", -expand => 1);
$level = 4;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
if ($connection eq 'Sender'){
$portFrame->packForget();
$ipaddressFrame->pack(-fill => 'x');
$portFrame->pack(-fill => 'x');
}
if ($connection eq 'Receiver'){
$ipaddressFrame->packForget();
}
if ($mode eq 'Remote'){
if ($connection eq 'Sender'){
$portFrame->packForget();
$ipaddressFrame->pack(-fill => 'x');
$portFrame->pack(-fill => 'x');
}
if ($connection eq 'Receiver'){
$ipaddressFrame->packForget();
}
}
}elsif ($level == 4) { # paths win
$isIPvalid = validateIP();
if ($isIPvalid eq 'false' && $connection eq 'Sender'){
$mw -> messageBox(-message=>"You entered invalid IP!",-type=>'ok',-icon=>'error');
return;
}
$isPortValid = validatePort();
if ($isPortValid eq 'false'){
$mw -> messageBox(-message=>"You entered invalid Port!",-type=>'ok',-icon=>'error');
return;
}
if ($mode eq 'Remote'){
if ($connection eq 'Sender'){
$paths_win_src->pack(-fill => 'x');
$paths_win_dst->packForget();
$portFrame->packForget();
$ipaddressFrame->pack(-fill => 'x');
$portFrame->pack(-fill => 'x');
}
if ($connection eq 'Receiver'){
$paths_win_src->packForget();
$paths_win_dst->pack(-fill => 'x');
$ipaddressFrame->packForget();
}
}
$level_4->packForget();
$level_5->pack(-fill => "both", -expand => 1);
$level = 5;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 5) { # dd options win
if ($mode eq 'Local'){
if (!$src_file_path){
$mw -> messageBox(-message=>"You must provide an input device/file!",-type=>'ok',-icon=>'error');
return;
}
if (!$dst_file_path){
$mw -> messageBox(-message=>"You must provide an output device/file!",-type=>'ok',-icon=>'error');
return;
}
}else{
if ($connection eq 'Sender'){
if (!$src_file_path){
$mw -> messageBox(-message=>"You must provide an output device/file!",-type=>'ok',-icon=>'error');
return;
}
}
if ($connection eq 'Receiver'){
if (!$dst_file_path){
$mw -> messageBox(-message=>"You must provide an output file!",-type=>'ok',-icon=>'error');
return;
}
}
}
$level_5->packForget();
if (($mode eq 'Remote') and ($connection eq 'Sender')) {
&disableChecksums;
}else{
&enableChecksums;
}
$level_6->pack(-fill => "both", -expand => 1);
$level = 6;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 6) { # checksum options win
$level_7->pack(-fill => "both", -expand => 1);
$level_6->packForget();
$level = 7;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 7) { # confirmation win
&updateConfirmationText;
$level_7->packForget();
$level_8->pack(-fill => "both", -expand => 1);
$cmd_next->packForget();
$steps->packForget();
$cmd_go->pack(-side => 'right', -anchor => 'se');
$cmd_back->pack(-side => 'left', -anchor => 'sw');
$steps->pack(-fill => "x", -expand => 1);
$level = 8;
$currentStep++;
$step = "Step: $currentStep | $maxStep";
}
}
sub back {
if ($level == 2) {
$currentStep= 1;
$level_2->packForget();
$level_1->pack(-fill => "both", -expand => 1);
$cmd_start->pack();
$cmd_next->packForget();
$cmd_back->packForget();
$steps->packForget();
$level = 1;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 3) {
$level_3->packForget();
$level_2->pack(-fill => "both", -expand => 1);
$level = 2;
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 4) {
$level_4->packForget();
$level_3->pack(-fill => "both", -expand => 1);
$level = 3;
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 5) {
$paths_win_src->packForget(-fill => 'x');
$paths_win_dst->packForget(-fill => 'x');
$paths_win_src->pack(-fill => 'x');
$paths_win_dst->pack(-fill => 'x');
if ($mode eq 'Remote') {
$level_5->packForget();
$level_4->pack(-fill => "both", -expand => 1);
$level = 4;
}else{
$level_5->packForget();
$level_2->pack(-fill => "both", -expand => 1);
$level = 2;
}
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 6) {
$level_6->packForget();
$level_5->pack(-fill => "both", -expand => 1);
$level = 5;
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 7) {
$level_7->packForget();
$level_6->pack(-fill => "both", -expand => 1);
$level = 6;
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}elsif ($level == 8) {
$level_8->packForget();
$level_7->pack(-fill => "both", -expand => 1);
$level = 7;
$cmd_go->packForget();
$steps->packForget();
$cmd_next->pack(-side => 'right');
$cmd_back->pack(-side => 'left', -anchor => 'sw');
$steps->pack(-fill => "x", -expand => 1);
$currentStep--;
$step = "Step: $currentStep | $maxStep";
}
}
sub go {
if ($level == 8) {
$process='Active';
$level_8->packForget();
$level_9->pack(-fill => "both", -expand => 1);
$cmd_stop->pack();
$cmd_go->packForget();
$steps->packForget();
$cmd_back->packForget();
$level = 8;
if ($mode eq 'Local'){
&startImaging_local;
}else{
&startImaging_remote;
}
}
}
sub startover{
$level_9->packForget();
$level_1->pack(-fill => "both", -expand => 1);
$cmd_start->pack();
$cmd_startover->packForget();
$cmd_exit->packForget();
$cmd_viewreport->packForget();
$steps->packForget();
$level = 1;
$maxStep = 5;
$currentStep = 1;
$step = "Step: $currentStep | $maxStep";
$process='Active';
$percent_done=0;
}
sub stop {
if ($system eq 'Windows') {
$remoteImagingControl->kill('KILL')->detach() if $mode eq 'Remote';
$ddThread->kill('KILL')->detach();
my $P = Win32::Process::List->new();
my %list = $P->GetProcesses();
foreach my $pid ( keys %list ) {
my $name = $list{$pid};
if ($name =~ /dd.exe/) {
my $exitcode;
Win32::Process::KillProcess ($pid, \$exitcode);
}
}
unlink($dst_file_path);
}elsif ($system eq 'Linux' or $system eq 'Mac' ){
$remoteImagingControl->kill('KILL')->detach() if $mode eq 'Remote';
$ddThread->kill('KILL')->detach();
}
$cmd_startover->pack(-side=>'left',-anchor=>'center', -padx=>20);
$cmd_exit->pack(-side=>'left', -anchor=>'center', -padx=>20);
$cmd_stop->packForget();
$process = 'Aborted';
}
sub exit_{
exit(0);
}
sub build_welcome_win{
$welcome_win = $level_1->LabFrame(-borderwidth => '2',-label => " Welcome ",-labelside => "acrosstop",)->pack(-fill => "both", -expand => 1);
$welcome_win->Label (-textvariable => \$defs{'welcome'},-anchor=> 'nw', -justify => 'left', -wraplength => 600)->pack(-fill => 'x', -anchor=> 'w');
}
sub build_imageMode_win{
$mode = 'Local';
$img_local = $mw->Photo(-file=>$path.'/src/img/local.gif');
$img_remote = $mw->Photo(-file=>$path.'/src/img/remote.gif');
$imagingMode_win = $level_2->LabFrame(-borderwidth => '2',-label => " Imaging Mode ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$imagingMode_win->Label (-textvariable => \$defs{'imagingMode'},-anchor=> 'nw', -height => 6, -justify => 'left', -wraplength => 480)->pack(-fill => 'x', -anchor=> 'w');
$imagingMode_win_local = $imagingMode_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$cmd_local = $imagingMode_win_local->Button(-image => $img_local, -command=> sub{$mode = 'Local';$maxStep = 5;$cmd_local->configure(-relief => 'solid');$cmd_remote->configure(-relief => 'raised');}, -width => 50, -height => 45, -relief => 'solid')->pack(-side=> 'left', -padx=>5, -pady=>5);
$imagingMode_win_local->Label (-text => 'Local:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$imagingMode_win_local->Label (-textvariable => \$defs{'Local'}, -justify => 'left', -anchor => 'nw', -wraplength => 440)->pack(-side => 'top', -fill => 'x');
$imagingMode_win_remote = $imagingMode_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$cmd_remote = $imagingMode_win_remote->Button(-image => $img_remote, -command=> sub{$mode = 'Remote';$maxStep = 7; $cmd_local->configure(-relief => 'raised');$cmd_remote->configure(-relief => 'solid');}, -width => 50, -height => 45)->pack(-anchor=> 'w', -padx=>5, -pady=>5)->pack(-side=> 'left', -padx=>5, -pady=>5);
$imagingMode_win_remote->Label (-text => 'Remote:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$imagingMode_win_remote->Label (-textvariable => \$defs{'Remote'}, -justify => 'left', -anchor => 'nw', -wraplength => 440)->pack(-side => 'top', -fill => 'x');
}
sub build_connection_win{
$connection = 'Sender';
$ipaddressTxt;
$img_sender = $mw->Photo(-file=>$path.'/src/img/sender.gif');
$img_receiver = $mw->Photo(-file=>$path.'/src/img/receiver.gif');
$connection_win = $level_3->LabFrame(-borderwidth => '2',-label => " Connection Mode ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$connection_win->Label (-textvariable => \$defs{'connection'},-anchor=> 'nw', -height => 6, -justify => 'left', -wraplength => 480)->pack(-fill => 'x', -anchor=> 'w');
$connection_win_sender = $connection_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$cmd_sender = $connection_win_sender->Button(-image => $img_sender, -command=> sub{$connection = 'Sender'; $cmd_sender->configure(-relief => 'solid');$cmd_receiver->configure(-relief => 'raised');}, -width => 50, -height => 45, -relief => 'solid')->pack(-side=> 'left', -padx=>5, -pady=>5);
$connection_win_sender->Label (-text => 'Sender Mode:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$connection_win_sender->Label (-textvariable => \$defs{'Sender'}, -justify => 'left', -anchor => 'nw', -wraplength => 440)->pack(-side => 'top', -fill => 'x');
$connection_win_receiver = $connection_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$cmd_receiver = $connection_win_receiver->Button(-image => $img_receiver, -command=> sub{$connection = 'Receiver'; $cmd_sender->configure(-relief => 'raised');$cmd_receiver->configure(-relief => 'solid');}, -width => 50, -height => 45)->pack(-anchor=> 'w', -padx=>5, -pady=>5)->pack(-side=> 'left', -padx=>5, -pady=>5);
$connection_win_receiver->Label (-text => 'Receiver Mode:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$connection_win_receiver->Label (-textvariable => \$defs{'Receiver'}, -justify => 'left', -anchor => 'nw', -wraplength => 440)->pack(-side => 'top', -fill => 'x');
}
sub build_transfer_win{
$transfer_mode = 'Netcat';
$transfer_mode_cmd = 'nc';
$port = 3333;
$img_netcat = $mw->Photo(-file=>$path.'/src/img/netcat.gif');
$img_cryptcat = $mw->Photo(-file=>$path.'/src/img/cryptcat.gif');
$transfer_win = $level_4->LabFrame(-borderwidth => '2',-label => " Tunneling Mode ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$transfer_win->Label (-textvariable => \$defs{'transfer'},-anchor=> 'nw', -height => 4, -justify => 'left', -wraplength => 480)->pack(-fill => 'x');
$transfer_win_netcat = $transfer_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'both', -side=>'top', -anchor=> 'e');
$cmd_netcat = $transfer_win_netcat->Button(-image => $img_netcat, -command=> sub{$transfer_mode = 'Netcat';$transfer_mode_cmd = 'nc'; $cmd_netcat->configure(-relief => 'solid');$cmd_cryptcat->configure(-relief => 'raised');$keyFrame->packForget();}, -width => 50, -height => 45, -relief => 'solid')->pack(-side=> 'left', -padx=>5, -pady=>5);
$transfer_win_netcat->Label (-text => 'Netcat:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$transfer_win_netcat->Label (-textvariable => \$defs{'netcat'}, -justify => 'left', -anchor => 'nw', -wraplength => 450)->pack(-side => 'top', -fill => 'x');
$transfer_win_cryptcat = $transfer_win->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$cmd_cryptcat = $transfer_win_cryptcat->Button(-image => $img_cryptcat, -command=> sub{$transfer_mode = 'Cryptcat';$transfer_mode_cmd = 'cryptcat'; $cmd_netcat->configure(-relief => 'raised');$cmd_cryptcat->configure(-relief => 'solid');$keyFrame->pack(-fill => 'x');}, -width => 50, -height => 45)->pack(-side=> 'left', -padx=>5, -pady=>5);
$transfer_win_cryptcat->Label (-text => 'Cryptcat:', -justify => 'left', -anchor => 'nw', -font => 'bold, 9')->pack(-side => 'top', -fill => 'x');
$transfer_win_cryptcat->Label (-textvariable => \$defs{'cryptcat'}, -justify => 'left', -anchor => 'nw', -wraplength => 450)->pack(-side => 'top', -fill => 'x');
############## Network Settings Frame
$connection_win_netOption = $transfer_win->LabFrame(-label => " Netcat/Cryptcat Network Settings ", -labelside => "acrosstop")->pack(-fill => "x");
$ipaddressFrame = $connection_win_netOption->Frame()->pack(-fill => 'x');
$ipaddressFrame->Label (-text => 'Remote IP: ', -justify => 'right', -anchor => 'e', -width => 10)->pack(-side => 'left');
$ipaddressTxt = $ipaddressFrame->Entry(-textvariable => \$ipaddress, -background=>'white', -relief => 'groove' )->pack(-side=>'left', -anchor => 'w');
$portFrame = $connection_win_netOption->Frame()->pack(-fill => 'x');
$portFrame->Label (-text => 'Port: ', -justify => 'right', -anchor => 'e', -width => 10)->pack(-side => 'left');
$portTxt = $portFrame->Entry(-textvariable => \$port, -background=>'white', -relief => 'groove', -width => 10 )->pack(-side=>'left', -anchor => 'w');
$keyFrame = $connection_win_netOption->Frame();
$keyFrame->Label (-text => 'Key: ', -justify => 'right', -anchor => 'e', -width => 10)->pack(-side => 'left');
$keyTxt = $keyFrame->Entry(-textvariable => \$key, -background=>'white', -relief => 'groove', -width => 10 )->pack(-side=>'left', -anchor => 'w');
}
sub build_io_win{
$src_file_path = '';
$dst_file_path = '';
$img_openFolder = $mw->Photo(-file=>$path.'/src/img/openFile.gif');
$paths_win = $level_5->LabFrame(-borderwidth => '2',-label => " IO Paths ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$paths_win->Label (-textvariable => \$defs{'paths'},-anchor=> 'nw', -height => 6, -justify => 'left', -wraplength => 600)->pack(-fill => 'x', -anchor=> 'w');
$paths_win_src = $paths_win->LabFrame(-label => "Input Device/File ",-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$srcTxt = $paths_win_src->BrowseEntry(-textvariable=> \$src_file_path ,-borderwidth=>0, -style=> 'MSWin32', -background=>'white', -relief => 'flat',-font=>[-family=>'Courier', -size=> 12] )->pack(-side=>'left', -anchor => 'w', -expand=>1, -fill=>'both', -ipadx=>7, -ipady=>5);
$paths_win_src->Button(-image => $img_openFolder, -command=> \&srcOpenFile)->pack(-side=>'top', -anchor => 'w', -ipadx=> 7, -ipady=> 7);
$srcTxt->insert('end', '');
if ($system eq 'Linux'){
@getinfo = `cat /proc/partitions`;
my $xx=0;
foreach (@getinfo){
chomp;
if ($_ =~ m/^.*\s+(\d+)\s+(sd[a-z]|hd[a-z])$/){
$xx++;
$sizeReadable = scaleIt($1*1024);
$srcTxt->insert('end', "Device$xx ($sizeReadable)");
$devicesListNames{'/dev/'.$2} = ($1*1024);
$devicesListHardware{"Device$xx ($sizeReadable)"} = $2;
}
}
}elsif ($system eq 'Mac'){
@getinfo = `diskutil list | grep /dev/`;
my $xx=0;
foreach (@getinfo){
chomp;
$line = `diskutil info $_ | grep 'Total Size:'`;
if ($line =~ m/^.*\s+\((\d+)\s+Bytes\).*$/){
$xx++;
$sizeReadable = scaleIt($1);
$srcTxt->insert('end', "Device$xx ($sizeReadable)");
$devicesListNames{$_} = ($1);
$devicesListHardware{"Device$xx ($sizeReadable)"} = $_;
}
}
}elsif ($system eq 'Windows'){
@getinfo = `$cygwinPath/cat /proc/partitions`;
my $xx=0;
foreach (@getinfo){
chomp;
if ($_ =~ m/^.*\s+(\d+)\s+(sd[a-z]|hd[a-z])$/){
$xx++;
$sizeReadable = scaleIt($1*1024);
$srcTxt->insert('end', "Device$xx ($sizeReadable)");
$devicesListNames{'/dev/'.$2} = ($1*1024);
$devicesListHardware{"Device$xx ($sizeReadable)"} = $2;
}
}
}
$paths_win_dst = $paths_win->LabFrame(-label => "Output File ",-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$dstTxt = $paths_win_dst->Entry(-textvariable=> \$dst_file_path ,-background=>'white', -relief => 'flat',-font=>[-family=>'Courier', -size=> 12] )->pack(-side=>'left', -anchor => 'w', -expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$paths_win_dst->Button(-image => $img_openFolder, -command=> \&dstSaveFile)->pack(-side=>'top', -anchor => 'w', -ipadx=> 7, -ipady=> 7);
}
sub build_ddOptions_win{
$dd_bs=512;
$ddOptions_win = $level_6->LabFrame(-borderwidth => '2',-label => " dd Options ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$ddOptions_win_top = $ddOptions_win->Frame()->pack(-side => 'top', -fill => 'both');
############ left side of DD options frame
$ddOptions_win_left = $ddOptions_win_top->Frame()->pack(-side => 'left', -fill => 'y');
$ddOptions_win_bs = $ddOptions_win_left->Frame()->pack(-fill => 'x');
$ddOptions_win_bs->Label (-width => 7, -text => 'BS', -anchor => 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$ddOptions_win_bs_f = $ddOptions_win_bs->Frame(-relief => 'groove',-borderwidth => 2)->pack(-fill => 'x');
$bsTxt = $ddOptions_win_bs_f->BrowseEntry(-textvariable=> \$dd_bs ,-background=>'white', -relief => 'flat',-font=>[-family=>'Courier', -size=> 12] )->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$bsTxt->insert('end', '');
$bsTxt->insert('end', '512');
$bsTxt->insert('end', '1024');
$bsTxt->insert('end', '2048');
$bsTxt->insert('end', '4096');
$bsTxt->insert('end', '8192');
$bsTxt->insert('end', '10240');
$bsTxt->insert('end', '16384');
$bsTxt->insert('end', '32768');
$bsTxt->insert('end', '65536');
$bsTxt->insert('end', '131072');
$ddOptions_win_ibs = $ddOptions_win_left->Frame()->pack(-fill => 'x');
$ddOptions_win_ibs->Label (-width => 7,-text => 'iBS',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$ibsTxt = $ddOptions_win_ibs->Entry(-textvariable=> \$dd_ibs, -relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$ddOptions_win_obs = $ddOptions_win_left->Frame()->pack(-fill => 'x');
$ddOptions_win_obs->Label (-width => 7,-text => 'oBS',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$obsTxt = $ddOptions_win_obs->Entry(-textvariable=> \$dd_obs , -relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$ddOptions_win_cbs = $ddOptions_win_left->Frame()->pack(-fill => 'x');
$ddOptions_win_cbs->Label (-width => 7,-text => 'CBS',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$cbsTxt = $ddOptions_win_cbs->Entry(-textvariable=> \$dd_cbs, -relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
############ right side of DD options
$ddOptions_win_right = $ddOptions_win_top->Frame()->pack(-side => 'right', , -fill => 'y');
$ddOptions_win_count = $ddOptions_win_right->Frame()->pack(-fill => 'x');
$ddOptions_win_count->Label (-width => 7, -text => 'COUNT',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$countTxt = $ddOptions_win_count->Entry(-textvariable=> \$dd_count ,-relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$ddOptions_win_seek = $ddOptions_win_right->Frame()->pack(-fill => 'x');
$ddOptions_win_seek->Label (-width => 7,-text => 'SEEK',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$seekTxt = $ddOptions_win_seek->Entry(-textvariable=> \$dd_seek ,-relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$ddOptions_win_skip = $ddOptions_win_right->Frame()->pack(-fill => 'x');
$ddOptions_win_skip->Label (-width => 7,-text => 'SKIP',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$skipTxt = $ddOptions_win_skip->Entry(-textvariable=> \$dd_skip ,-relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
$ddOptions_win_status = $ddOptions_win_right->Frame()->pack(-fill => 'x');
$ddOptions_win_status->Label (-width => 7,-text => 'STATUS',-anchor=> 'w')->pack(-side=>'top', -expand=>1, -fill=>'both');
$status = $ddOptions_win_status->Entry(-textvariable=> \$dd_status ,-relief => 'groove',-font=>[-family=>'Courier', -size=> 12] ,-background=>'white', -relief => 'flat')->pack(-side=>'top',-expand=>1, -fill=>'both', -ipadx=>5, -ipady=>5);
################## CONV Options
$ddOptions_win_otherOptions = $ddOptions_win->Frame()->pack(-side=> 'left', -expand => 1, -fill=>'x');
$ddOptions_win_conv_frame = $ddOptions_win_otherOptions->LabFrame(-label=> 'CONV Options ', -borderwidth => 2, -relief => 'groove')->pack(-side=>'left', -fill => 'x', -expand => 1);
$ddOptions_win_conv_c1 = $ddOptions_win_conv_frame->Frame()->pack(-side => 'left', -expand => 1);
$ddOptions_win_conv_c1->Checkbutton(-variable=> \$ascii ,-text => "ascii")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c1->Checkbutton(-variable=> \$ebcdic, -text => "ebcdic")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c1->Checkbutton(-variable=> \$ibm, -text => "ibm")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c1->Checkbutton(-variable=> \$block, -text => "block")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c1->Checkbutton(-variable=> \$unblock, -text => "unblock")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c2 = $ddOptions_win_conv_frame->Frame()->pack(-side => 'left', -expand => 1);
$ddOptions_win_conv_c2->Checkbutton(-variable=> \$lcase, -text => "lcase")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c2->Checkbutton(-variable=> \$ucase, -text => "ucase")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c2->Checkbutton(-variable=> \$nocreat, -text => "nocreat")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c2->Checkbutton(-variable=> \$excl, -text => "excl")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c2->Checkbutton(-variable=> \$notrunc, -text => "conv")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c3 = $ddOptions_win_conv_frame->Frame()->pack(-side => 'left', -expand => 1);
$ddOptions_win_conv_c3->Checkbutton(-variable=> \$swab, -text => "notrunc")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c3->Checkbutton(-variable=> \$noerror, -text => "noerror")->pack(-side=> 'top', -anchor=> 'w')->select();
$ddOptions_win_conv_c3->Checkbutton(-variable=> \$sync, -text => "sync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c3->Checkbutton(-variable=> \$fdatasync, -text => "fdatasync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_conv_c3->Checkbutton(-variable=> \$fsync, -text => "fsync")->pack(-side=> 'top', -anchor=> 'w');
################## iFLAG Options
$ddOptions_win_iflag_frame = $ddOptions_win_otherOptions->LabFrame(-label=> 'iFLAG Options ', -borderwidth => 2, -relief => 'groove')->pack(-side=>'right', -fill => 'x', -expand => 1);
$ddOptions_win_iflag_c1 = $ddOptions_win_iflag_frame->Frame()->pack(-side => 'left', -expand => 1, -fill=>'x');
$ddOptions_win_iflag_c1->Checkbutton(-variable=> \$i_append, -text => "append")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c1->Checkbutton(-variable=> \$i_direct, -text => "direct")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c1->Checkbutton(-variable=> \$i_dsync, -text => "dsync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c1->Checkbutton(-variable=> \$i_sync, -text => "sync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c1->Checkbutton(-variable=> \$i_fullblock, -text => "fullblock")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c2 = $ddOptions_win_iflag_frame->Frame()->pack(-side => 'left', -fill => 'both');
$ddOptions_win_iflag_c2->Checkbutton(-variable=> \$i_nonblock, -text => "nonblock")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c2->Checkbutton(-variable=> \$i_noatime, -text => "noatime")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c2->Checkbutton(-variable=> \$i_noctty, -text => "noctty")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_iflag_c2->Checkbutton(-variable=> \$i_nofollow, -text => "nofollow")->pack(-side=> 'top', -anchor=> 'w');
################## oFLAG Options
$ddOptions_win_oflag_frame = $ddOptions_win_otherOptions->LabFrame(-label=> 'oFLAG Options ', -borderwidth => 2, -relief => 'groove')->pack(-side=>'right', -fill => 'both', -expand => 1);
$ddOptions_win_oflag_c1 = $ddOptions_win_oflag_frame->Frame()->pack(-side => 'left', -expand => 1, -fill=>'x');
$ddOptions_win_oflag_c1->Checkbutton(-variable=> \$o_append, -text => "append")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c1->Checkbutton(-variable=> \$o_direct, -text => "direct")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c1->Checkbutton(-variable=> \$o_dsync, -text => "dsync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c1->Checkbutton(-variable=> \$o_sync, -text => "sync")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c1->Checkbutton(-variable=> \$o_fullblock, -text => "fullblock")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c2 = $ddOptions_win_oflag_frame->Frame()->pack(-side => 'left', -fill => 'both');
$ddOptions_win_oflag_c2->Checkbutton(-variable=> \$o_nonblock, -text => "nonblock")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c2->Checkbutton(-variable=> \$o_noatime, -text => "noatime")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c2->Checkbutton(-variable=> \$o_noctty, -text => "noctty")->pack(-side=> 'top', -anchor=> 'w');
$ddOptions_win_oflag_c2->Checkbutton(-variable=> \$o_nofollow, -text => "nofollow")->pack(-side=> 'top', -anchor=> 'w');
}
sub build_checksum_win{
#Container Frame
$Options_win = $level_7->Frame(-relief => 'groove', -borderwidth => '2')->pack(-fill => "both", -expand => 1);
#Checksum Options Frame
$checksumOptions_win_frame = $Options_win->LabFrame(-label=> 'Checksum Options ', -borderwidth => 2, -relief => 'groove')->pack(-anchor=> 'e', -side=>'top', -fill => 'both');
$checksumOptions_win_frame_c1 = $checksumOptions_win_frame->Frame()->pack(-side => 'left', -expand => 1, -fill=>'x');
$checksumOptions_win_frame_c1->Checkbutton(-variable=> \$checksum_md5, -text => "MD5")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c1->Checkbutton(-variable=> \$checksum_sha1, -text => "SHA-1")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c1->Checkbutton(-variable=> \$checksum_sha256, -text => "SHA-256")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c2 = $checksumOptions_win_frame->Frame()->pack(-side => 'left', -expand => 1);
$checksumOptions_win_frame_c2->Checkbutton(-variable=> \$checksum_sha384, -text => "SHA-384")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c2->Checkbutton(-variable=> \$checksum_sha512, -text => "SHA-512")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c2->Checkbutton(-variable=> \$checksum_tiger, -text => "Tiger")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c3 = $checksumOptions_win_frame->Frame()->pack(-side => 'left', -expand => 1);
$checksumOptions_win_frame_c3->Checkbutton(-variable=> \$checksum_whirlpool, -text => "Whirlpool")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c3->Checkbutton(-variable=> \$checksum_crc, -text => "CRC")->pack(-side=> 'top', -anchor=> 'w');
$checksumOptions_win_frame_c3->Checkbutton(-variable=> \$checksum_adler32, -text => "Adler32")->pack(-side=> 'top', -anchor=> 'w');
#Report Options Frame
$ReportOptions_win = $Options_win->LabFrame(-label=> 'Report Options ', -borderwidth => 2, -relief => 'groove')->pack(-anchor=> 'e', -side=>'top', -fill => 'x');
$ReportOptions_win->Label (-text=> 'Title:')->pack(-side=>'top',-anchor=> 'w');
$reportTitle_txt = $ReportOptions_win->Entry(-textvariable=> \$reportTitle ,-width=> 30, -background=>'white', -relief => 'groove', -font=>[-family=>'Courier', -size=> 14] )->pack(-side=>'top', -anchor => 'w', -expand=>1, -fill=>'x', -ipadx=> 5, -ipady=> 5);
$ReportOptions_win->Label (-text=> 'Name:')->pack(-side=>'top',-anchor=> 'w');
$reportAuthor_txt = $ReportOptions_win->Entry(-textvariable=> \$reportAuthor ,-width=> 30, -background=>'white', -relief => 'groove', -font=>[-family=>'Courier', -size=> 14] )->pack(-side=>'top', -anchor => 'w', -expand=>1, -fill=>'x', -ipadx=> 5, -ipady=> 5);
$ReportOptions_win->Label (-text=> 'Organization:')->pack(-side=>'top',-anchor=> 'w');
$reportOrg_txt = $ReportOptions_win->Entry(-textvariable=> \$reportOrg ,-width=> 30, -background=>'white', -relief => 'groove', -font=>[-family=>'Courier', -size=> 14] )->pack(-side=>'top', -anchor => 'w', -expand=>1, -fill=>'x', -ipadx=> 5, -ipady=> 5);
}
sub build_confirmation_win{
$confirmation_win = $level_8->LabFrame(-borderwidth => '2',-label => " Confirmation ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$confirmTxt = $confirmation_win->Scrolled("ROText", -scrollbars => "se", -width => 50, -height => 12 )->pack();
$confirmTxt->pack(-side => 'bottom', -fill => 'both', -expand => 1);
}
sub build_status_win{
$status_win = $level_9->LabFrame(-borderwidth => '2',-label => " Status ",-labelside => "acrosstop")->pack(-fill => "both", -expand => 1);
$status_frame = $status_win->Frame()->pack(-side=> 'top', -fill => 'x', -expand => 1);
$remainedTime = '00:00:00';
$status_frame_r = $status_frame->Frame()->pack(-side=> 'left', -fill => 'x', -expand => 1);
$status_frame_r->Label (-text=> 'Remaining Time:', -anchor => 'w')->pack( -side=>'top', -fill => 'x');
$status_frame_r->Entry (-textvariable=> \$remainedTime, -relief=>'groove', -state=> 'disabled', -font=>'courier')->pack(-side=>'top',-fill => 'none');
$elapsedTime = '00:00:00';
$status_frame_l = $status_frame->Frame()->pack(-side=> 'right', -fill => 'x', -expand => 1);
$status_frame_l->Label (-text=> 'Elapsed Time:', -anchor => 'e')->pack(-side=>'top',-fill=>'x');
$status_frame_l->Entry (-textvariable=> \$elapsedTime, -relief=>'groove', -state=> 'disabled', -font=>'courier',-justify => 'right')->pack(-side=>'top',-fill=>'none');
$percentage = '0%';
$status_frame_m = $status_frame->Frame()->pack(-side=> 'left', -fill => 'both', -expand => 1);
$status_frame_m->Label (-text=> 'Progress:', -anchor => 'w')->pack(-side=>'top',-fill=>'x');
$status_frame_m->Entry (-textvariable=> \$percentage,-relief=>'groove', -state=> 'disabled', -font=>'courier', -justify => 'center')->pack(-side=>'bottom', -fill => 'x');
$progress = $status_win->ProgressBar(-borderwidth=>1, -width => 20,-from => 0,-gap=>0,-to => 100,-blocks => 50,-colors => \@colors,-variable => \$percent_done)->pack(-fill => "x", -expand => 1, -pady=>0);
$summaryTxt = $status_win->Scrolled("ROText",-background => 'gray', -scrollbars => "se", -width => 50, -height => 12 )->pack();
$summaryTxt->pack(-side => 'bottom', -fill => 'both', -expand => 1);
}
sub setMode {
if ($_ eq 'Local'){
$mode = 'Local'; $cmd_local->configure(-relief => 'solid');$cmd_remote->configure(-relief => 'raised');
$mw->update();
}elsif ($_ eq 'Remote'){
$mode = 'Remote';
$cmd_remote->configure(-relief => 'solid');
$cmd_local->configure(-relief => 'raised');
$mw->update();
}
}
sub validateIP{
$ipaddress_ = $ipaddressTxt->get;
if( $ipaddress_ eq '' ){
return 'false';
}else{
return 'true';
}
}
sub validatePort{
$port_ = $portTxt->get;
if( $port_ eq '' ){
return 'false';
}else{
return 'true';
}
}
sub srcOpenFile{
$src_file_path = $mw->getOpenFile();
if (!defined($src_file_path)){
$src_file_path = "Error to open path";
}
$mw->update;
$src_path = $src_file_path;
$process = 'Active';
}
sub dstSaveFile{
$dst_file_path = $mw->getSaveFile();
if (!defined($dst_file_path)){
$dst_file_path = "Error to open path";
}
$mw->update;
$dst_path = $dst_file_path;
}
sub updateConfirmationText{
$confirmMsg="";
$confirmMsg .= "Imaging Mode: $mode";
$confirmMsg .= "\nConnection Mode: $connection" if ($mode eq 'remote');
$confirmMsg .= "\nRemote IP: $ipaddress" if (($mode eq 'remote') and ($connection eq 'Sender' ));
$confirmMsg .= "\nPort: $port" if ($mode eq 'remote');
$confirmMsg .= "\nTunneling Mode: $transfer_mode" if ($mode eq 'remote');
if ($src_file_path =~ m/^Device\d+\s+/){
$src_file_path = '/dev/'.$devicesListHardware{$src_file_path};
}
$confirmMsg .= "\n\nInput Device/File: $src_file_path";
$confirmMsg .= "\nOutput File: $dst_file_path";
$confirmMsg .= "\n\nDD Options:";
$confirmMsg .= "\n BS: $dd_bs K" if $dd_bs;
$confirmMsg .= "\n iBS: $dd_ibs K" if $dd_ibs;
$confirmMsg .= "\n oBS: $dd_obs K" if $dd_obs;
$confirmMsg .= "\n CBS: $dd_cbs K" if $dd_cbs;
$confirmMsg .= "\n COUNT: $dd_count K" if $dd_count;
$confirmMsg .= "\n SEEK: $dd_seek K" if $dd_seek;
$confirmMsg .= "\n SKIP: $dd_skip K" if $dd_skip;
$confirmMsg .= "\n STATUS: $dd_status" if $dd_status;
$confirmMsg .= "\n CONV:" if ($ascii or $ebcdic or $ibm or $block or $unblock or $lcase or $ucase or $nocreat or $excl);
$confirmMsg .= " ascii," if $ascii;
$confirmMsg .= " ebcdic," if $ebcdic;
$confirmMsg .= " ibm," if $ibm;
$confirmMsg .= " block," if $block;
$confirmMsg .= " unblock," if $unblock;
$confirmMsg .= " lcase," if $lcase;
$confirmMsg .= " ucase," if $ucase;
$confirmMsg .= " nocreat," if $nocreat;
$confirmMsg .= " excl," if $excl;
$confirmMsg .= "\n iFLAG:" if ($i_append or $i_direct or $i_dsync or $i_sync or $i_fullblock or $i_nonblock or $i_noatime or $i_noctty or $i_nofollow);
$confirmMsg .= " append," if $i_append;
$confirmMsg .= " direct," if $i_direct;
$confirmMsg .= " dsync," if $i_dsync;
$confirmMsg .= " sync," if $i_sync;
$confirmMsg .= " fullblock," if $i_fullblock;
$confirmMsg .= " nonblock," if $i_nonblock;
$confirmMsg .= " noatime," if $i_noatime;
$confirmMsg .= " noctty," if $i_noctty;
$confirmMsg .= " nofollow," if $i_nofollow;
$confirmMsg .= "\n oFLAG:" if ($o_append or $o_direct or $o_dsync or $o_sync or $o_fullblock or $o_nonblock or $o_noatime or $o_noctty or $o_nofollow);
$confirmMsg .= " append," if $o_append;
$confirmMsg .= " direct," if $o_direct;
$confirmMsg .= " dsync," if $o_dsync;
$confirmMsg .= " sync," if $o_sync;
$confirmMsg .= " fullblock," if $o_fullblock;
$confirmMsg .= " nonblock," if $o_nonblock;
$confirmMsg .= " noatime," if $o_noatime;
$confirmMsg .= " noctty," if $o_noctty;
$confirmMsg .= " nofollow," if $o_nofollow;
$confirmMsg .= "\n\nHash Options:\n" if ($checksum_md5 or $checksum_sha1 or $checksum_sha256 or $checksum_sha384 or $checksum_sha512 or $checksum_tiger or $checksum_whirlpool or $checksum_crc or $checksum_adler32);
$confirmMsg .= " MD5," if $checksum_md5;
$confirmMsg .= " SHA1," if $checksum_sha1;
$confirmMsg .= " SHA256," if $checksum_sha256;
$confirmMsg .= " SHA384," if $checksum_sha384;
$confirmMsg .= " SHA512," if $checksum_sha512;
$confirmMsg .= " Tiger," if $checksum_tiger;
$confirmMsg .= " Whirlpool," if $checksum_whirlpool;
$confirmMsg .= " crc," if $checksum_crc;
$confirmMsg .= " Adler32," if $checksum_adler32;
&ddUpdatOptions;
$confirmMsg .= "\n\ndd Full Command:\n".' '.$dd_cmd;
$confirmMsg .= "\n\nReport Options:\n" if ($reportTitle or $reportAuther or $reportOrg);
$confirmMsg .= " Title: $reportTitle" if $reportTitle;
$confirmMsg .= "\n Author: $reportAuthor" if $reportAuthor;
$confirmMsg .= "\n Organization: $reportOrg" if $reportOrg;
$confirmTxt->configure(-state => 'normal');
$confirmTxt->delete('0.0','end');
$confirmTxt->insert('end',$confirmMsg);
$mw->update();
}
sub ddCall{
# Thread termination signal
$SIG{'KILL'} = sub { threads->exit(); };
system($dd_cmd);
return'';
}
sub enableChecksums{
for($checksumOptions_win_frame_c1->children){
$_->configure(-state=>'normal');
}
for($checksumOptions_win_frame_c2->children){
$childName = $_->cget('-text');
if (($src_file_path =~ m/^Device\d+\s+/) and ($childName eq 'Tiger') and ($system eq 'Windows') ){
$_->configure(-state=>'disabled');
}else{
$_->configure(-state=>'normal');
}
}
for($checksumOptions_win_frame_c3->children){
if ( ($src_file_path =~ m/^Device\d+\s+/) and ($system eq 'Windows') ){
$_->configure(-state=>'disabled');
}else{
$_->configure(-state=>'normal');
}
}
}
sub disableChecksums{
for($checksumOptions_win_frame_c1->children){
$_->configure(-state=>'disabled');
}
for($checksumOptions_win_frame_c2->children){
$_->configure(-state=>'disabled');
}
for($checksumOptions_win_frame_c3->children){
$_->configure(-state=>'disabled');
}
}
sub verifyIntegrity_local{
$hashing_start_sec = time();
$hash_verify_msg='';
$report_msg='';
if ($checksum_md5 ){
require Digest::MD5;
if (($src_file_path =~ m/^\/dev\//) and ($system eq 'Windows')){
$src_md5_msg = `$cygwinPath/md5sum $src_file_path`;
chomp $src_md5_msg;
($src_md5_msg, $_) = split /\s+/, $src_md5_msg;
}else{
$src_md5 = Digest::MD5->new;
open(my $MD5S,'<',"$src_file_path") or die "Error to open the input media";
binmode($MD5S);
$src_md5->addfile($MD5S);
$src_md5_msg = $src_md5->hexdigest;
close $MD5S;
}
$dst_md5 = Digest::MD5->new;
open(my $MD5D,'<',"$dst_file_path") or die "Error to open the output image file";
binmode($MD5D);
$dst_md5->addfile($MD5D);
$dst_md5_msg = $dst_md5->hexdigest;
if ($src_md5_msg == $dst_md5_msg){
$hash_verify_msg = $hash_verify_msg."MD5 Test: Match\n Input: ".$src_md5_msg."\n Output: ".$dst_md5_msg."\n\n";
}else{
$hash_verify_msg = $hash_verify_msg."MD5 Test: Mismatch\n Input: ".$src_md5_msg."\n Output: ".$dst_md5_msg."\n\n";
}
}
if ($checksum_sha1 ){