Skip to content

Commit 8e72b77

Browse files
authored
Merge pull request #351 from lobsterjerusalem/fix-duplicate-output
De-duplicate product/vendor name output in cases where they are the same.
2 parents a38e524 + 6b2d31a commit 8e72b77

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

config/config.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ func NewRemoteExploit(implemented ImplementedFeatures, extype ExploitType, suppo
168168
product []string, cpe []string, cve string, protocol string, defaultPort int,
169169
) *Config {
170170
newConf := new(Config)
171+
newConf.Product = deDupeProductName(product, vendor)
171172
newConf.InitFlagsStructs()
172173
newConf.Impl = implemented
173174
newConf.ExType = extype
174175
newConf.SupportedC2 = supportedC2
175176
newConf.Vendor = vendor
176177
newConf.Products = product
177-
newConf.Product = fmt.Sprintf("%s %s", vendor, strings.Join(product, "/"))
178178
newConf.C2AutoStart = true
179179
newConf.CPE = cpe
180180
newConf.CVE = cve
@@ -184,18 +184,27 @@ func NewRemoteExploit(implemented ImplementedFeatures, extype ExploitType, suppo
184184
return newConf
185185
}
186186

187+
func deDupeProductName(product []string, vendor string) string {
188+
joinedProducts := strings.Join(product, "/")
189+
if joinedProducts == vendor {
190+
return vendor
191+
}
192+
193+
return fmt.Sprintf("%s %s", vendor, joinedProducts)
194+
}
195+
187196
// Defines a new remote exploit and associates with CVE/Product/Protocol metadata. Usage example:.
188197
func NewLocalExploit(implemented ImplementedFeatures, extype ExploitType, supportedC2 []c2.Impl, vendor string,
189198
product []string, cpe []string, cve string,
190199
) *Config {
191200
newConf := new(Config)
201+
newConf.Product = deDupeProductName(product, vendor)
192202
newConf.InitFlagsStructs()
193203
newConf.Impl = implemented
194204
newConf.ExType = extype
195205
newConf.SupportedC2 = supportedC2
196206
newConf.Vendor = vendor
197207
newConf.Products = product
198-
newConf.Product = fmt.Sprintf("%s %s", vendor, strings.Join(product, "/"))
199208
newConf.C2AutoStart = true
200209
newConf.CPE = cpe
201210
newConf.CVE = cve

0 commit comments

Comments
 (0)