@@ -21,6 +21,7 @@ typedef struct {
2121Exploit results [MAX_RESULTS ];
2222int result_count = 0 ;
2323pthread_mutex_t lock ;
24+ int use_colors = 0 ; // flag for color support
2425
2526const char * exploitDBPaths [] = {
2627 "/usr/share/exploitdb/files_exploits.csv" ,
@@ -155,6 +156,16 @@ void display_results() {
155156 cbreak ();
156157 keypad (stdscr , TRUE);
157158
159+ if (has_colors ()) {
160+ start_color ();
161+ use_colors = 1 ;
162+ // color pairs
163+ init_pair (1 , COLOR_YELLOW , COLOR_BLACK ); // source
164+ init_pair (2 , COLOR_CYAN , COLOR_BLACK ); // title
165+ init_pair (3 , COLOR_GREEN , COLOR_BLACK ); // path
166+ init_pair (4 , COLOR_MAGENTA , COLOR_BLACK ); // header
167+ }
168+
158169 int ch , start = 0 , rows , cols ;
159170 getmaxyx (stdscr , rows , cols );
160171
@@ -164,7 +175,11 @@ void display_results() {
164175
165176 while (1 ) {
166177 clear ();
178+
179+ if (use_colors ) attron (COLOR_PAIR (4 ) | A_BOLD );
167180 mvprintw (0 , 0 , "| %-10s | %-*s | %-*s |" , "Source" , col_title , "Title" , col_path , "Path" );
181+ if (use_colors ) attroff (COLOR_PAIR (4 ) | A_BOLD );
182+
168183 mvhline (1 , 0 , '-' , cols );
169184
170185 int printed_rows = 0 ;
@@ -176,14 +191,29 @@ void display_results() {
176191 int max_lines = title_count > path_count ? title_count : path_count ;
177192
178193 for (int l = 0 ; l < max_lines && printed_rows < rows - 3 ; l ++ ) {
179- mvprintw (printed_rows + 2 , 0 , "| %-10.10s | %-*s | %-*s |" ,
180- l == 0 ? results [i ].source : "" ,
181- col_title , l < title_count ? title_lines [l ] : "" ,
182- col_path , l < path_count ? path_lines [l ] : "" );
194+ int line_y = printed_rows + 2 ;
195+
196+ // Source column
197+ if (use_colors ) attron (COLOR_PAIR (1 ));
198+ mvprintw (line_y , 0 , "| %-10.10s " , l == 0 ? results [i ].source : "" );
199+ if (use_colors ) attroff (COLOR_PAIR (1 ));
200+
201+ // Title column
202+ if (use_colors ) attron (COLOR_PAIR (2 ));
203+ mvprintw (line_y , 13 , "| %-*s " , col_title , l < title_count ? title_lines [l ] : "" );
204+ if (use_colors ) attroff (COLOR_PAIR (2 ));
205+
206+ // Path column
207+ if (use_colors ) attron (COLOR_PAIR (3 ));
208+ mvprintw (line_y , 15 + col_title , "| %-*s |" , col_path , l < path_count ? path_lines [l ] : "" );
209+ if (use_colors ) attroff (COLOR_PAIR (3 ));
210+
183211 printed_rows ++ ;
184212 }
185213 }
186- mvprintw (rows - 1 , 0 , "Use Up/Down arrows to scroll, q to quit. Showing %d of %d results" , start + 1 , result_count );
214+
215+ mvprintw (rows - 1 , 0 , "Use Up/Down arrows to scroll, q to quit. Showing %d of %d results" ,
216+ start + 1 , result_count );
187217 refresh ();
188218
189219 ch = getch ();
0 commit comments