mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 20:54:02 +03:00
Refactored all the things!
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/juju/errors"
|
||||
|
||||
"github.com/9seconds/mtg/mtproto"
|
||||
"github.com/9seconds/mtg/utils"
|
||||
)
|
||||
|
||||
// [frameOffsetFirst:frameOffsetKey:frameOffsetIV:frameOffsetMagic:frameOffsetDC:frameOffsetEnd]
|
||||
@@ -67,14 +68,7 @@ func (f Frame) ConnectionType() (mtproto.ConnectionType, error) {
|
||||
// Invert inverts frame for extracting encryption keys. Pkease check that link:
|
||||
// https://blog.susanka.eu/how-telegram-obfuscates-its-mtproto-traffic/
|
||||
func (f Frame) Invert() Frame {
|
||||
reversed := make(Frame, FrameLen)
|
||||
copy(reversed, f)
|
||||
|
||||
for i := 0; i < frameLenKey+frameLenIV; i++ {
|
||||
reversed[frameOffsetFirst+i] = f[frameOffsetIV-1-i]
|
||||
}
|
||||
|
||||
return reversed
|
||||
return Frame(utils.ReverseBytes([]byte(f)))
|
||||
}
|
||||
|
||||
// ExtractFrame extracts exact obfuscated2 handshake frame from given reader.
|
||||
|
||||
Reference in New Issue
Block a user