packageorg.owasp.mastestappimportandroid.content.Contextimportandroid.util.Logimportjava.io.Fileimportjava.io.FileOutputStreamimportjava.io.IOExceptionclassMastgTest(privatevalcontext:Context){funmastgTest():String{valinternalStorageDir=context.filesDirvalfileName=File(internalStorageDir,"secret.txt")valfileNameOfBackupExcludedFile=File(internalStorageDir,"backup_excluded_secret.txt")valfileContent="secr3tPa\$\$W0rd\n"try{FileOutputStream(fileName).use{output->output.write(fileContent.toByteArray())Log.d("WriteInternalStorage","File written to internal storage successfully.")}FileOutputStream(fileNameOfBackupExcludedFile).use{output->output.write(fileContent.toByteArray())Log.d("WriteInternalStorage","File written to internal storage successfully.")}}catch(e:IOException){Log.e("WriteInternalStorage","Error writing file to internal storage",e)return"ERROR!!\n\nError writing file to internal storage"}return"SUCCESS!!\n\nFiles saved to $internalStorageDir"}}