-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
178 lines (156 loc) · 5.8 KB
/
types.go
File metadata and controls
178 lines (156 loc) · 5.8 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package gomsf
import (
"context"
"errors"
)
var (
ErrNotAuthenticated = errors.New("not authenticated")
ErrInvalidOption = errors.New("invalid module option")
ErrSessionNotFound = errors.New("session not found")
ErrConsoleNotFound = errors.New("console not found")
ErrJobNotFound = errors.New("job not found")
ErrUnexpectedResponse = errors.New("unexpected rpc response")
ErrCommandTimeout = errors.New("command timeout")
ErrRPC = errors.New("rpc error")
)
type RPCError struct {
Class string
Message string
}
func (e *RPCError) Error() string {
if e == nil {
return ""
}
if e.Class == "" {
return e.Message
}
return e.Class + ": " + e.Message
}
func (e *RPCError) Unwrap() error {
return ErrRPC
}
type ModuleType string
const (
ExploitModuleType ModuleType = "exploit"
PayloadModuleType ModuleType = "payload"
AuxiliaryModuleType ModuleType = "auxiliary"
PostModuleType ModuleType = "post"
EncoderModuleType ModuleType = "encoder"
NopModuleType ModuleType = "nop"
EvasionModuleType ModuleType = "evasion"
)
type RPCCaller interface {
Call(ctx context.Context, method MsfRpcMethod, args ...interface{}) (interface{}, error)
}
type VersionInfo struct {
Version string `msgpack:"version" json:"version"`
RubyVersion string `msgpack:"ruby_version" json:"ruby_version"`
APIVersion string `msgpack:"api" json:"api"`
}
type Workspace struct {
Name string `msgpack:"name" json:"name"`
}
type Console struct {
ID string `msgpack:"id" json:"id"`
Prompt string `msgpack:"prompt" json:"prompt"`
Busy bool `msgpack:"busy" json:"busy"`
}
type ConsoleReadResult struct {
Data string `msgpack:"data" json:"data"`
Prompt string `msgpack:"prompt" json:"prompt"`
Busy bool `msgpack:"busy" json:"busy"`
}
type Session struct {
Type string `msgpack:"type" json:"type"`
TunnelLocal string `msgpack:"tunnel_local" json:"tunnel_local"`
TunnelPeer string `msgpack:"tunnel_peer" json:"tunnel_peer"`
ViaExploit string `msgpack:"via_exploit" json:"via_exploit"`
ViaPayload string `msgpack:"via_payload" json:"via_payload"`
Desc string `msgpack:"desc" json:"desc"`
Info string `msgpack:"info" json:"info"`
Workspace string `msgpack:"workspace" json:"workspace"`
SessionHost string `msgpack:"session_host" json:"session_host"`
SessionPort int `msgpack:"session_port" json:"session_port"`
TargetHost string `msgpack:"target_host" json:"target_host"`
Username string `msgpack:"username" json:"username"`
UUID string `msgpack:"uuid" json:"uuid"`
ExploitUUID string `msgpack:"exploit_uuid" json:"exploit_uuid"`
}
type Job struct {
ID string `msgpack:"id" json:"id"`
Name string `msgpack:"name" json:"name"`
Description string `msgpack:"description" json:"description"`
}
type MsfModuleInfo struct {
Name string `msgpack:"name" json:"name"`
Description string `msgpack:"description" json:"description"`
License string `msgpack:"license" json:"license"`
FilePath string `msgpack:"filepath" json:"filepath"`
Version string `msgpack:"version" json:"version"`
Rank string `msgpack:"rank" json:"rank"`
References []string `msgpack:"references" json:"references"`
Authors []string `msgpack:"authors" json:"authors"`
}
type MsfModuleOption struct {
Type string `msgpack:"type" json:"type"`
Required bool `msgpack:"required" json:"required"`
Advanced bool `msgpack:"advanced" json:"advanced"`
Evasion bool `msgpack:"evasion" json:"evasion"`
Desc string `msgpack:"desc" json:"desc"`
Default interface{} `msgpack:"default,omitempty" json:"default,omitempty"`
Enums []string `msgpack:"enums,omitempty" json:"enums,omitempty"`
}
type ModuleExecuteResult struct {
JobID int `msgpack:"job_id" json:"job_id"`
UUID string `msgpack:"uuid" json:"uuid"`
}
type Host struct {
Address string `msgpack:"address" json:"address"`
Mac string `msgpack:"mac" json:"mac"`
Name string `msgpack:"name" json:"name"`
OSName string `msgpack:"os_name" json:"os_name"`
OSFlavor string `msgpack:"os_flavor" json:"os_flavor"`
OSVersion string `msgpack:"os_version" json:"os_version"`
OSSP string `msgpack:"os_sp" json:"os_sp"`
OSLang string `msgpack:"os_lang" json:"os_lang"`
Purpose string `msgpack:"purpose" json:"purpose"`
Info string `msgpack:"info" json:"info"`
Comments string `msgpack:"comments" json:"comments"`
Scope string `msgpack:"scope" json:"scope"`
VirtualHost string `msgpack:"virtual_host" json:"virtual_host"`
Arch string `msgpack:"arch" json:"arch"`
}
type Service struct {
Host string `msgpack:"host" json:"host"`
Port int `msgpack:"port" json:"port"`
Proto string `msgpack:"proto" json:"proto"`
Name string `msgpack:"name" json:"name"`
State string `msgpack:"state" json:"state"`
Info string `msgpack:"info" json:"info"`
}
type Vuln struct {
ID int `msgpack:"id" json:"id"`
Host string `msgpack:"host" json:"host"`
Name string `msgpack:"name" json:"name"`
Info string `msgpack:"info" json:"info"`
Refs []string `msgpack:"refs" json:"refs"`
}
type Credential struct {
ID int `msgpack:"id" json:"id"`
Host string `msgpack:"host" json:"host"`
Port int `msgpack:"port" json:"port"`
Proto string `msgpack:"proto" json:"proto"`
Service string `msgpack:"sname" json:"sname"`
User string `msgpack:"user" json:"user"`
Pass string `msgpack:"pass" json:"pass"`
Active bool `msgpack:"active" json:"active"`
Proof string `msgpack:"proof" json:"proof"`
Type string `msgpack:"ptype" json:"ptype"`
}
type Loot struct {
ID int `msgpack:"id" json:"id"`
Host string `msgpack:"host" json:"host"`
Type string `msgpack:"ltype" json:"ltype"`
Name string `msgpack:"name" json:"name"`
Data string `msgpack:"data" json:"data"`
}