@@ -48,6 +48,7 @@ def cli():
48
48
)
49
49
@click .option ("--db_enabled" , help = "Enable db" , default = False , is_flag = True , flag_value = True )
50
50
@click .option ("--falco_enabled" , help = "Enable falco" , default = False , is_flag = True , flag_value = True )
51
+ @click .option ("--non_interactive" , help = "Run scsctl in non interactive mode" , default = False , is_flag = True , flag_value = True )
51
52
@click .option (
52
53
"--docker_file_folder_path" , help = "Path of the docker file to rebuild" , default = None , is_flag = False , flag_value = None
53
54
)
@@ -62,6 +63,7 @@ def scan(
62
63
db_enabled = False ,
63
64
falco_enabled = False ,
64
65
config_file = None ,
66
+ non_interactive = False
65
67
):
66
68
config_data = {}
67
69
if config_file is not None :
@@ -159,23 +161,37 @@ def scan(
159
161
choices .remove ("Falco detected packages" )
160
162
161
163
if scan_status :
162
- while True :
163
- choice = questionary .select ("Select an option" , choices = choices , style = custom_style_fancy ).ask ()
164
- if choice == "Exit" :
165
- break
166
- if choice == "Sbom report" :
167
- print_sbom_report (sbom_report )
168
- if choice == "Pyroscope detected packages" :
169
- print_pyroscope_packages (pyroscope_data )
170
- if choice == "Falco detected packages" :
171
- print_falco_packages (falco_found_extra_packages )
172
- if choice == "Final report" :
173
- click .echo ("Vulnerable packages that can be uninstalled from the docker image are:" )
174
- click .echo (final_report )
175
- if choice == "Rebuild the image" :
176
- if docker_file_folder_path == None :
177
- docker_file_folder_path = click .prompt ("Enter docker file folder path" , type = str )
178
- modify_and_build_docker_image (docker_file_folder_path , pyroscope_found_extra_packages , batch_id )
164
+ if (non_interactive ):
165
+ click .echo ("Sbom report" )
166
+ click .echo ("===========" )
167
+ print_sbom_report (sbom_report )
168
+ click .echo ("Pyroscope detected packages" )
169
+ click .echo ("===========================" )
170
+ print_pyroscope_packages (pyroscope_data )
171
+ click .echo ("Falco detected packages" )
172
+ click .echo ("=======================" )
173
+ print_falco_packages (falco_found_extra_packages )
174
+ click .echo ("Final Report" )
175
+ click .echo ("=============" )
176
+ click .echo (final_report )
177
+ else :
178
+ while True :
179
+ choice = questionary .select ("Select an option" , choices = choices , style = custom_style_fancy ).ask ()
180
+ if choice == "Exit" :
181
+ break
182
+ if choice == "Sbom report" :
183
+ print_sbom_report (sbom_report )
184
+ if choice == "Pyroscope detected packages" :
185
+ print_pyroscope_packages (pyroscope_data )
186
+ if choice == "Falco detected packages" :
187
+ print_falco_packages (falco_found_extra_packages )
188
+ if choice == "Final report" :
189
+ click .echo ("Vulnerable packages that can be uninstalled from the docker image are:" )
190
+ click .echo (final_report )
191
+ if choice == "Rebuild the image" :
192
+ if docker_file_folder_path == None :
193
+ docker_file_folder_path = click .prompt ("Enter docker file folder path" , type = str )
194
+ modify_and_build_docker_image (docker_file_folder_path , pyroscope_found_extra_packages , batch_id )
179
195
180
196
181
197
cli .add_command (scan )
0 commit comments