Files
revsuit/internal/notice/format.go
T
Li4n0 3559894acc feat: complete basic functions
Support http,dns and mysql connection. Support custom http, dns response. Support dns rebinding.
Support mysql load local files and jdbc deserialize exploit.
2021-04-21 18:55:16 +08:00

33 lines
756 B
Go

package notice
import (
"fmt"
"reflect"
"strings"
"github.com/li4n0/revsuit/internal/record"
)
func formatRecordField(r record.Record,fieldFormat string) (content string) {
structType := reflect.ValueOf(r)
for i := 0; i < structType.NumField(); i++ {
structField := structType.Type().Field(i)
fieldName := structField.Name
tag := structField.Tag
label := tag.Get("notice")
if label == "-" {
continue
} else if label != "" {
fieldName = label
}
value := structType.Field(i).Interface()
if value, ok := value.(record.Record); ok {
content += formatRecordField(value, fieldFormat)
continue
}
content += fmt.Sprintf(fieldFormat+"\n", strings.ToUpper(fieldName), value)
}
strings.TrimSuffix(content, "\n")
return
}