99import java .util .ArrayList ;
1010import java .util .HashMap ;
1111import java .util .Map ;
12- import java .util .Objects ;
1312
1413/**
1514 * @author Madmegsox1
@@ -31,28 +30,37 @@ public void completeTask() {
3130 int i = 0 ;
3231 Map <Integer , String > renameMap = new HashMap <>();
3332 for (String line : lines ){
33+
3434 final FindString findString = new FindString (line , true );
3535 final FindString replaceString = new FindString (line , false );
36- if (Objects .equals (findString .getFoundLine (), "" )){
36+
37+ if (findString .getFoundLine () == null || findString .getFoundLine ().isEmpty ()){
3738 i ++;
3839 continue ;
3940 }
40- String encoded = "" ;
41- switch (Core .CONFIG .getEncoderType ().toLowerCase ()){
42- case "hex" -> encoded = "(bytes.fromhex(('" + (EncodingUtils .stringToHex (replaceString .getFoundLine ()).replaceFirst ("^0*" , "" )) + "').replace('', ''))).decode('utf-8')" ;
43- case "base64" -> encoded = "base64.b64decode('" + (EncodingUtils .stringToBase64 (replaceString .getFoundLine ())) + "')" ;
44- case "bin" -> {
45- encoded = "''.join(chr(int(('" ;
46- encoded += (EncodingUtils .prettyBinary (EncodingUtils .stringToBinary (replaceString .getFoundLine ()), 8 , Core .CONFIG .getBinarySplitter ()));
47- encoded += "').replace('" + Core .CONFIG .getBinarySplitter () + "', '')" ;
48- encoded += "[i*0x0008:i*0x0008+0x0008],(0x0003 - 0x0001))) for i in range(len(('" ;
49- encoded += (EncodingUtils .prettyBinary (EncodingUtils .stringToBinary (replaceString .getFoundLine ()), 8 , Core .CONFIG .getBinarySplitter ()));
50- encoded += "').replace('" + Core .CONFIG .getBinarySplitter () + "', ''))" ;
51- encoded += "//(0x0004 + 0x0004)))" ;
41+
42+ int x = 0 ;
43+ for (String s : findString .getFoundLine ()){
44+ String encoded = "" ;
45+ switch (Core .CONFIG .getEncoderType ().toLowerCase ()){
46+ case "hex" -> encoded = "(bytes.fromhex(('" + (EncodingUtils .stringToHex (replaceString .getFoundLine ().get (x )).replaceFirst ("^0*" , "" )) + "').replace('', ''))).decode('utf-8')" ;
47+ case "base64" -> encoded = "base64.b64decode('" + (EncodingUtils .stringToBase64 (replaceString .getFoundLine ().get (x ))) + "')" ;
48+ case "bin" -> {
49+ encoded = "''.join(chr(int(('" ;
50+ encoded += (EncodingUtils .prettyBinary (EncodingUtils .stringToBinary (replaceString .getFoundLine ().get (x )), 8 , Core .CONFIG .getBinarySplitter ()));
51+ encoded += "').replace('" + Core .CONFIG .getBinarySplitter () + "', '')" ;
52+ encoded += "[i*0x0008:i*0x0008+0x0008],(0x0003 - 0x0001))) for i in range(len(('" ;
53+ encoded += (EncodingUtils .prettyBinary (EncodingUtils .stringToBinary (replaceString .getFoundLine ().get (x )), 8 , Core .CONFIG .getBinarySplitter ()));
54+ encoded += "').replace('" + Core .CONFIG .getBinarySplitter () + "', ''))" ;
55+ encoded += "//(0x0004 + 0x0004)))" ;
56+ }
5257 }
58+ x ++;
59+ line = line .replace (s , encoded );
5360 }
54- renameMap .put (i , line .replace (findString .getFoundLine (), encoded ));
5561
62+
63+ renameMap .put (i , line );
5664 i ++;
5765 }
5866
0 commit comments