Skip to content

Commit

Permalink
Merge pull request #2 from nowsecure/change-api-to-just-get-plist
Browse files Browse the repository at this point in the history
add ability to retrieve PList of device
  • Loading branch information
dylanhitt committed Jan 11, 2022
2 parents 36811d7 + b9aa67c commit ca00077
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.devcontainer/
19 changes: 3 additions & 16 deletions lockdown/lockdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Client interface {
Pair() error
ValidatePair() error
DeviceName() (string, error)
GetPList(string, string) (plist.PList, error)
PList() (plist.PList, error)
Close() error
}

Expand Down Expand Up @@ -81,22 +81,9 @@ func (s *client) DeviceName() (string, error) {
return result, err
}

func (s *client) GetPList(domain, key string) (plist.PList, error) {
func (s *client) PList() (plist.PList, error) {
var node C.plist_t

domainC := C.CString(domain)
keyC := C.CString(key)
defer C.free(unsafe.Pointer(domainC))
defer C.free(unsafe.Pointer(keyC))

if domain == "" {
domainC = nil
}
if key == "" {
keyC = nil
}

err := resultToError(C.lockdownd_get_value(s.p, domainC, keyC, &node))
err := resultToError(C.lockdownd_get_value(s.p, nil, nil, &node))
if err != nil {
return nil, err
}
Expand Down
2 changes: 0 additions & 2 deletions plist/plist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ package plist
// #include <stdlib.h>
// #include <libimobiledevice/lockdown.h>
import "C"

import (
"C"
"unsafe"
)

Expand Down

0 comments on commit ca00077

Please sign in to comment.