format paylaod
This commit is contained in:
@ -3,6 +3,8 @@ package rawPayloadPrinter
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"udi/database"
|
||||
)
|
||||
|
||||
@ -12,6 +14,12 @@ func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]databas
|
||||
return fmt.Errorf("Unexpected fPort %d", fPort)
|
||||
}
|
||||
|
||||
log.Printf("frmPayload: %s", frmPayload)
|
||||
bytes, err := base64.StdEncoding.DecodeString(frmPayload)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to base64-decode payload: %v", err)
|
||||
}
|
||||
hexString := hex.EncodeToString(bytes)
|
||||
|
||||
log.Printf("Payload: %s", hexString)
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user