@@ -21,7 +21,7 @@ def clear_screen():
2121console = Console ()
2222
2323## Now separate the results by data_source
24- data_sources = ['s3' , 'mysql' , 'redis' , 'firebase' , 'gcs' , 'fs' , 'postgresql' , 'mongodb' , 'slack' , 'couchdb' , 'gdrive' , 'gdrive_workspace' ]
24+ data_sources = ['s3' , 'mysql' , 'redis' , 'firebase' , 'gcs' , 'fs' , 'postgresql' , 'mongodb' , 'slack' , 'couchdb' , 'gdrive' , 'gdrive_workspace' , 'text' ]
2525
2626def load_command_module (command ):
2727 try :
@@ -71,13 +71,16 @@ def main():
7171 grouped_results [data_source ].append (result )
7272
7373 if args .json :
74- with open (args .json , 'w' ) as file :
75- #file_path = file_path.replace('-runtime.pdf', '')
76- if 'gdrive_workspace' in grouped_results :
77- for result in grouped_results ['gdrive_workspace' ]:
78- result ['file_name' ] = result ['file_name' ].replace ('-runtime.pdf' , '' )
79-
80- file .write (json .dumps (grouped_results , indent = 4 ))
74+ if args .json != '' :
75+ with open (args .json , 'w' ) as file :
76+ #file_path = file_path.replace('-runtime.pdf', '')
77+ if 'gdrive_workspace' in grouped_results :
78+ for result in grouped_results ['gdrive_workspace' ]:
79+ result ['file_name' ] = result ['file_name' ].replace ('-runtime.pdf' , '' )
80+
81+ file .write (json .dumps (grouped_results , indent = 4 ))
82+ else :
83+ print (json .dumps (grouped_results , indent = 4 ))
8184 system .print_success (f"Results saved to { args .json } " )
8285 sys .exit (0 )
8386 panel = Panel (Text ("Now, lets look at findings!" , justify = "center" ))
@@ -109,7 +112,6 @@ def main():
109112 elif group == 'gdrive_workspace' :
110113 table .add_column ("File Name" )
111114 table .add_column ("User" )
112-
113115 table .add_column ("Pattern Name" )
114116 table .add_column ("Total Exposed" )
115117 table .add_column ("Exposed Values" )
@@ -455,6 +457,29 @@ def main():
455457 exposed_values = records_mini
456458 )
457459
460+ system .SlackNotify (AlertMsg )
461+ elif group == 'text' :
462+ table .add_row (
463+ str (i ),
464+ result ['profile' ],
465+ result ['pattern_name' ],
466+ str (len (result ['matches' ])),
467+ records_mini ,
468+ result ['sample_text' ],
469+ )
470+ AlertMsg = """
471+ *** PII Or Secret Found ***
472+ Data Source: Text - {vulnerable_profile}
473+ Pattern Name: {pattern_name}
474+ Total Exposed: {total_exposed}
475+ Exposed Values: {exposed_values}
476+ """ .format (
477+ vulnerable_profile = result ['profile' ],
478+ pattern_name = result ['pattern_name' ],
479+ total_exposed = str (len (result ['matches' ])),
480+ exposed_values = records_mini
481+ )
482+
458483 system .SlackNotify (AlertMsg )
459484 else :
460485 # Handle other cases or do nothing for unsupported groups
0 commit comments