|
@@ -11,6 +11,7 @@ import (
|
|
|
|
|
|
|
|
var aes_key = "03020100070605040b0a09080f0e0d0c"
|
|
var aes_key = "03020100070605040b0a09080f0e0d0c"
|
|
|
|
|
|
|
|
|
|
+
|
|
|
func serveConnection(conn net.Conn) {
|
|
func serveConnection(conn net.Conn) {
|
|
|
defer logPanic()
|
|
defer logPanic()
|
|
|
defer conn.Close()
|
|
defer conn.Close()
|
|
@@ -28,11 +29,11 @@ func serveConnection(conn net.Conn) {
|
|
|
errCheckPanic(err, "Connection failed %s device #%d", conn.RemoteAddr().String(), id)
|
|
errCheckPanic(err, "Connection failed %s device #%d", conn.RemoteAddr().String(), id)
|
|
|
fmt.Printf("Payload: %x\n", payload)
|
|
fmt.Printf("Payload: %x\n", payload)
|
|
|
message := make([]byte, msglen-16)
|
|
message := make([]byte, msglen-16)
|
|
|
- c, err := aes.NewCipher(decoded)
|
|
|
|
|
|
|
+ block, err := aes.NewCipher(decoded)
|
|
|
errCheckPanic(err, "Decryption failed %s device #%d", conn.RemoteAddr().String(), id)
|
|
errCheckPanic(err, "Decryption failed %s device #%d", conn.RemoteAddr().String(), id)
|
|
|
- cbc := cipher.NewCBCEncrypter(c, payload[:16])
|
|
|
|
|
- cbc.CryptBlocks(payload[16:], message)
|
|
|
|
|
- fmt.Printf("Message: %x\n", message)
|
|
|
|
|
|
|
+ mode := cipher.NewCBCDecrypter(block, payload[:16])
|
|
|
|
|
+ mode.CryptBlocks(message, payload[16:])
|
|
|
|
|
+ fmt.Printf("Message: %s\n", string(message))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|