11package jadx .plugins .stringdecoder ;
22
3+ import java .util .List ;
4+ import java .util .stream .Collectors ;
5+
6+ import javax .swing .BoxLayout ;
7+ import javax .swing .JComponent ;
8+ import javax .swing .JPanel ;
9+
310import jadx .api .plugins .JadxPlugin ;
411import jadx .api .plugins .JadxPluginContext ;
512import jadx .api .plugins .JadxPluginInfo ;
613import jadx .api .plugins .JadxPluginInfoBuilder ;
14+ import jadx .api .plugins .gui .ISettingsGroup ;
15+ import jadx .api .plugins .gui .JadxGuiContext ;
16+ import jadx .api .plugins .options .OptionDescription ;
717
818public class JadxStringDecoderPlugin implements JadxPlugin {
919 public static final String PLUGIN_ID = "jadx-string-decoder" ;
@@ -23,6 +33,10 @@ public JadxPluginInfo getPluginInfo() {
2333 @ Override
2434 public void init (JadxPluginContext context ) {
2535 context .registerOptions (options );
36+ JadxGuiContext guiCtx = context .getGuiContext ();
37+ if (guiCtx != null ) {
38+ setupCustomSettingsGroup (guiCtx );
39+ }
2640 if (options .isEnable ()) {
2741 context .addPass (new B64DeobfuscatePass (options ));
2842 context .addPass (new B64FieldInitPass (options ));
@@ -31,4 +45,41 @@ public void init(JadxPluginContext context) {
3145 }
3246 }
3347 }
48+
49+ private void setupCustomSettingsGroup (JadxGuiContext guiCtx ) {
50+ guiCtx .settings ().setCustomSettingsGroup (new ISettingsGroup () {
51+ private JPanel panel ;
52+
53+ @ Override
54+ public String getTitle () {
55+ return "String Decoder" ;
56+ }
57+
58+ @ Override
59+ public JComponent buildComponent () {
60+ if (panel == null ) {
61+ List <OptionDescription > allOpts = options .getOptionsDescriptions ();
62+ List <OptionDescription > b64Opts = allOpts .stream ()
63+ .filter (o -> !o .name ().contains ("ByteArray" ))
64+ .collect (Collectors .toList ());
65+ List <OptionDescription > byteArrayOpts = allOpts .stream ()
66+ .filter (o -> o .name ().contains ("ByteArray" ))
67+ .collect (Collectors .toList ());
68+
69+ JComponent b64Panel = guiCtx .settings ()
70+ .buildSettingsGroupForOptions ("B64 String Decoder" , b64Opts )
71+ .buildComponent ();
72+ JComponent byteArrayPanel = guiCtx .settings ()
73+ .buildSettingsGroupForOptions ("Byte Array String Decoder" , byteArrayOpts )
74+ .buildComponent ();
75+
76+ panel = new JPanel ();
77+ panel .setLayout (new BoxLayout (panel , BoxLayout .PAGE_AXIS ));
78+ panel .add (b64Panel );
79+ panel .add (byteArrayPanel );
80+ }
81+ return panel ;
82+ }
83+ });
84+ }
3485}
0 commit comments