woodpecker插件编写

编写woodpecker帆软密码解密插件

编写

目录结构

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── me
│   │   │   └── gv7
│   │   │   └── woodpecker
│   │   │   ├── helper
│   │   │   │   ├── PasswdDecryptHelper.java
│   │   │   │   └── fineBIPasswordDcrypter.java
│   │   │   └── plugin
│   │   │   └──WoodpeckerPluginManager.java
│   │   └── test
│   │   └── java
│   └── test
│   └── java
│   └── fineBIDecrypterTest.java
└── target
├── archive-tmp
├── classes
│   └── me
│   └── gv7
│   └── woodpecker
│   ├── helper
│   │   ├── PasswdDecryptHelper.class
│   │   └── fineBIPasswordDcrypter.class
│   └── plugin
│   └── WoodpeckerPluginManager.class
├── generated-sources
│   └── annotations
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile
├── createdFiles.lst
└── inputFiles.lst

27 directories, 10 files

WoodpeckerPluginManager.java

1
2
3
4
5
6
7
8
9
10
package me.gv7.woodpecker.plugin;

import me.gv7.woodpecker.helper.fineBIPasswordDcrypter;

public class WoodpeckerPluginManager implements IPluginManager{
public void registerPluginManagerCallbacks(IPluginManagerCallbacks pluginManagerCallbacks) {
fineBIPasswordDcrypter echoTextConverter = new fineBIPasswordDcrypter();
pluginManagerCallbacks.registerHelperPlugin(echoTextConverter);
}
}

fineBIPasswordDcrypter.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package me.gv7.woodpecker.helper;

import me.gv7.woodpecker.plugin.*;
import java.util.ArrayList;
import java.util.List;

public class fineBIPasswordDcrypter implements IHelperPlugin {
public static IHelperPluginCallbacks callbacks;
public static IPluginHelper pluginHelper;

public fineBIPasswordDcrypter() {
}

@Override
public void HelperPluginMain(IHelperPluginCallbacks iHelperPluginCallbacks) {
callbacks = iHelperPluginCallbacks;
pluginHelper = callbacks.getPluginHelper();
callbacks.setHelperPluginName("FineBI password Decrypter");
callbacks.setHelperPluginVersion("0.1.0");
callbacks.setHelperPluginAutor("hywell");
callbacks.setHelperPluginDescription("帆软BI密码解密");
List<IHelper> helperList = new ArrayList<>();
helperList.add(new PasswdDecryptHelper());
callbacks.registerHelper(helperList);
}
}

PasswdDecryptHelper.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package me.gv7.woodpecker.helper;

import com.fr.properties.finedb.DBPropertyCipher;
import me.gv7.woodpecker.plugin.IHelper;
import me.gv7.woodpecker.plugin.IArg;
import me.gv7.woodpecker.plugin.IArgsUsageBinder;
import me.gv7.woodpecker.plugin.IResultOutput;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class PasswdDecryptHelper implements IHelper {
public PasswdDecryptHelper() {
}

public String getHelperTabCaption() {
return "FineBI password Decrypter";
}

public IArgsUsageBinder getHelperCutomArgs() {
IArgsUsageBinder argsUsageBinder = fineBIPasswordDcrypter.pluginHelper.createArgsUsageBinder();
List<IArg> args = new ArrayList();
IArg argPassword = fineBIPasswordDcrypter.pluginHelper.createArg();
argPassword.setName("password");
argPassword.setDefaultValue("NbqzauIuNWerl9wdI0o/k0bm0E+gY0eeTVTGnUFM4BlewX5/QHT/aZaVIRCLMTfNfuWVnePIo+C7" +
"uPSLC7vfJORbYQf4dYG6DNHwgAFz0RVYPQX+BnWHvPofsvNmPaESpTE2o7cEUH711wihc0RAl/d9" +
"0qUDfyNT/VecC3R2aj1hWwh/tmoXqm8qJd0FVrfy4rPK8gLEOt9pxY0iDSK9Wmlk6B8WEGl7DV9H" +
"huMsgthuJnKZhVNajSW0FQjqBFq/TD3sKYhf8lFG1mBXPlqb/0wfQJI7KXzul7nykG0qJm/JR8B3" +
"eQKd7/Q5W2TjUULl7B3IWoU/NTsZq/pq9O93ZQ==");
argPassword.setDescription("需要解密的 password,需单行全部确认");
argPassword.setRequired(true);
args.add(argPassword);
argsUsageBinder.setArgsList(args);

return argsUsageBinder;
}

public void doHelp(Map<String, Object> customArgs, IResultOutput iResultOutput) throws Throwable {
String password = (String) customArgs.get("password");
password = password.replace("\\r\\n","\n").replace("\\n","\n").replace("\\=","=").replace("\n", "");
try {
String plainText = DBPropertyCipher.getInstance().decode(password);
iResultOutput.successPrintln("Decrypt result:");
iResultOutput.rawPrintln("\n" + plainText + "\n");
} catch (Exception var6) {
iResultOutput.errorPrintln(fineBIPasswordDcrypter.pluginHelper.getThrowableInfo(var6));
}
}

}

问题

maven打包出现未把帆软依赖打入jar中,使用maven-assembly-plugin解决

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>

然后使用mvn compile assembly:single编译即可