mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 04:15:54 +02:00
Add B64decode expr helper (#2183)
This commit is contained in:
parent
8f71edaadd
commit
a753ea6981
3 changed files with 72 additions and 1 deletions
|
@ -2,6 +2,7 @@ package exprhelpers
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
|
@ -585,3 +586,12 @@ func Match(params ...any) (any, error) {
|
|||
}
|
||||
return matched, nil
|
||||
}
|
||||
|
||||
func B64Decode(params ...any) (any, error) {
|
||||
encoded := params[0].(string)
|
||||
decoded, err := base64.StdEncoding.DecodeString(encoded)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(decoded), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue