Service Access Control bugfixes
This commit is contained in:
parent
4a803c7b08
commit
3fc0aad7a1
10 changed files with 47 additions and 18 deletions
|
@ -4,7 +4,7 @@ import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import konogonka.Tools.NPDM.FSAccessControlProvider;
|
import konogonka.Tools.NPDM.ACID.FSAccessControlProvider;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import javafx.scene.control.TextField;
|
||||||
import konogonka.Controllers.ITabController;
|
import konogonka.Controllers.ITabController;
|
||||||
import konogonka.Tools.ISuperProvider;
|
import konogonka.Tools.ISuperProvider;
|
||||||
import konogonka.Tools.NPDM.ACI0Provider;
|
import konogonka.Tools.NPDM.ACI0Provider;
|
||||||
import konogonka.Tools.NPDM.ACIDProvider;
|
import konogonka.Tools.NPDM.ACID.ACIDProvider;
|
||||||
import konogonka.Tools.NPDM.NPDMProvider;
|
import konogonka.Tools.NPDM.NPDMProvider;
|
||||||
import konogonka.Workers.Analyzer;
|
import konogonka.Workers.Analyzer;
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,10 @@ import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import konogonka.LoperConverter;
|
import konogonka.Tools.NPDM.LCollectionEntry;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class ServiceAccessControlController implements Initializable {
|
public class ServiceAccessControlController implements Initializable {
|
||||||
|
@ -26,11 +25,10 @@ public class ServiceAccessControlController implements Initializable {
|
||||||
SACPane.getChildren().clear();
|
SACPane.getChildren().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void populateFields(LinkedHashMap<Byte, String> collection){
|
public void populateFields(LinkedList<LCollectionEntry> collection){
|
||||||
resetTab();
|
resetTab();
|
||||||
|
|
||||||
for (Object object : collection.entrySet()) {
|
for (LCollectionEntry entry : collection) {
|
||||||
Map.Entry<Byte, String> entry = (Map.Entry) object;
|
|
||||||
|
|
||||||
Label control = new Label(String.format("0x%02x", entry.getKey()));
|
Label control = new Label(String.format("0x%02x", entry.getKey()));
|
||||||
Label serviceName = new Label(entry.getValue());
|
Label serviceName = new Label(entry.getValue());
|
||||||
|
|
|
@ -2,6 +2,7 @@ package konogonka.Tools.NPDM;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import static konogonka.LoperConverter.getLEint;
|
import static konogonka.LoperConverter.getLEint;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
package konogonka.Tools.NPDM;
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
|
import konogonka.Tools.NPDM.ACI0Provider;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -28,6 +30,7 @@ public class ACIDProvider {
|
||||||
|
|
||||||
private FSAccessControlProvider fsAccessControlProvider;
|
private FSAccessControlProvider fsAccessControlProvider;
|
||||||
private ServiceAccessControlProvider serviceAccessControlProvider;
|
private ServiceAccessControlProvider serviceAccessControlProvider;
|
||||||
|
private KernelAccessControlProvider kernelAccessControlProvider;
|
||||||
|
|
||||||
public ACIDProvider(byte[] acidBytes) throws Exception{
|
public ACIDProvider(byte[] acidBytes) throws Exception{
|
||||||
if (acidBytes.length < 0x240)
|
if (acidBytes.length < 0x240)
|
||||||
|
@ -54,6 +57,7 @@ public class ACIDProvider {
|
||||||
throw new Exception("ACIDProvider -> blocks inside the ACID are not sorted in ascending order. Only ascending order supported.");
|
throw new Exception("ACIDProvider -> blocks inside the ACID are not sorted in ascending order. Only ascending order supported.");
|
||||||
fsAccessControlProvider = new FSAccessControlProvider(Arrays.copyOfRange(acidBytes, fsAccessControlOffset, fsAccessControlOffset+fsAccessControlSize));
|
fsAccessControlProvider = new FSAccessControlProvider(Arrays.copyOfRange(acidBytes, fsAccessControlOffset, fsAccessControlOffset+fsAccessControlSize));
|
||||||
serviceAccessControlProvider = new ServiceAccessControlProvider(Arrays.copyOfRange(acidBytes, serviceAccessControlOffset, serviceAccessControlOffset+serviceAccessControlSize));
|
serviceAccessControlProvider = new ServiceAccessControlProvider(Arrays.copyOfRange(acidBytes, serviceAccessControlOffset, serviceAccessControlOffset+serviceAccessControlSize));
|
||||||
|
kernelAccessControlProvider = new KernelAccessControlProvider(Arrays.copyOfRange(acidBytes, kernelAccessControlOffset, kernelAccessControlOffset+kernelAccessControlSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getRsa2048signature() { return rsa2048signature; }
|
public byte[] getRsa2048signature() { return rsa2048signature; }
|
||||||
|
@ -77,4 +81,5 @@ public class ACIDProvider {
|
||||||
|
|
||||||
public FSAccessControlProvider getFsAccessControlProvider() { return fsAccessControlProvider; }
|
public FSAccessControlProvider getFsAccessControlProvider() { return fsAccessControlProvider; }
|
||||||
public ServiceAccessControlProvider getServiceAccessControlProvider() { return serviceAccessControlProvider; }
|
public ServiceAccessControlProvider getServiceAccessControlProvider() { return serviceAccessControlProvider; }
|
||||||
|
public KernelAccessControlProvider getKernelAccessControlProvider() { return kernelAccessControlProvider; }
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package konogonka.Tools.NPDM;
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
|
public class KernelAccessControlProvider {
|
||||||
|
|
||||||
|
KernelAccessControlProvider(byte[] bytes){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,16 @@
|
||||||
package konogonka.Tools.NPDM;
|
package konogonka.Tools.NPDM.ACID;
|
||||||
|
|
||||||
|
import konogonka.Tools.NPDM.LCollectionEntry;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
public class ServiceAccessControlProvider {
|
public class ServiceAccessControlProvider {
|
||||||
|
|
||||||
private LinkedHashMap<Byte, String> collection;
|
private LinkedList<LCollectionEntry> collection;
|
||||||
|
|
||||||
public ServiceAccessControlProvider(byte[] bytes){
|
public ServiceAccessControlProvider(byte[] bytes){
|
||||||
collection = new LinkedHashMap<>();
|
collection = new LinkedList<>();
|
||||||
byte key;
|
byte key;
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
|
@ -17,14 +19,14 @@ public class ServiceAccessControlProvider {
|
||||||
while (i < bytes.length){
|
while (i < bytes.length){
|
||||||
key = bytes[i];
|
key = bytes[i];
|
||||||
value = new String(bytes, i+1, getSize(key), StandardCharsets.UTF_8);
|
value = new String(bytes, i+1, getSize(key), StandardCharsets.UTF_8);
|
||||||
collection.put(key, value);
|
collection.add(new LCollectionEntry(key, value));
|
||||||
i += getSize(key)+1;
|
i += getSize(key)+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSize(byte control) {
|
private int getSize(byte control) {
|
||||||
return ((byte) 0x7 & control) + 1;
|
return ((byte) 0x7 & control) + (byte) 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedHashMap<Byte, String> getCollection() { return collection; }
|
public LinkedList<LCollectionEntry> getCollection() { return collection; }
|
||||||
}
|
}
|
15
src/main/java/konogonka/Tools/NPDM/LCollectionEntry.java
Normal file
15
src/main/java/konogonka/Tools/NPDM/LCollectionEntry.java
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
package konogonka.Tools.NPDM;
|
||||||
|
|
||||||
|
public class LCollectionEntry {
|
||||||
|
private byte key;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public LCollectionEntry(byte key, String value){
|
||||||
|
this.key = key;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getKey() { return key; }
|
||||||
|
|
||||||
|
public String getValue() { return value; }
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package konogonka.Tools.NPDM;
|
package konogonka.Tools.NPDM;
|
||||||
|
|
||||||
import konogonka.RainbowHexDump;
|
|
||||||
import konogonka.Tools.ASuperInFileProvider;
|
import konogonka.Tools.ASuperInFileProvider;
|
||||||
|
import konogonka.Tools.NPDM.ACID.ACIDProvider;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
Loading…
Reference in a new issue