summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-08-31 20:12:43 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-08-31 20:12:43 +0200
commit8137b237f0db8f7db7a84bdbc796548136fedc89 (patch)
treee700fd558309fa3112b93da55ede3c7013b6c58b
parent8040ab81e7072dade256ba2664934ca39a635e67 (diff)
Remove dead code
-rw-r--r--main.go24
1 files changed, 4 insertions, 20 deletions
diff --git a/main.go b/main.go
index 9f59703..2d958d3 100644
--- a/main.go
+++ b/main.go
@@ -55,7 +55,7 @@ func (dir Direction) sniffCert(b []byte) error {
return nil
}
-func (dir Direction)sniffRnd(b []byte) error {
+func (dir Direction) sniffRnd(b []byte) error {
rnd := b[0x0b:0x2b]
fmt.Println(dir, "rnd", len(rnd), "bytes")
d := data[dir]
@@ -78,29 +78,15 @@ func downgrade(b []byte) int {
copy(b[0x2e:], b[0x2e+14:]) // copy second half over first (7 non dhe ciphers)
//copy(b[0x2e+14:], b[0x2e+28:]) // preserve fist half (7 dhe ciphers)
- return len(b)-14
+ return len(b) - 14
}
var trydowngrade = false
-func swapciphers(b []byte) {
- fmt.Println(hex.Dump(b))
-
- cipher1 := b[0x2e:0x3c]
- cipher2 := b[0x3c:0x4a]
-
- buf := make([]byte, len(b))
- copy(buf, b)
- copy(buf[0x2e:], cipher2)
- copy(buf[0x3c:], cipher1)
- copy(b, buf)
-}
-
func (dir Direction) sniff(src, dst net.Conn, wg *sync.WaitGroup) {
defer wg.Done()
buf := make([]byte, 4096) // 1452
- k := 1
- for {
+ for k := 1; ; k++ {
n, err := src.Read(buf)
if err != nil {
dst.Close()
@@ -111,13 +97,11 @@ func (dir Direction) sniff(src, dst net.Conn, wg *sync.WaitGroup) {
dir.sniffRnd(buf)
if trydowngrade && dir == ClientServer {
n = downgrade(buf[:n])
- //swapciphers(buf[:n])
}
}
fmt.Println(k, dir, n, "bytes")
fmt.Println(hex.Dump(buf[:n]))
- k++
dir.sniffCert(buf[:n])
@@ -148,5 +132,5 @@ func main() {
go ServerClient.sniff(srv, cnt, &wg)
go ClientServer.sniff(cnt, srv, &wg)
wg.Wait()
-// fmt.Println(data)
+ // fmt.Println(data)
}