Explorar el Código

godmayfuckingdamnit again.... another sena wrokaround since a version appeared with a sus filename to break my parser....

Tom Görner hace 2 años
padre
commit
d84d0c0c74

+ 21 - 4
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/FirmwareAutoDumper.java

@@ -153,7 +153,7 @@ public class FirmwareAutoDumper
 
                     try {
                         l.info("Processing line:" + line + "\n Basename:" + FWBAsename + "of index "+index[0]);
-                        int[] fwnumber = splitVersionAndPullFW(FWFileName, f.getVersions(), deepmode,index[0]);
+                        int[] fwnumber = splitVersionAndPullFW(FWFileName, f.getVersions(), deepmode,index[0], "Sus Version with File line: "+line);
                         f.setMajor(fwnumber[0]);
                         f.setMinor(fwnumber[1]);
                         f.setPatch(fwnumber[2]);
@@ -297,6 +297,10 @@ public class FirmwareAutoDumper
                     {
                         msg = "Guessed new hidden Version: "+version+" for "+k+" uploaded at: "+date+ "on index "+index;
                     }
+                    if(v2.getSusVersion()!=null)
+                    {
+                        msg = msg +"\n"+v2.getSusVersion();
+                    }
                     if((!v2.isHidden()&&v2.getNotificationState()==MatrixState.SENT_PRELIM)||v2.getNotificationState()==MatrixState.TODO)
                     {
                         final String msg2 = msg;
@@ -317,7 +321,7 @@ public class FirmwareAutoDumper
 
 
 
-    private static int[] splitVersionAndPullFW(String filename,HashMap<String,FirmwareVersion> knownVersions, boolean deepmode,String indexUsed) throws IOException {
+    private static int[] splitVersionAndPullFW(String filename,HashMap<String,FirmwareVersion> knownVersions, boolean deepmode,String indexUsed, String useForSusVersion) throws IOException {
         String[] magic = filename.split("-v");
         boolean fuckingoddity = false;
         boolean hackfix50R_SR = false;
@@ -396,7 +400,7 @@ public class FirmwareAutoDumper
         }
         //suffix = suffix+".img";
 
-        scanDownwards(major,minor,patch,prefix,suffix,knownVersions,rchackfix,hackfixsuffix,indexUsed);
+        scanDownwards(major,minor,patch,prefix,suffix,knownVersions,rchackfix,hackfixsuffix,indexUsed, useForSusVersion);
 
         //scanning upwards for "poking" for undocumented stuff
         if(deepmode)
@@ -426,12 +430,25 @@ public class FirmwareAutoDumper
             HashMap<String,FirmwareVersion> knownVersions,
             boolean rchackfix,
             String hackfixsuffix,
-            String indexUsed
+            String indexUsed,
+            String useForSusVersion
             ) throws IOException {
         l.info(major+"--"+minor+"--"+patch);
         List<FirmwareVersion> temp = new ArrayList<>();
         l.info(prefix+"."+major+"."+minor+"."+patch+"."+suffix);
 
+        if(major==0) //sus version, FUCK YOU AGAIN SENA, XREF: https://repo.nplusc.de/SenaBitWiggler/AutoXml/commit/f17a35d283871ec9357ae94fe561e8a998993b8f
+        {
+            String lastSuffix = rchackfix?hackfixsuffix:".";
+            String synthesizedFileName = prefix+(major)+"."+minor+lastSuffix+(patch)+suffix;
+            if(!knownVersions.containsKey(synthesizedFileName))
+            {
+                FirmwareVersion f = getFirmware(major,minor,patch,false,synthesizedFileName,rchackfix,hackfixsuffix,indexUsed);
+                f.setSusVersion(useForSusVersion);
+                knownVersions.put(synthesizedFileName,f);
+            }
+        }
+
         while(major>=1&&minor>=0&&patch>=0) //older versions won't be bruteforced, check for existence in the index prevents a redownload.
         {
             String lastSuffix = rchackfix?hackfixsuffix:".";

+ 10 - 0
SenaBitWiggler/src/main/java/de/nplusc/izc/senabitwiggler/FirmwareVersion.java

@@ -18,6 +18,16 @@ public class FirmwareVersion {
 
     private String hackfix = "";
 
+    private String susVersion = "";
+
+    public String getSusVersion() {
+        return susVersion;
+    }
+
+    public void setSusVersion(String susVersion) {
+        this.susVersion = susVersion;
+    }
+
     private MatrixState NotificationState = MatrixState.TODO;
 
     public MatrixState getNotificationState() {