@@ -4,10 +4,15 @@ import (
44 "bytes"
55 "fmt"
66 "github.com/chainreactors/malice-network/client/assets"
7+ "github.com/chainreactors/malice-network/client/command"
78 "github.com/chainreactors/malice-network/client/command/addon"
89 "github.com/chainreactors/malice-network/client/command/alias"
910 "github.com/chainreactors/malice-network/client/command/armory"
11+ "github.com/chainreactors/malice-network/client/command/basic"
1012 "github.com/chainreactors/malice-network/client/command/build"
13+ "github.com/chainreactors/malice-network/client/command/cert"
14+ configCmd "github.com/chainreactors/malice-network/client/command/config"
15+ "github.com/chainreactors/malice-network/client/command/context"
1116 "github.com/chainreactors/malice-network/client/command/exec"
1217 "github.com/chainreactors/malice-network/client/command/explorer"
1318 "github.com/chainreactors/malice-network/client/command/extension"
@@ -17,16 +22,24 @@ import (
1722 "github.com/chainreactors/malice-network/client/command/listener"
1823 "github.com/chainreactors/malice-network/client/command/mal"
1924 "github.com/chainreactors/malice-network/client/command/modules"
25+ "github.com/chainreactors/malice-network/client/command/mutant"
2026 "github.com/chainreactors/malice-network/client/command/pipe"
27+ "github.com/chainreactors/malice-network/client/command/pipeline"
28+ "github.com/chainreactors/malice-network/client/command/pivot"
2129 "github.com/chainreactors/malice-network/client/command/privilege"
2230 "github.com/chainreactors/malice-network/client/command/reg"
2331 "github.com/chainreactors/malice-network/client/command/service"
2432 "github.com/chainreactors/malice-network/client/command/sessions"
2533 "github.com/chainreactors/malice-network/client/command/sys"
2634 "github.com/chainreactors/malice-network/client/command/tasks"
2735 "github.com/chainreactors/malice-network/client/command/taskschd"
36+ "github.com/chainreactors/malice-network/client/command/third"
37+ "github.com/chainreactors/malice-network/client/command/website"
38+ "github.com/chainreactors/malice-network/client/plugin"
2839 "github.com/chainreactors/malice-network/client/repl"
2940 "github.com/chainreactors/malice-network/helper/consts"
41+ "github.com/chainreactors/malice-network/helper/intermediate"
42+ "github.com/chainreactors/malice-network/helper/proto/services/clientrpc"
3043 "github.com/gookit/config/v2"
3144 "github.com/gookit/config/v2/yaml"
3245 "github.com/spf13/cobra"
@@ -185,6 +198,7 @@ func GenImplantHelp(con *repl.Console) {
185198 panic (err )
186199 }
187200 GenGroupHelp (implantMd , con , consts .ImplantGroup ,
201+ basic .Commands ,
188202 tasks .Commands ,
189203 modules .Commands ,
190204 explorer .Commands ,
@@ -200,12 +214,17 @@ func GenImplantHelp(con *repl.Console) {
200214 reg .Commands ,
201215 taskschd .Commands ,
202216 privilege .Commands ,
217+ third .Commands ,
203218 )
204219
205220 GenGroupHelp (implantMd , con , consts .FileGroup ,
206221 file .Commands ,
207222 filesystem .Commands ,
208223 pipe .Commands )
224+
225+ GenGroupHelp (implantMd , con , consts .PivotGroup ,
226+ pivot .Commands ,
227+ )
209228}
210229
211230func GenClientHelp (con * repl.Console ) {
@@ -222,15 +241,47 @@ func GenClientHelp(con *repl.Console) {
222241 extension .Commands ,
223242 armory .Commands ,
224243 mal .Commands ,
244+ configCmd .Commands ,
245+ context .Commands ,
246+ cert .Commands ,
225247 )
226248
227249 GenGroupHelp (clientMd , con , consts .ListenerGroup ,
228250 listener .Commands ,
251+ website .Commands ,
252+ pipeline .Commands ,
229253 )
230254
231255 GenGroupHelp (clientMd , con , consts .GeneratorGroup ,
232- build .Commands )
256+ build .Commands ,
257+ mutant .Commands )
258+
259+ }
260+
261+ func GenMalHelper (con * repl.Console , name string ) {
262+ clientMd , err := os .Create (name + ".md" )
263+ if err != nil {
264+ panic (err )
265+ }
233266
267+ rpc := clientrpc .NewMaliceRPCClient (nil )
268+ intermediate .RegisterBuiltin (rpc )
269+ command .RegisterClientFunc (con )
270+ command .RegisterImplantFunc (con )
271+ clientMd .Write ([]byte (fmt .Sprintf ("## %s\n " , name )))
272+ for _ , p := range plugin .GetGlobalMalManager ().GetAllEmbeddedPlugins () {
273+ var cmds []* cobra.Command
274+ for _ , cc := range p .CMDs {
275+ cmds = append (cmds , cc .Command )
276+ }
277+ sort .Sort (byName (cmds ))
278+ for _ , c := range cmds {
279+ c .SetHelpCommand (nil )
280+ _ = GenMarkdownTreeCustom (c , clientMd , func (s string ) string {
281+ return "#" + strings .ReplaceAll (s , " " , "-" )
282+ })
283+ }
284+ }
234285}
235286
236287func main () {
@@ -242,4 +293,5 @@ func main() {
242293
243294 GenClientHelp (con )
244295 GenImplantHelp (con )
296+ GenMalHelper (con , "community" )
245297}
0 commit comments