Skip to content

Commit

Permalink
New version of go ios (#17)
Browse files Browse the repository at this point in the history
* initial

* add proxy groundwork

* added boilerplate

* proxy works for simple usbmux commands

* protocol upgrad to lockdown works now, fixing SSL next

* deviceinfo works

* added service map

* service connect added, next up is adding the last protocol upgrade code and bindump

* added bindump

* add some logging

* remove unused method

* remove unused method

* buildable after refactor

* fixed screenshotr

* fix diagnostics

* add forward command back

* clean up

* add errors and comments

* fix proxy build errors and add code for usbmux except for connect

* fixed listen, added SSL. SSL still broken when checked properly

* fixed ssl connection

* added storing service information

* fixed minor bugs and added binary dumping to device service connections

* copied over boilerplate to create directories for dumping

* add most logs

* fix remaining logs

* fixed up logging a bit

* logging fixes, everything seems to work now

* added dtx codec

* updated deps

* added dtx dumping

* inserted nsarchiver code, added writable auxiliary

* add disabling ssl after lockdown stopsession

* fix listen command connection cleanup

* fixed unarchiver for a few types, added debugserver as handshakeonly service

* add DTActivityTraceTapMessage

* added testmanagerd skeleton code, dtx message encoder and some more tests, custom object unarchiving

* added code to send first message to the device *yay*

* fix and clean diagnostics code a little

* fixed sending and receiving messages

* add better errors

* added support for arrays

* add support for installationproxy, add support for arrays in nskeyedarchiver

* added system and user apps and parsing

* fix type

* added dictionary to archiver. fixed process launch

* hardcode path param

* some more cleanup

* added cmd line support for launching apps

* added house arrest and vendcontainer

* added afc write file and list files commands

* disable integration test for now

* added preparation steps for xcuitestrunner

* added preparation steps for xcuitestrunner

* finish nskeyedarchiver for xctestconfig

* fixed minor bugs

* refactor a little, fix bug in sending file

* added startTestRunner method

* uncomment processcontrol defer close, got a bug there. added first testmanagerd commands. need to add dtxprimitivedictionary type 6

* added int64 type to primitivedictionary

* fix some xctestconfig bugs and a malformed dtx- ack

* fixed ack for good, added receiving method calls

* added some hacks to make it work

* fixed typenames

* added run WDA command

* add killing wdarunner on sigint

* added options to runwda

* changed log levels

* add line break to syslog

* change log levels for debugproxy to info

* minor fixes to encoder, added support for methods without arguments, first ax method call

* receiving state changes and notifications

* fixes

* fixes

* replace read calls with ReadFull

* fix evil map iteration bug

* add looping through AX 10 times

* remove useless log

* clean up code

* split up connection and channel, fix pointers

* rename DtxChannel->Channel and DtxConnection->Connection

* some renames and cleanup

* comments, renaming

* clean up and comment AX

* update modules

* update go version

* move to method

* fix debug proxy to accept other devices than my iphone

* use varargs instead of array

* use MethodCall

* clean up processcontrol

* clean up useless logs

* added test for ntohs and changed ports to uint16

* simpliy toPlist

* simpliy toPlist

* removed pointer types

* revived tests and deleted old tests

* added comment

* renamed package usbmux to ios

* rename usbmux to ios

* rename usbmux to ios

* removed gitignore for ios

* moved into proxy package

* clean up screenshotr

* fix mock

* go fmt

* clean up deviceconn und usbmuxconnection

* clean up deviceconnectioninterface

* added tests to usbmuxconnection, cleaning up methods

* clean up lockdown code

* added dashreplacement in device udid if contained

* added processcontrol test and refactored service

* fixed udid dashhandling

* fixed udid dashhandling

* update readme, setup ax integration test

* fixed error message for missing developer image

* added support for getting and setting languages

* refactor a little and add some comments

* refactor a little and add some comments

* rename

* refactor to use easier lockdown session functions

* add pcap

* add pcap folder

* fix debugproxy to not break on lockdown connect errors, add fixtures for int dict and xctestconfiguration

* make uint64 keyed dictionaries work, add xctestconfiguration partial decoding

* fix lockdown service information missing bug

* add support for secure process control

* add support for secure testmanagerd and fix logs

* add support to debugproxy

* uncrust logs, add support for xctcaps and dthearbeat decoding, make nojson default for dproxy

* reduce logging verbosity and add unarchiving nsuuid, xctactivityrecord

* make xcode12 work

* clean up logs

* fix os signals

* update help

* add reboot

* fix ios 12

* add support for params

* add encoder test

* simplify code, add test

* fix test failures, add fragmentdecoder unit test

* add comments, remove panic

* remove unused interface

* add release workflow to master

* update to go 1.16

* add version tag to ios.go

* update readme

* Add mac release (#6)

* add mac build

* try mac release

* try mac release

* replace mac sed with gnu sed

* replace mac sed with gnu sed

* finish mac os release

* Fix mac release version (#7)

Rename the main file from ios.go to main.go
create the release on the mac os job and add a release_tag file to the artifact
upload both releases on the linux job

* remove confusing old readme
  • Loading branch information
danielpaulus authored Mar 29, 2021
1 parent aa4b414 commit 1415aa5
Show file tree
Hide file tree
Showing 118 changed files with 8,650 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
on:
push:
branches:
- master
name: Release-Go-iOS
jobs:
build_on_mac:
runs-on: macos-latest
steps:
- name: Create Release
id: create_release
uses: zendesk/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_schema: semantic
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
brew install gnu-sed
alias sed=gsed
gsed -i 's/version \= \"local-build\"/version = \"${{ steps.create_release.outputs.current_tag }}\"/' main.go
mkdir bin
go build -ldflags="-s -w" -o bin/ios
echo ${{ steps.create_release.outputs.current_tag }} > release_tag
zip -j go-ios-mac.zip bin/ios release_tag
- name: upload the macos build
uses: actions/upload-artifact@v2
with:
name: macos-build
path: go-ios-mac.zip
retention-days: 1
build_on_linux_and_release:
runs-on: ubuntu-latest
needs: build_on_mac
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Download mac release from previous job
uses: actions/download-artifact@v2
with:
name: macos-build
path: ./mac-bin
- name: Download and package mac binary
run: |
unzip go-ios-mac.zip
echo "release_tag="$(cat release_tag) >> $GITHUB_ENV
rm go-ios-mac.zip
zip -j go-ios-mac.zip ios
working-directory: ./mac-bin
- name: Build
run: |
sed -i 's/version \= \"local-build\"/version = \"${{ env.release_tag }}\"/' main.go
mkdir bin
go build -ldflags="-s -w" -o bin/ios
cp ./mac-bin/go-ios-mac.zip .
zip -j go-ios-linux.zip bin/ios
- uses: AButler/[email protected]
with:
files: "*.zip"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ env.release_tag }}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Binaries for programs and plugins
*.log
*.exe
*.exe~
*.dll
*.so
*.dylib
go-ios
usbmuxd
main
*.png

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.idea
.vscode
.DS_Store
.circleci/
__debug_bin
dump-*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# go-ios

Is a port of the wonderful https://www.libimobiledevice.org to golang, so you can control iOS devices using go :-)

It supports XCUI Test now. Updating the readme later.
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/danielpaulus/go-ios

go 1.15

require (
github.com/Masterminds/semver v1.5.0
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/google/uuid v1.1.2
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.6.1
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a // indirect
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5
)
33 changes: 33 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a h1:i47hUS795cOydZI4AwJQCKXOr4BvxzvikwDoDtHhP2Y=
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 h1:AQkaJpH+/FmqRjmXZPELom5zIERYZfwTjnHpfoVMQEc=
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
19 changes: 19 additions & 0 deletions ios/accessibility/accessibility.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package accessibility

import (
"github.com/danielpaulus/go-ios/ios"
dtx "github.com/danielpaulus/go-ios/ios/dtx_codec"
)

const serviceName string = "com.apple.accessibility.axAuditDaemon.remoteserver"

//New creates and connects to the given device, a new ControlInterface instance
func New(device ios.DeviceEntry) (ControlInterface, error) {
conn, err := dtx.NewConnection(device, serviceName)
if err != nil {
return ControlInterface{}, err
}
control := ControlInterface{conn.GlobalChannel()}
err = control.init()
return control, err
}
Loading

0 comments on commit 1415aa5

Please sign in to comment.