Skip to content

Commit

Permalink
Add filesharing (#277)
Browse files Browse the repository at this point in the history
* Add filesharing

* This commit add a way to only lists apps which enable the file sharing

* fix identation
  • Loading branch information
luc-git authored Oct 20, 2023
1 parent aa56241 commit 19c53bf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
8 changes: 7 additions & 1 deletion ios/installationproxy/installationproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (conn *Connection) BrowseSystemApps() ([]AppInfo, error) {
return conn.browseApps(browseApps("System", false))
}

func (conn *Connection) BrowseFileSharingApps() ([]AppInfo, error) {
return conn.browseApps(browseApps("Filesharing", true))
}

func (conn *Connection) BrowseAllApps() ([]AppInfo, error) {
return conn.browseApps(browseApps("", true))
}
Expand Down Expand Up @@ -149,11 +153,12 @@ func browseApps(applicationType string, showLaunchProhibitedApps bool) map[strin
"SignerIdentity",
"UIDeviceFamily",
"UIRequiredDeviceCapabilities",
"UIFileSharingEnabled",
}
clientOptions := map[string]interface{}{
"ReturnAttributes": returnAttributes,
}
if applicationType != "" {
if applicationType != "" && applicationType != "Filesharing" {
clientOptions["ApplicationType"] = applicationType
}
if showLaunchProhibitedApps {
Expand Down Expand Up @@ -187,4 +192,5 @@ type AppInfo struct {
SignerIdentity string
UIDeviceFamily []int
UIRequiredDeviceCapabilities []string
UIFileSharingEnabled bool
}
20 changes: 16 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Usage:
ios pcap [options] [--pid=<processID>] [--process=<processName>]
ios install --path=<ipaOrAppFolder> [options]
ios uninstall <bundleID> [options]
ios apps [--system] [--all] [--list] [options]
ios apps [--system] [--all] [--list] [--filesharing] [options]
ios launch <bundleID> [--wait] [options]
ios kill (<bundleID> | --pid=<processID> | --process=<processName>) [options]
ios runtest [--bundle-id=<bundleid>] [--test-runner-bundle-id=<testrunnerbundleid>] [--xctest-config=<xctestconfig>] [--env=<e>]... [options]
Expand Down Expand Up @@ -198,7 +198,7 @@ The commands work as following:
ios readpair Dump detailed information about the pairrecord for a device.
ios install --path=<ipaOrAppFolder> [options] Specify a .app folder or an installable ipa file that will be installed.
ios pcap [options] [--pid=<processID>] [--process=<processName>] Starts a pcap dump of network traffic, use --pid or --process to filter specific processes.
ios apps [--system] [--all] [--list] Retrieves a list of installed applications. --system prints out preinstalled system apps. --all prints all apps, including system, user, and hidden apps. --list only prints bundle ID, bundle name and version number.
ios apps [--system] [--all] [--list] [--filesharing] Retrieves a list of installed applications. --system prints out preinstalled system apps. --all prints all apps, including system, user, and hidden apps. --list only prints bundle ID, bundle name and version number. --filesharing only prints apps which enable documents sharing.
ios launch <bundleID> [--wait] Launch app with the bundleID on the device. Get your bundle ID from the apps command. --wait keeps the connection open if you want logs.
ios kill (<bundleID> | --pid=<processID> | --process=<processName>) [options] Kill app with the specified bundleID, process id, or process name on the device.
ios runtest [--bundle-id=<bundleid>] [--test-runner-bundle-id=<testbundleid>] [--xctest-config=<xctestconfig>] [--env=<e>]... [options] Run a XCUITest. If you provide only bundle-id go-ios will try to dynamically create test-runner-bundle-id and xctest-config.
Expand Down Expand Up @@ -572,7 +572,8 @@ The commands work as following:
list, _ := arguments.Bool("--list")
system, _ := arguments.Bool("--system")
all, _ := arguments.Bool("--all")
printInstalledApps(device, system, all, list)
filesharing, _ := arguments.Bool("--filesharing")
printInstalledApps(device, system, all, list, filesharing)
return
}

Expand Down Expand Up @@ -1495,7 +1496,7 @@ func printDeviceDate(device ios.DeviceEntry) {
}
}

func printInstalledApps(device ios.DeviceEntry, system bool, all bool, list bool) {
func printInstalledApps(device ios.DeviceEntry, system bool, all bool, list bool, filesharing bool) {
svc, _ := installationproxy.New(device)
var err error
var response []installationproxy.AppInfo
Expand All @@ -1506,6 +1507,9 @@ func printInstalledApps(device ios.DeviceEntry, system bool, all bool, list bool
} else if system {
response, err = svc.BrowseSystemApps()
appType = "system"
} else if filesharing {
response, err = svc.BrowseFileSharingApps()
appType = "filesharingapps"
} else {
response, err = svc.BrowseUserApps()
appType = "user"
Expand All @@ -1518,6 +1522,14 @@ func printInstalledApps(device ios.DeviceEntry, system bool, all bool, list bool
}
return
}
if filesharing{
for _, v := range response {
if (v.UIFileSharingEnabled) {
fmt.Printf("%s %s %s\n", v.CFBundleIdentifier, v.CFBundleName, v.CFBundleShortVersionString)
}
}
return
}
if JSONdisabled {
log.Info(response)
} else {
Expand Down

0 comments on commit 19c53bf

Please sign in to comment.