POC: the user has full control over outgoing traffic
This commit is contained in:
parent
79d6308a4a
commit
a112473d0f
|
@ -26,4 +26,3 @@ func (msg CtrlKeepAlive) Vital() bool {
|
||||||
func (msg CtrlKeepAlive) Pack() []byte {
|
func (msg CtrlKeepAlive) Pack() []byte {
|
||||||
return []byte{network7.MsgCtrlKeepAlive}
|
return []byte{network7.MsgCtrlKeepAlive}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
teeworlds.go
12
teeworlds.go
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/teeworlds-go/teeworlds/messages7"
|
||||||
"github.com/teeworlds-go/teeworlds/network7"
|
"github.com/teeworlds-go/teeworlds/network7"
|
||||||
"github.com/teeworlds-go/teeworlds/protocol7"
|
"github.com/teeworlds-go/teeworlds/protocol7"
|
||||||
)
|
)
|
||||||
|
@ -71,6 +72,17 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if packet != nil {
|
if packet != nil {
|
||||||
|
|
||||||
|
// example of modifying outgoing traffic
|
||||||
|
for i, msg := range packet.Messages {
|
||||||
|
if msg.MsgId() == network7.MsgCtrlConnect {
|
||||||
|
if connect, ok := packet.Messages[0].(messages7.CtrlConnect); ok {
|
||||||
|
connect.Token = [4]byte{0xaa, 0xaa, 0xaa, 0xaa}
|
||||||
|
packet.Messages[i] = connect
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
conn.Write(packet.Pack(client))
|
conn.Write(packet.Pack(client))
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue