gofmt all the things
parent
97bee891ce
commit
76531cb818
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
type response struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Id string `json:"id"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
func rpc_send(res interface{}) {
|
||||
|
@ -21,34 +21,33 @@ func rpc_send(res interface{}) {
|
|||
|
||||
type (
|
||||
logparams struct {
|
||||
Level string `json:"level"`
|
||||
Level string `json:"level"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
LogRequest struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
Params logparams `json:"params"`
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
Params logparams `json:"params"`
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
// 'debug'
|
||||
func Log(message string, level string) {
|
||||
req := &LogRequest {"2.0", "message", logparams{level, message}}
|
||||
req := &LogRequest{"2.0", "message", logparams{level, message}}
|
||||
rpc_send(req)
|
||||
}
|
||||
|
||||
type (
|
||||
reportparams struct {
|
||||
Type string `json:"type"`
|
||||
Type string `json:"type"`
|
||||
Data map[string]string `json:"data"`
|
||||
}
|
||||
|
||||
ReportRequest struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
Params reportparams `json:"params"`
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
Params reportparams `json:"params"`
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -56,7 +55,7 @@ func report(kind string, base map[string]string, opts map[string]string) {
|
|||
for k, v := range base {
|
||||
opts[k] = v
|
||||
}
|
||||
req := &ReportRequest {"2.0", "report", reportparams{kind, opts}}
|
||||
req := &ReportRequest{"2.0", "report", reportparams{kind, opts}}
|
||||
rpc_send(req)
|
||||
}
|
||||
|
||||
|
@ -88,59 +87,59 @@ func ReportWrongPassword(username string, password string, opts map[string]strin
|
|||
type (
|
||||
Reference struct {
|
||||
Type string `json:"type"`
|
||||
Ref string `json:"ref"`
|
||||
Ref string `json:"ref"`
|
||||
}
|
||||
|
||||
Target struct {
|
||||
Platform string `json:"platform"`
|
||||
Arch string `json:"arch"`
|
||||
Arch string `json:"arch"`
|
||||
}
|
||||
|
||||
Option struct {
|
||||
Type string `json:"type"`
|
||||
Type string `json:"type"`
|
||||
Description string `json:"description"`
|
||||
Required bool `json:"required"`
|
||||
Default string `json:"default"`
|
||||
Required bool `json:"required"`
|
||||
Default string `json:"default"`
|
||||
}
|
||||
|
||||
Metadata struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Authors []string `json:"authors"`
|
||||
Date string `json:"date"`
|
||||
References []Reference `json:"references"`
|
||||
Type string `json:"type"`
|
||||
Rank string `json:"rank"`
|
||||
WFSDelay int `json:"wfsdelay"`
|
||||
Privileged bool `json:"privileged"`
|
||||
Targets []Target `json:"targets",omitempty`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
Payload map[string]string `json:"payload",omitempty`
|
||||
Options map[string]Option `json:"options",omitempty`
|
||||
Notes map[string][]string `json:"notes",omitempty`
|
||||
}
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Authors []string `json:"authors"`
|
||||
Date string `json:"date"`
|
||||
References []Reference `json:"references"`
|
||||
Type string `json:"type"`
|
||||
Rank string `json:"rank"`
|
||||
WFSDelay int `json:"wfsdelay"`
|
||||
Privileged bool `json:"privileged"`
|
||||
Targets []Target `json:"targets",omitempty`
|
||||
Capabilities []string `json:"capabilities"`
|
||||
Payload map[string]string `json:"payload",omitempty`
|
||||
Options map[string]Option `json:"options",omitempty`
|
||||
Notes map[string][]string `json:"notes",omitempty`
|
||||
}
|
||||
|
||||
Request struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Method string `json:"method"`
|
||||
Id string `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Id string `json:"id"`
|
||||
}
|
||||
|
||||
MetadataResponse struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Id string `json:"id"`
|
||||
Result *Metadata `json:"result"`
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Id string `json:"id"`
|
||||
Result *Metadata `json:"result"`
|
||||
}
|
||||
|
||||
RunResult struct {
|
||||
Message string `json:"message"`
|
||||
Return string `json:"return"`
|
||||
Return string `json:"return"`
|
||||
}
|
||||
|
||||
RunResponse struct {
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Id string `json:"id"`
|
||||
Result RunResult `json:"result"`
|
||||
Jsonrpc string `json:"jsonrpc"`
|
||||
Id string `json:"id"`
|
||||
Result RunResult `json:"result"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
//usr/bin/env go run "$0" "$@"; exit "$?"
|
||||
package main
|
||||
|
||||
import (
|
||||
"metasploit"
|
||||
)
|
||||
|
@ -9,20 +10,20 @@ func exploit(req *metasploit.Request) string {
|
|||
}
|
||||
|
||||
func main() {
|
||||
m := &metasploit.Metadata {
|
||||
Name: "Test Module",
|
||||
m := &metasploit.Metadata{
|
||||
Name: "Test Module",
|
||||
Description: "This is a test",
|
||||
Authors: []string{ "bcook-r7" },
|
||||
Date: "2018-10-6",
|
||||
Type: "remote_exploit",
|
||||
Rank: "excellent",
|
||||
Privileged: false,
|
||||
Targets: []metasploit.Target {
|
||||
Authors: []string{"bcook-r7"},
|
||||
Date: "2018-10-6",
|
||||
Type: "remote_exploit",
|
||||
Rank: "excellent",
|
||||
Privileged: false,
|
||||
Targets: []metasploit.Target{
|
||||
{Platform: "linux", Arch: "x64"},
|
||||
{Platform: "linux", Arch: "x86"}},
|
||||
References: []metasploit.Reference {
|
||||
References: []metasploit.Reference{
|
||||
{Type: "URL", Ref: "https://golang.org"}},
|
||||
Options: map[string]metasploit.Option {
|
||||
Options: map[string]metasploit.Option{
|
||||
"Test": {Type: "string", Description: "This is a test", Required: false, Default: ""}}}
|
||||
|
||||
metasploit.Run(m, exploit)
|
||||
|
|
Loading…
Reference in New Issue