Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
aebd6842
Commit
aebd6842
authored
Nov 22, 2018
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update vendor
parent
a020c7bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
22 deletions
+105
-22
vendor/github.com/ginuerzh/tls-dissector/handshake.go
vendor/github.com/ginuerzh/tls-dissector/handshake.go
+102
-19
vendor/vendor.json
vendor/vendor.json
+3
-3
No files found.
vendor/github.com/ginuerzh/tls-dissector/handshake.go
View file @
aebd6842
...
@@ -2,7 +2,9 @@ package dissector
...
@@ -2,7 +2,9 @@ package dissector
import
(
import
(
"bytes"
"bytes"
"crypto/tls"
"encoding/binary"
"encoding/binary"
"fmt"
"io"
"io"
)
)
...
@@ -62,6 +64,11 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
...
@@ -62,6 +64,11 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
}
}
length
:=
int
(
b
[
1
])
<<
16
|
int
(
b
[
2
])
<<
8
|
int
(
b
[
3
])
length
:=
int
(
b
[
1
])
<<
16
|
int
(
b
[
2
])
<<
8
|
int
(
b
[
3
])
if
length
<
34
{
// length of version + random
err
=
fmt
.
Errorf
(
"bad length, need at least 34 bytes, got %d"
,
length
)
return
}
b
=
make
([]
byte
,
length
)
b
=
make
([]
byte
,
length
)
nn
,
err
=
io
.
ReadFull
(
r
,
b
)
nn
,
err
=
io
.
ReadFull
(
r
,
b
)
n
+=
int64
(
nn
)
n
+=
int64
(
nn
)
...
@@ -69,6 +76,10 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
...
@@ -69,6 +76,10 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
return
return
}
}
h
.
Version
=
Version
(
binary
.
BigEndian
.
Uint16
(
b
[
:
2
]))
h
.
Version
=
Version
(
binary
.
BigEndian
.
Uint16
(
b
[
:
2
]))
if
h
.
Version
<
tls
.
VersionTLS12
{
err
=
fmt
.
Errorf
(
"bad version: only TLSv1.2 is supported"
)
return
}
pos
:=
2
pos
:=
2
h
.
Random
.
Time
=
binary
.
BigEndian
.
Uint32
(
b
[
pos
:
pos
+
4
])
h
.
Random
.
Time
=
binary
.
BigEndian
.
Uint32
(
b
[
pos
:
pos
+
4
])
...
@@ -76,41 +87,113 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
...
@@ -76,41 +87,113 @@ func (h *ClientHelloHandshake) ReadFrom(r io.Reader) (n int64, err error) {
copy
(
h
.
Random
.
Opaque
[
:
],
b
[
pos
:
pos
+
28
])
copy
(
h
.
Random
.
Opaque
[
:
],
b
[
pos
:
pos
+
28
])
pos
+=
28
pos
+=
28
sessionLen
:=
int
(
b
[
pos
])
nn
,
err
=
h
.
readSession
(
b
[
pos
:
])
pos
++
if
err
!=
nil
{
h
.
SessionID
=
make
([]
byte
,
sessionLen
)
return
copy
(
h
.
SessionID
,
b
[
pos
:
pos
+
sessionLen
])
}
pos
+=
sessionLen
pos
+=
nn
nn
,
err
=
h
.
readCipherSuites
(
b
[
pos
:
])
if
err
!=
nil
{
return
}
pos
+=
nn
cipherLen
:=
int
(
binary
.
BigEndian
.
Uint16
(
b
[
pos
:
pos
+
2
]))
nn
,
err
=
h
.
readCompressionMethods
(
b
[
pos
:
])
pos
+=
2
if
err
!=
nil
{
for
i
:=
0
;
i
<
cipherLen
/
2
;
i
++
{
return
h
.
CipherSuites
=
append
(
h
.
CipherSuites
,
CipherSuite
(
binary
.
BigEndian
.
Uint16
(
b
[
pos
:
pos
+
2
])))
pos
+=
2
}
}
pos
+=
nn
compLen
:=
int
(
b
[
pos
])
nn
,
err
=
h
.
readExtensions
(
b
[
pos
:
])
pos
++
if
err
!=
nil
{
for
i
:=
0
;
i
<
compLen
;
i
++
{
return
h
.
CompressionMethods
=
append
(
h
.
CompressionMethods
,
CompressionMethod
(
b
[
pos
]))
pos
++
}
}
// pos += nn
return
}
// extLen := int(binary.BigEndian.Uint16(b[pos : pos+2]))
func
(
h
*
ClientHelloHandshake
)
readSession
(
b
[]
byte
)
(
n
int
,
err
error
)
{
pos
+=
2
if
len
(
b
)
==
0
{
if
pos
>=
len
(
b
)
{
err
=
fmt
.
Errorf
(
"bad length: data too short for session"
)
return
return
}
}
br
:=
bytes
.
NewReader
(
b
[
pos
:
])
nlen
:=
int
(
b
[
0
])
n
++
if
len
(
b
)
<
n
+
nlen
{
err
=
fmt
.
Errorf
(
"bad length: malformed data for session"
)
}
if
nlen
>
0
&&
n
+
nlen
<=
len
(
b
)
{
h
.
SessionID
=
make
([]
byte
,
nlen
)
copy
(
h
.
SessionID
,
b
[
n
:
n
+
nlen
])
n
+=
nlen
}
return
}
func
(
h
*
ClientHelloHandshake
)
readCipherSuites
(
b
[]
byte
)
(
n
int
,
err
error
)
{
if
len
(
b
)
<
2
{
err
=
fmt
.
Errorf
(
"bad length: data too short for cipher suites"
)
return
}
nlen
:=
int
(
binary
.
BigEndian
.
Uint16
(
b
[
:
2
]))
n
+=
2
if
len
(
b
)
<
n
+
nlen
{
err
=
fmt
.
Errorf
(
"bad length: malformed data for cipher suites"
)
}
for
i
:=
0
;
i
<
nlen
/
2
;
i
++
{
h
.
CipherSuites
=
append
(
h
.
CipherSuites
,
CipherSuite
(
binary
.
BigEndian
.
Uint16
(
b
[
n
:
n
+
2
])))
n
+=
2
}
return
}
func
(
h
*
ClientHelloHandshake
)
readCompressionMethods
(
b
[]
byte
)
(
n
int
,
err
error
)
{
if
len
(
b
)
==
0
{
err
=
fmt
.
Errorf
(
"bad length: data too short for compression methods"
)
return
}
nlen
:=
int
(
b
[
0
])
n
++
if
len
(
b
)
<
n
+
nlen
{
err
=
fmt
.
Errorf
(
"bad length: malformed data for compression methods"
)
}
for
i
:=
0
;
i
<
nlen
;
i
++
{
h
.
CompressionMethods
=
append
(
h
.
CompressionMethods
,
CompressionMethod
(
b
[
n
]))
n
++
}
return
}
func
(
h
*
ClientHelloHandshake
)
readExtensions
(
b
[]
byte
)
(
n
int
,
err
error
)
{
if
len
(
b
)
<
2
{
err
=
fmt
.
Errorf
(
"bad length: data too short for extensions"
)
return
}
nlen
:=
int
(
binary
.
BigEndian
.
Uint16
(
b
[
:
2
]))
n
+=
2
if
len
(
b
)
<
n
+
nlen
{
err
=
fmt
.
Errorf
(
"bad length: malformed data for extensions"
)
return
}
br
:=
bytes
.
NewReader
(
b
[
n
:
])
for
br
.
Len
()
>
0
{
for
br
.
Len
()
>
0
{
cn
:=
br
.
Len
()
var
ext
Extension
var
ext
Extension
ext
,
err
=
ReadExtension
(
br
)
ext
,
err
=
ReadExtension
(
br
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
h
.
Extensions
=
append
(
h
.
Extensions
,
ext
)
h
.
Extensions
=
append
(
h
.
Extensions
,
ext
)
n
+=
(
cn
-
br
.
Len
())
}
}
return
return
}
}
...
...
vendor/vendor.json
View file @
aebd6842
...
@@ -105,10 +105,10 @@
...
@@ -105,10 +105,10 @@
"revisionTime"
:
"2017-09-11T08:28:29Z"
"revisionTime"
:
"2017-09-11T08:28:29Z"
},
},
{
{
"checksumSHA1"
:
"
oAor5oKUyfFTHUT7ICWfe/aZTrY
="
,
"checksumSHA1"
:
"
Mwt6O7YzbBVMQiMb5Zkxx5HU8uc
="
,
"path"
:
"github.com/ginuerzh/tls-dissector"
,
"path"
:
"github.com/ginuerzh/tls-dissector"
,
"revision"
:
"
7037c35ed6947fe9d9c33785fca4ac96eef8e62b
"
,
"revision"
:
"
c277f49352a96cef91b8a57ad0bc23ac7fe28bf1
"
,
"revisionTime"
:
"2018-11-
03T04:46:17
Z"
"revisionTime"
:
"2018-11-
22T08:01:35
Z"
},
},
{
{
"checksumSHA1"
:
"fBx0fqiyrl26gkGo14J9pJ8zB2Y="
,
"checksumSHA1"
:
"fBx0fqiyrl26gkGo14J9pJ8zB2Y="
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment