Clear issue description for PFS0 (non-encrypted)

This commit is contained in:
Dmitry Isaenko 2020-04-01 13:30:44 +03:00
parent 3c191c42e1
commit d917d4c22f
6 changed files with 70 additions and 31 deletions

View file

@ -86,7 +86,7 @@ public class MainController implements Initializable {
else else
fileChooser.setInitialDirectory(new File(System.getProperty("user.home"))); fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NS files", "*.nsp", "*.xci", "*.nca", "*.tik", "*.xml", "*.npdm")); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NS files", "*.nsp", "*.nsz", "*.xci", "*.nca", "*.tik", "*.xml", "*.npdm"));
this.selectedFile = fileChooser.showOpenDialog(analyzeBtn.getScene().getWindow()); this.selectedFile = fileChooser.showOpenDialog(analyzeBtn.getScene().getWindow());
// todo: fix // todo: fix
@ -102,18 +102,28 @@ public class MainController implements Initializable {
filenameSelected.setText(this.selectedFile.getAbsolutePath()); filenameSelected.setText(this.selectedFile.getAbsolutePath());
previouslyOpenedPath = this.selectedFile.getParent(); previouslyOpenedPath = this.selectedFile.getParent();
analyzeBtn.setDisable(false); analyzeBtn.setDisable(false);
if (this.selectedFile.getName().toLowerCase().endsWith(".nsp")) String fileExtension = this.selectedFile.getName().toLowerCase().replaceAll("^.*\\.", "");
tabPane.getSelectionModel().select(0); switch (fileExtension){
else if (this.selectedFile.getName().toLowerCase().endsWith(".xci")) case "nsp":
tabPane.getSelectionModel().select(1); case "nsz":
else if (this.selectedFile.getName().toLowerCase().endsWith(".nca")) tabPane.getSelectionModel().select(0);
tabPane.getSelectionModel().select(2); break;
else if (this.selectedFile.getName().toLowerCase().endsWith(".tik")) case "xci":
tabPane.getSelectionModel().select(3); tabPane.getSelectionModel().select(1);
else if (this.selectedFile.getName().toLowerCase().endsWith(".xml")) break;
tabPane.getSelectionModel().select(4); case "nca":
else if (this.selectedFile.getName().toLowerCase().endsWith(".npdm")) tabPane.getSelectionModel().select(2);
tabPane.getSelectionModel().select(5); break;
case "tic":
tabPane.getSelectionModel().select(3);
break;
case "xml":
tabPane.getSelectionModel().select(4);
break;
case "npdm":
tabPane.getSelectionModel().select(5);
break;
}
} }
logArea.clear(); logArea.clear();
@ -122,18 +132,28 @@ public class MainController implements Initializable {
* Start analyze * Start analyze
* */ * */
private void analyzeFile(){ private void analyzeFile(){
if (selectedFile.getName().toLowerCase().endsWith("nsp")) final String fileExtension = selectedFile.getName().toLowerCase().replaceAll("^.*\\.", "");
NSPTabController.analyze(selectedFile); // TODO: NSP OR XCI switch (fileExtension){
else if (selectedFile.getName().toLowerCase().endsWith("xci")) case "nsp":
XCITabController.analyze(selectedFile); case "nsz":
else if (selectedFile.getName().toLowerCase().endsWith("nca")) NSPTabController.analyze(selectedFile); // TODO: NSP OR XCI
NCATabController.analyze(selectedFile); break;
else if (selectedFile.getName().toLowerCase().endsWith("tik")) case "xci":
TIKTabController.analyze(selectedFile); XCITabController.analyze(selectedFile);
else if (selectedFile.getName().toLowerCase().endsWith("xml")) break;
XMLTabController.analyze(selectedFile); case "nca":
else if (selectedFile.getName().toLowerCase().endsWith("npdm")) NCATabController.analyze(selectedFile);
NPDMTabController.analyze(selectedFile); break;
case "tic":
TIKTabController.analyze(selectedFile);
break;
case "xml":
XMLTabController.analyze(selectedFile);
break;
case "npdm":
NPDMTabController.analyze(selectedFile);
break;
}
} }
@FXML @FXML
private void showHideLogs(){ private void showHideLogs(){

View file

@ -193,8 +193,27 @@ public class NCAProvider {
decryptedKey2 = cipher.doFinal(encryptedKey2); decryptedKey2 = cipher.doFinal(encryptedKey2);
decryptedKey3 = cipher.doFinal(encryptedKey3); decryptedKey3 = cipher.doFinal(encryptedKey3);
} }
else else{
throw new Exception("key_are_key_[UNKNOWN] requested ("+keyIndex+"). Not supported."); StringBuilder exceptionStringBuilder = new StringBuilder("key_area_key_");
switch (keyIndex){
case 0:
exceptionStringBuilder.append("application_");
break;
case 1:
exceptionStringBuilder.append("ocean_");
break;
case 2:
exceptionStringBuilder.append("system_");
break;
default:
exceptionStringBuilder.append(keyIndex);
exceptionStringBuilder.append("[UNKNOWN]_");
}
exceptionStringBuilder.append(String.format("%02d", cryptoTypeReal));
exceptionStringBuilder.append(" requested. Not supported or not found.");
throw new Exception(exceptionStringBuilder.toString());
}
} }
tableEntry0 = new NCAHeaderTableEntry(tableBytes); tableEntry0 = new NCAHeaderTableEntry(tableBytes);

View file

@ -1,4 +1,4 @@
btnFileOpen=Select NSP/XCI/NCA/TIK/XML btnFileOpen=Select
btnAnalyze=Analyze btnAnalyze=Analyze
lblNoFileSelected=No files selected. lblNoFileSelected=No files selected.
tableNumberLbl=# tableNumberLbl=#

View file

@ -1,4 +1,4 @@
btnFileOpen=Selectionner NSP/XCI/NCA/TIK/XML btnFileOpen=Selectionner
btnAnalyze=Analyser btnAnalyze=Analyser
lblNoFileSelected=Aucuns fichiers s\u00E9lectionn\u00E9s. lblNoFileSelected=Aucuns fichiers s\u00E9lectionn\u00E9s.
tableUploadLbl=Extraire ? tableUploadLbl=Extraire ?

View file

@ -1,4 +1,4 @@
btnFileOpen=\u0412\u044B\u0431\u0440\u0430\u0442\u044C NSP/XCI/NCA/TIK/XML btnFileOpen=\u0412\u044B\u0431\u0440\u0430\u0442\u044C
btnAnalyze=\u0410\u043D\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C btnAnalyze=\u0410\u043D\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C
lblNoFileSelected=\u0424\u0430\u0439\u043B\u044B \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u044B. lblNoFileSelected=\u0424\u0430\u0439\u043B\u044B \u043D\u0435 \u0432\u044B\u0431\u0440\u0430\u043D\u044B.
tableUploadLbl=\u0420\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C? tableUploadLbl=\u0420\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C?

View file

@ -1,4 +1,4 @@
btnFileOpen=\u0412\u0438\u0431\u0440\u0430\u0442\u0438 NSP/XCI/NCA/TIK/XML btnFileOpen=\u0412\u0438\u0431\u0440\u0430\u0442\u0438
btnAnalyze=\u0410\u043D\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438 btnAnalyze=\u0410\u043D\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438
lblNoFileSelected=\u0424\u0430\u0439\u043B\u0438 \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u0456. lblNoFileSelected=\u0424\u0430\u0439\u043B\u0438 \u043D\u0435 \u0432\u0438\u0431\u0440\u0430\u043D\u0456.
tableNumberLbl=\u2116 tableNumberLbl=\u2116