-
-
Notifications
You must be signed in to change notification settings - Fork 182
/
stopsession.go
executable file
·43 lines (36 loc) · 947 Bytes
/
stopsession.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ios
import (
"bytes"
plist "howett.net/plist"
)
type stopSessionRequest struct {
Label string
Request string
SessionID string
}
func newStopSessionRequest(sessionID string) stopSessionRequest {
data := stopSessionRequest{
Label: "go.ios.control",
Request: "StopSession",
SessionID: sessionID,
}
return data
}
type stopSessionResponse struct {
Request string
}
func stopSessionResponsefromBytes(plistBytes []byte) stopSessionResponse {
decoder := plist.NewDecoder(bytes.NewReader(plistBytes))
var data stopSessionResponse
_ = decoder.Decode(&data)
return data
}
// StopSession sends a Lockdown StopSessionRequest to the device
func (lockDownConn *LockDownConnection) StopSession() {
if lockDownConn.sessionID == "" {
return
}
lockDownConn.Send(newStopSessionRequest(lockDownConn.sessionID))
// this returns a stopSessionResponse which we currently do not care about
lockDownConn.ReadMessage()
}