-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugins.go
52 lines (43 loc) · 1.43 KB
/
plugins.go
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 Threebits
/*
* Edit this file to include your plugins into the full binary.
* To do this, first include the plugin path to the plugins
* in the "import" section.
*
* Then, add the plugins (as either TCP or UDP) to the "CollectPlugins"
* function with a name. Please make sure that the plugin has a unique
* name. The name you give it will also be given to users on the command
* line if they ask the system to list al plugins.
*
* For more details on writing plugins, see the documentation.
*
*/
import (
// add other private repos of plugins here
"errors"
"github.com/g-clef/Threebits/structures"
"github.com/g-clef/Threebits-plugins-public"
"net"
)
func CollectPlugins(){
RegisterPlugin("http_banner", Threebits_plugins_public.HTTPBanner{})
RegisterPlugin("https_banner", Threebits_plugins_public.HTTPSBanner{})
RegisterPlugin("ssh_banner", Threebits_plugins_public.SSHBanner{})
RegisterPlugin("generic_hex", Threebits_plugins_public.GenericHexTCP{})
// add other RegisterPlugin lines here to register your
// plugins with the system.
}
func RegisterPlugin(pluginName string, target Plugin) error {
if _, ok := Plugins[pluginName]; ok{
return errors.New("Plugin already exists")
}
target.DefineArguments()
Plugins[pluginName] = target
return nil
}
type Plugin interface {
Handle(socket net.Conn, test structures.Test) (bool, string, error)
Protocol()(string)
DefineArguments()
}
var Plugins = make(map[string]Plugin)