aboutsummaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-06-30 19:47:04 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-06-30 19:47:04 +0200
commit6c8904606f6455b82e5ec9fad5f18f1cd587d5ef (patch)
tree32f39df25afbf4d1d83636e2ce7925d7a14acb9c /parse
parent6905df6e3b4f00786311a07f30ad32c9a9de7213 (diff)
Add uint
Diffstat (limited to 'parse')
-rw-r--r--parse/parse.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/parse/parse.go b/parse/parse.go
index 0ab611b..64a197b 100644
--- a/parse/parse.go
+++ b/parse/parse.go
@@ -3,26 +3,12 @@ package main
import (
"dim13.org/asn1/ber"
"fmt"
- "log"
)
-func Chop(b []byte) (h byte, l int, v []byte, r []byte) {
- if len(b) > 1 {
- h = b[0]
- l = int(b[1])
- if 2+l > len(b) {
- log.Fatal("lenght ", l, len(b))
- }
- v, r = b[2:2+l], b[2+l:]
- }
- return
-}
-
// broken
func dump(b []byte, indent int) {
- head, _, value, rest := Chop(b)
+ class, kind, tag, _, value, rest := ber.Split(b)
- class, kind, tag := ber.Ident(head)
for i := indent; i > 0; i-- {
fmt.Print("\t")
}
@@ -52,7 +38,7 @@ func dump(b []byte, indent int) {
func main() {
for n, s := range session {
- fmt.Println("packet", n)
+ fmt.Println(">>> packet", n)
dump(s, 0)
fmt.Println("")
}