-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzharf.c
5740 lines (4539 loc) · 111 KB
/
zharf.c
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
/*
By Sirus Shahini
~cyn
*/
#include "head.h"
#include "hash.h"
char *target_path;
char *input_dir;
char *output_dir;
char **target_argv;
int cmd_send[2];
int response_recv[2];
#define COUT cmd_send[1]
#define RIN response_recv[0]
//#define BUILD_GRAPH
u8 should_store_graph=0;
#define ERR_TMOUT EAGAIN
int dev_null;
int feed_fd;
int file_feed;
char *feed_file_path;
int shm_id = -1;
void *shm_adr=0;
void *shm_end;
int starter_id;
char CURRENT_INPUT[] = ".current_input";
char TMP_INPUT[] = "tmp_input";
#define MAX_INPUT_SIZE (1<<15) //32KB
#define MIN_INPUT_SIZE (16)
u8 mut_map[MAX_INPUT_SIZE];
#define MAX_KEYWORDS 32
#define MAX_KW_SIZE 16
struct keyword {
u8 kw[MAX_KW_SIZE];
u8 size;
} keywords[MAX_KEYWORDS];
u8 kw_index = 0;
#define DICT_MAX_KEYWORDS 1024
#define DICT_MAX_KW_SIZE 32
char *dict_kws[DICT_MAX_KEYWORDS];
char *dict_file=0;
int dict_kw_count=0;
u32 current_csum;
u32 last_csum;
u8 need_csum;
int gcount =0 ;
int save_i_count = 0;
u8 sort_low_prio = 1;
u8 net_mode=0;
int tcp_port;
ID_SIZE dfs_list[NODES_MAX];
long dl_index=-1;
u32 graph_e_count=0;
int crash_rep=0;
#define MAX_EDGES_VISIBLE 200
#define GRAPH_FILES_COUNT 8
struct tree *shared_trace_tree;
#define MAX_LOCAL_BLOCKS NODES_MAX
struct block_info_local{
ID_SIZE id;
u64 hits;
} sorted_blocks[MAX_LOCAL_BLOCKS];
long block_ind = -1;
int target_id;
int target_timedout=0;
#define TRG_EX_NORMAL 1
#define TRG_EX_TMOUT 2
#define TRG_EX_CRASH 3
#define TRG_SOFT_CRASH 4
#define TRG_NET_MODE 10
#define MAX_TIMEOUT_VAL_INIT 100000
#define MAX_TIMEOUT_VAL_RUN 90000
#define MIN_TIMEOUT_VAL 20000
#define TOI_RATE 2
u64 active_timeout = MAX_TIMEOUT_VAL_INIT ;
u64 active_timeout_sav;
long user_timeout=-1;
u8 save_soft_crash=0;
#define CONNECT_WAIT 100000
#define CONN_MAX_RETRIES 5
#define RECV_WAIT 20000
int net_sock=-1;
struct sockaddr_in target_saddr;
char *target_ip = "127.0.0.1";
u32 input_count = 0;
#define LIVE_REP_FILE "/var/www/html/zharflive/zharf_live"
//#define LIVE_STAT
#define STAT_ENTRIES_FILE "stat_entries"
char stat_line[255];
u8 use_term_gui = 1;
u64 total_crashes=0;
u64 soft_crashes=0;
u64 unique_soft_crashes=0;
u64 unique_crashes=0;
int mut_input_saved=0;
char current_stat[255];
u64 _st_bl,_st_indp,_st_nes;
#define MAX_BREFR_FREQ 1000
u32 brefr_freq = 20;
u32 brefr_freq_counter=0;
u8 zharf_init_state = 1;
s8 set_8_ints[] = {_8_ints};
s16 set_16_ints[] = {_8_ints , _16_ints};
s32 set_32_ints[] = {_8_ints , _16_ints , _32_ints};
u8 has_corrupted_shm=0;
//***************** Debug Definitions *************************
struct node *_debug_node;
u8 debug_mode = 0;
int debug_exit_code;
int debug_exit_stat;
u8 *debug_data;
size_t debug_data_size;
u64 debug_rec_ind = 0;
u64 debug_rec_dir = 0;
#define RECORD_FEEDS
u8 should_save_mem = 0;
u8 coverage_only = 0;
u8 state_slow_warn=0;
//***************************************************************
int perf_check_req;
int perf_check = 0;
u8 queue_hit_sl=0;
u8 cov_show_only = 0;
char * cmt ;
int attached_core;
#define CRASH_MAX 10000
u32 crash_sums[CRASH_MAX];
int crash_sums_index = 0;
#define MAX_INTR_LOCS 1024
#define MIN_INTR_LOC_COUNT 8
struct inp_intr_locs{
int intr_locs_index;
size_t intr_locs[MAX_INTR_LOCS];
};
u8 add_to_inputs = 0;
u64 *lib_lock;
u8 save_net=0;
int save_net_i = 0;
#define NET_FILE "debug/net/net_file"
time_t start_time;
#define INPUT_MAX 8000
struct input_val{
char i_path[MAX_PATH];
u8 initial;
int depth;
u64 total_blocks;
u64 total_hits;
u32 hash;
u8 prio;
u8 passed;
u64 leaves;
struct inp_intr_locs *i_intr_locs;
u8 fixed_loc;
u8 marked;
};
u8 lpq_balance =1 ;
u8 visited_lp=0;
u8 marked_tree=0;
u64 total_covered=0;
u64 total_exec=0;
u64 nested_counter=0;
u64 indp_counter=0;
u64 total_target_hits=0;
u64 last_trace_nodes=0;
u64 last_trace_leaves=0;
int last_crash_sig;
u8 last_crash_mut;
#define SHOULD_SKIP_COUNT 100
u32 skip_nodes=0;
u8 target_mult_threaded = 0;
struct input_val input_queue[INPUT_MAX];
int queue_ind;
#define last_added_q_i (queue_ind-1)
int queue_use_ind;
int max_depth=0;
int min_depth=10000;
u8 depth_grew=0;
u64 max_coverage_tree_nodes=0;
u8 invd_tree_nodes_grew = 0;
int output_count=0;
u8 enable_custom_cleanup = 0;
/*
User's custom cleanup commands here.
Example:
{"rm /tmp/file1","mkdir ~/test"}
*/
char * cleanup_cmds[]={""};
/**************************** PRIORITY MODEL DEFINITIONS HERE *******************/
/*
Tree Depth First : TDF : 0
Tree Nodes First : TNF : 1
Tree No Sort : TNS : 2
Add more priority models identifiers here
*/
u8 pm_mode = 0;
char *pm_str=0;
#define DEFAULT_PM_STR "TDF"
#define MLPSD_ALLOWED 2
#define LPSD_MAX_DEPTH 2048
u8 LPSD_queue[LPSD_MAX_DEPTH];
u8 LPSD_queue_wait[LPSD_MAX_DEPTH];
#define MLPSC_ALLOWED 2
#define LPSC_MAX_NODES (1<<16)
u8 *LPSC_queue;
u8 *LPSC_queue_wait;
u64 last_exec_inq=0, last_etime_inq=0;
struct sig_descriptor{
int id;
char name[20];
};
#define SIG_SET_SIZE 32
struct sig_descriptor sig_set[SIG_SET_SIZE]={
{1, "SIGHUP" },
{2, "SIGINT" },
{3, "SIGQUIT" },
{4, "SIGILL" },
{5, "SIGTRAP" },
{6, "SIGABRT" },
{7, "SIGBUS" },
{8, "SIGFPE" },
{9, "SIGKILL" },
{10, "SIGUSR1" },
{11, "SIGSEGV" },
{12, "SIGUSR2" },
{13, "SIGPIPE" },
{14, "SIGALRM" },
{15, "SIGTERM" },
{16, "SIGSTKFLT" },
{17, "SIGCHLD" },
{18, "SIGCONT" },
{19, "SIGSTOP" },
{20, "SIGTSTP" },
{21, "SIGTTIN" },
{22, "SIGTTOU" },
{23, "SIGURG" },
{24, "SIGXCPU" },
{25, "SIGXFSZ" },
{26, "SIGVTALRM" },
{27, "SIGPROF" },
{28, "SIGWINCH" },
{29, "SIGIO" },
{30, "SIGPWR" },
{31, "SIGSYS" },
{32, "SIGRTMIN" }
};
/*******************************************************************************/
void terminate_units(){
use_term_gui = 0;
if (target_id>0){
kill(target_id,SIGKILL);
}
if (starter_id){
kill(starter_id,SIGKILL);
}
if (shm_adr){
if (shmctl(shm_id,IPC_RMID,0)==-1){
printf(CRED"Warning: Couldn't release shared memory.\n"CNORM);
}else{
printf("Released memory\n");
}
}
/*
else we're exiting at initialization
phase and memory has not been allocated.
*/
/*
All file cleanups here
*/
unlink(CURRENT_INPUT);
printf(SC);
}
char *convert_time(char *ts){
time_t cur_time;
long h,m,s;
time(&cur_time);
cur_time-=start_time;
h=cur_time/3600;
cur_time -= 3600*h;
m=cur_time/60;
s=cur_time-60*m;
sprintf(ts,"%02ld:%02ld:%02ld",h,m,s);
return ts;
}
void dump_hex(u8 *buf,u8 size,int start,int end){
int i;
int last=0;
char tmp[16];
char sect[16];
char *outbuf= malloc(2048);
outbuf[0] = 0;
for (i=0;i<size;i++){
if (i==start){
strcpy(sect,CRED);
}else if (i==end){
strcpy(sect,CNORM);
}else{
strcpy(sect,"");
}
sprintf(tmp,"%02X ",(u8)*((u8*)(buf)+i));
strcat(sect,tmp);
strcat(outbuf,sect);
last+=3;
if (i%8==7) strcat(outbuf," ");
if (i%16==15 || i==size-1) {
printf("%s\n",outbuf);
outbuf[0] = 0;
}
}
free(outbuf);
printf("\n");
}
void rep_use_time(){
char ts[128];
convert_time(ts);
printf("Total time: %s\n",ts);
}
void print_queue(){
int i;
for (i=0;i<queue_ind;i++){
if (_st_indp)
printf ("Q%d: \n\tdepth:%d %s prio=%d coverage=%lf nodes:%lu hits:%lu\n",i,
input_queue[i].depth,input_queue[i].i_path,input_queue[i].prio,
(double)input_queue[i].total_blocks/_st_indp,input_queue[i].total_blocks,
input_queue[i].total_hits);
else
printf ("Q%d: \n\tdepth:%d %s prio=%d coverage=%s nodes:%lu hits:%lu\n",i,
input_queue[i].depth,input_queue[i].i_path,input_queue[i].prio,
"N/A",input_queue[i].total_blocks,
input_queue[i].total_hits);
}
}
void zexit(char *fmt, ...){
char err_format[2048];
strcpy(err_format,CRED "[!]" CNORM " Fuzzer: ");
strcat(err_format,fmt);
strcat(err_format,"\n");
va_list argp;
va_start(argp,err_format);
vprintf(err_format,argp);
va_end(argp);
terminate_units();
printf(DStop);
if (!zharf_init_state)
rep_use_time();
exit(-1);
}
void rep(u8 warn, char *fmt, ...){
char msg_format[2048];
u8 should_print=0;
if (zharf_init_state || !use_term_gui){
should_print = 1;
}
if (!warn){
strcpy(msg_format,CGREEN "[-] " CNORM );
}
else{
strcpy(msg_format,CYELLOW "[W] " CNORM );
}
strcat(msg_format,fmt);
va_list argp;
if (should_print)
strcat(msg_format,"\n");
va_start(argp,msg_format);
if (!should_print){
if (!warn)
vsprintf(stat_line,msg_format,argp);
}
else{
vprintf(msg_format,argp);
}
if (warn){
/*
In gui mode this is the only place that we
want to see fuzzer warnings.
Reserve stat line for rep.
*/
vsprintf(current_stat,msg_format,argp);
}
va_end(argp);
}
#define zrep(fmt,...) rep(0,fmt __VA_OPT__(,) __VA_ARGS__)
#define zwarn(fmt,...) rep(1,fmt __VA_OPT__(,) __VA_ARGS__)
#define SPACE(n) do{\
int i;\
for (i=0;i<n;i++) printf(" ");\
}while(0);
void clear_warn(){
if (net_mode)
strcpy(current_stat,CGREEN"NORMAL [Network Mode]"CNORM);
else
strcpy(current_stat,CGREEN"NORMAL"CNORM);
}
char *exec_speed(char *cs){
struct timespec ctime;
u64 cur_timeus;
u64 espeed;
double distance_s;
clock_gettime(CLOCK_REALTIME,&ctime);
cur_timeus= ctime.tv_sec*1000000 + ctime.tv_nsec/1000;
distance_s = (cur_timeus-last_etime_inq)/1000000.0;
if (distance_s > 0.0){
espeed = (u64)((total_exec-last_exec_inq)/distance_s);
sprintf(cs,"%lu/sec",espeed);
brefr_freq = espeed/10;
brefr_freq=brefr_freq>MAX_BREFR_FREQ?MAX_BREFR_FREQ:brefr_freq;
if (espeed>0){
if ( espeed<20){
zwarn("Target is running too slow");
state_slow_warn=1;
}
else if (state_slow_warn){
clear_warn();
state_slow_warn=0;
}
}
}else{
sprintf(cs,">%lu/sec",total_exec);
}
last_exec_inq = total_exec;
last_etime_inq = cur_timeus;
return cs;
}
char *get_sig_name(int signum){
int i;
for (i=0;i<SIG_SET_SIZE;i++){
if (signum==sig_set[i].id)
return sig_set[i].name;
}
zwarn("Unknown crash signal from target: %d",signum);
return "UNKNOWN";
}
char * psect(char *buf,int rlen,char *fmt, ...){
char sbuf[255];
int len;
int i;
buf[0]=0;
sbuf[0] = 0;
va_list argp;
va_start(argp,fmt);
vsprintf(buf,fmt,argp);
va_end(argp);
len = strlen(buf);
if (len<rlen){
for (i=0;i<(rlen-len);i++)
strcat(sbuf," ");
strcat(buf,sbuf);
}else if(len>rlen){
buf[len] = 0; //trim
}
return buf;
}
char * show_data(char *buf,void *orig_data,size_t len,size_t start,size_t end){
size_t i;
char line[255];
char tmp[255];
char *s;
int finished =0 ;
u8 extra;
int len_limit = 128;
u8 pad = 0;
int page ;
void *data ;
u8 mut_area=0;
size_t orig_start,orig_end,orig_len;
orig_start=start;
orig_end=end;
orig_len=len;
if (start==-1){
zexit("Borad: Wrong arg START <%s> ",cmt);
}
if (end>=len){
end=len-1;
}
if (len<=start || len<=end || end < start || (start==end && start==0)){
zexit("Board wrong intpus: %d,%d,%d <%s> ",start,end,len,cmt);
}
if (start==end){
start--;
}
page=(start/len_limit);
data = orig_data + (128*page);
len = len - 128*page;
if (len>len_limit)
len = len_limit;
if (start >= len_limit) start = start % len_limit;
if (end >= len_limit) end = end % len_limit;
if (len<=(len_limit-16)) pad=1;
if (start >= len || end>=len){
zexit("Board: args overflow page offset %d,%d,%d %d,%d,%d <%s> ",start,end,len,
orig_start,orig_end,orig_len,cmt);
}
#define APPEND psect(tmp,78+extra,line);\
strcpy(line,DStart VR DStop);\
strcat(line,tmp);\
strcat(line,DStart VR DStop);\
strcat(buf,line);\
if (finished) break;\
strcat(buf,"\n");\
strcpy(line,_15SP);
s=&line[15];
extra = 0;
buf[0]=0;
for (i=0;i<len_limit;i++){
if (i==start && i%16!=15){
strcpy(s,CRED);
s+=7;
extra+=7;
mut_area=1;
}
if (i==end || i==len_limit-1){
strcpy(s,CNORM);
s+=4;
extra+=4;
mut_area=0;
}
if (i%16==0 && mut_area){
strcpy(s,CRED);
s+=7;
extra+=7;
}
sprintf(s,"%02x",((unsigned char*)data)[i]);
if (i==len-1){
finished = 1;
strcpy(s+2,CNORM);
extra+=4;
APPEND
}
if (i%16==15){
if (i+1==len) finished=1;
if (mut_area){
strcpy(s+2,CNORM);
extra+=4;
}
APPEND
strcpy(line,_15SP);
s=&line[15];
extra = 0;
}else{
strcat(s," ");
s+=3;
}
}
if (pad){
line[0]=0;
extra=0;
finished=0;
strcat(buf,"\n");
i = ((i/16)+1)*16;
for (;i<len_limit;i++){
if (i%16==15){
if (i+1==len_limit) finished=1;
APPEND
line[0]=0;
}
}
}
return buf;
}
void refresh_board(void *data,size_t size,size_t start,size_t end){
char buf[1024];
char line[1024];
char tmp[255];
char line2[1024];
char tmp2[255];
char *sleft,*sright;
int i,_is,_ie;
static u8 cleared_once = 0;
if (!use_term_gui) return;
if (!cleared_once){
printf(DC);
cleared_once = 1;
}
printf(DH);
printf("\n");
SPACE(31) printf(CLGREEN"ZHARF <VERSION 1.1>\n");
SPACE(32) printf("By Sirus Shahini\n"CNORM);
printf(DStart LCD _32HO _6HO BHD BHD _32HO _6HO RCD DStop "\n" );
printf(DStart VR DStop);
i=strlen(target_path);
if (strlen(target_path)<18)
printf("%s",psect(buf,38+22,CDBlue"Target: "CNORM CYELLOW"%s"CNORM,target_path));
else
printf("%s",psect(buf,38+22,CDBlue"Target: "CNORM CYELLOW"%.8s...%s"CNORM,target_path,&target_path[i-10])); //%*s can be used to right align
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+22,CDBlue"Last Independet: "CNORM CGRAY"%lu"CNORM,indp_counter));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
if (_st_bl)
printf("%s",psect(buf,38+22,CDBlue"Blocks: "CNORM CGRAY"%lu"CNORM,_st_bl));
else
printf("%s",psect(buf,38+22,CDBlue"Blocks: "CNORM CGRAY"N/A"CNORM));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+22,CDBlue"Last Nested: "CNORM CGRAY"%lu"CNORM,nested_counter));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
if (_st_indp)
printf("%s",psect(buf,38+22,CDBlue"Independent: "CNORM CGRAY"%lu"CNORM,_st_indp));
else
printf("%s",psect(buf,38+22,CDBlue"Independent: "CNORM CGRAY"N/A"CNORM));
printf(DStart VR DStop);
printf(DStart VR DStop);
if (_st_indp)
printf("%s",psect(buf,38+22,CDBlue"Coverage: "CNORM CGRAY"%lf"CNORM,(double)total_covered/_st_indp));
else
printf("%s",psect(buf,38+22,CDBlue"Coverage: "CNORM CGRAY"N/A"CNORM));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
if (_st_nes)
printf("%s",psect(buf,38+22,CDBlue"Nested: "CNORM CGRAY"%lu"CNORM,_st_nes));
else
printf("%s",psect(buf,38+22,CDBlue"Nested: "CNORM CGRAY"N/A"CNORM));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+22,CDBlue"Time: "CNORM CGRAY"%s"CNORM,convert_time(tmp)));
printf(DStart VR DStop);
printf("\n");
printf(DStart BVR _32HO _6HO DP DP _32HO _6HO BVL DStop "\n" );
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Inputs: "CNORM"%d",input_count));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"TM OUT: "CNORM"%02d",(int)(active_timeout/1000)));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Queue Elms: "CNORM"%d",queue_ind));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38 + 22,CORANGE"Execs: "CNORM CWHITE"%lu"CNORM,total_exec));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"QI: "CNORM"%d",queue_use_ind));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Last Nodes: "CNORM"%lu",last_trace_nodes));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CLGREEN"Depth: "CNORM"%lu",max_depth));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Output: "CNORM"%s",output_dir));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"PModel: "CNORM"%s",pm_str));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Core: "CNORM"%d",attached_core));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Q coverage: "CNORM"%lf",((double)queue_use_ind)/queue_ind));
printf(DStart VR DStop);
printf(DStart VR DStop);
printf("%s",psect(buf,38+11,CDBlue"Exec speed: "CNORM"%s",exec_speed(tmp)));
printf(DStart VR DStop);
printf("\n");
printf(DStart BVR _32HO _6HO BHU BHU _32HO _6HO BVL DStop "\n" );
printf(DStart VR DStop);
printf("%s",psect(buf,78 + 18,CORANGE"Crashes: "CRED"%lu"CNORM,total_crashes));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,78 + 18,CORANGE"Unique Crashes: "CRED"%lu"CNORM,unique_crashes));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
if (save_soft_crash)
printf("%s",psect(buf,78 + 18,CWHITE"Soft Crashes: "CORANGE"%lu "CNORM,soft_crashes));
else
printf("%s",psect(buf,78 + 18,CWHITE"Soft Crashes: "CORANGE"[DISABLED] "CNORM));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
if (save_soft_crash)
printf("%s",psect(buf,78+18,CWHITE"Unique Soft Crashes: "CORANGE"%lu"CNORM,unique_soft_crashes));
else
printf("%s",psect(buf,78+18,CWHITE"Unique Soft Crashes: "CORANGE"[DISABLED]"CNORM));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,78 + 22,CWHITE"Fuzzer Status: "CNORM"%s",current_stat));
printf(DStart VR DStop);
printf("\n");
printf(DStart BVR _64HO _14HO BVL DStop "\n" );
printf(DStart VR DStop);
strcpy(line,"Queue: ");
strcpy(line2," ");
if (queue_ind<10){
_is = 0;
_ie = 10;
}else {
_is = queue_use_ind-5;
_ie = queue_use_ind+5;
}
if (_is<0)
_is=0;
if (_ie>queue_ind)
_ie=queue_ind;
for (i=_is;i<_ie;i++){
if (i == queue_use_ind){
sleft=CYELLOW;
sright=CNORM;
}else{
sleft=0;
sright=0;
}
if (input_queue[i].total_blocks<1000){
sprintf(tmp2,"%s%03lu%s",(sleft?sleft:""),input_queue[i].total_blocks,(sright?sright:""));
sprintf(tmp,"%s%03d%s",(sleft?sleft:""),input_queue[i].depth,(sright?sright:""));
}else{
sprintf(tmp2,"%s%lu%s",(sleft?sleft:""),input_queue[i].total_blocks,(sright?sright:""));
sprintf(tmp,"%s%d%s",(sleft?sleft:""),input_queue[i].depth,(sright?sright:""));
}
if (input_queue[i].prio==0){
strcat(tmp,"L,");
strcat(tmp2,"L,");
}
else{
strcat(tmp,",");
strcat(tmp2,",");
}
strcat(line,tmp);
strcat(line2,tmp2);
}
strcat(line," ...");
printf("%s",psect(buf,78+11,line));
printf(DStart VR DStop);
printf("\n");
printf(DStart VR DStop);
printf("%s",psect(buf,78+11,line2));
printf(DStart VR DStop);
printf("\n");
printf(DStart BVR _64HO _14HO BVL DStop "\n" );
printf("%s",show_data(buf,data,size,start,end));
printf("\n");
printf(DStart BVR _64HO _14HO BVL DStop "\n" );
printf(DStart VR DStop);
printf("%s",psect(buf,78 + 11,stat_line));
printf(DStart VR DStop);
printf("\n");
printf(DStart LCU _64HO _14HO RCU DStop "\n" );
printf(DStop);