diff --git a/README.md b/README.md index b538d36..39f0398 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,12 @@ I am here to help! I don't want this to finish unmaintained! ```sh $ sideloader -h -Usage: sideloader [-d] [-h] [] +Usage: sideloader [-d] [--thread-count THREADCOUNT] [-h] [] Available commands: app-id Manage App IDs. cert Manage certificates. + device Manage registered devices. install Install an application on the device (renames the app, register the identifier, sign and install automatically). sign Sign an application bundle. @@ -48,7 +49,10 @@ Available commands: Optional arguments: -d, --debug Enable debug logging - -h, --help Show this help message and exit + --thread-count THREADCOUNT + Numbers of threads to be used for signing the application + bundle + -h, --help Show this help message and exit ``` Table of Contents diff --git a/frontends/cli/dub.selections.json b/frontends/cli/dub.selections.json deleted file mode 120000 index 43e1d75..0000000 --- a/frontends/cli/dub.selections.json +++ /dev/null @@ -1 +0,0 @@ -../../dub.selections.json \ No newline at end of file diff --git a/frontends/cli/dub.selections.json b/frontends/cli/dub.selections.json new file mode 100644 index 0000000..a816e87 --- /dev/null +++ b/frontends/cli/dub.selections.json @@ -0,0 +1,47 @@ +{ + "fileVersion": 1, + "versions": { + "argparse": "1.3.0", + "arsd-official": "10.9.10", + "automem": "0.6.9", + "bindbc-freetype": "1.0.5", + "bindbc-loader": "1.0.3", + "bindbc-opengl": "1.0.5", + "bindbc-sdl": "1.0.1", + "botan": "1.13.6", + "botan-math": "1.0.4", + "cachetools": "0.4.1", + "concepts": "0.0.9", + "concurrency": "5.0.4", + "dfl": {"version":"224d9348286620c8ea4854690a09e7380d6f5b2f","repository":"git+https://github.com/Dadoum/dfl.git"}, + "dlangui": "0.10.4", + "dqt": {"version":"6a44b55f3a3691da930cb9eefe2a745afe1b764d","repository":"git+https://github.com/tim-dlang/dqt.git"}, + "dsfml": "2.1.1", + "dxml": "0.4.4", + "dynamic-loader": {"version":"65a8b8b8a6d44d47e63bddc985268592ecf47764","repository":"git+https://github.com/Dadoum/dynamicloader.git"}, + "glx-d": "1.1.0", + "gtk_d": "1.0.3", + "icontheme": "1.2.3", + "ikod-containers": "0.0.22", + "inilike": "1.2.2", + "intel-intrinsics": "1.11.15", + "isfreedesktop": "0.1.1", + "keyring": {"path":"../../keyring/"}, + "memutils": "1.0.10", + "mir-core": "1.6.0", + "plist": "~master", + "plist-d": {"version":"30d152e88767611e10048b25777ecb5f9075f87c","repository":"git+https://github.com/Dadoum/libplist-d.git"}, + "progress": "5.0.2", + "provision": {"version":"533dca306b86f9c7801354b78f5187addb58b740","repository":"git+https://github.com/Dadoum/Provision.git"}, + "requests": "2.1.2", + "sideloader": {"path":"../../"}, + "silly": "1.2.0-dev.2", + "slf4d": "2.4.3", + "test_allocator": "0.3.4", + "undead": "1.1.8", + "unit-threaded": "0.10.8", + "windows-headers": "1.0.5", + "x11": "1.0.21", + "xdgpaths": "0.2.5" + } +} diff --git a/frontends/cli/source/app_id.d b/frontends/cli/source/app_id.d index 42a5ef1..dab5e68 100644 --- a/frontends/cli/source/app_id.d +++ b/frontends/cli/source/app_id.d @@ -91,7 +91,7 @@ struct AddAppId @(PositionalArgument(0).Description("app name")) string name; - @(PositionalArgument(0).Description("app identifier")) + @(PositionalArgument(1).Description("app identifier")) string identifier; int opCall() diff --git a/frontends/cli/source/cli_frontend.d b/frontends/cli/source/cli_frontend.d index c7c51bb..8cc3968 100644 --- a/frontends/cli/source/cli_frontend.d +++ b/frontends/cli/source/cli_frontend.d @@ -193,6 +193,7 @@ string defaultConfigurationPath() import app_id; import certificate; +import device; import install; // @(Command("login").Description("Log-in to your Apple account.")) // @(Command("logout").Description("Log-out.")) @@ -234,6 +235,7 @@ int entryPoint(Commands commands) return commands.cmd.match!( (AppIdCommand cmd) => cmd(), (CertificateCommand cmd) => cmd(), + (DeviceCommand cmd) => cmd(), (InstallCommand cmd) => cmd(), (SignCommand cmd) => cmd(), (TrollsignCommand cmd) => cmd(), @@ -259,7 +261,7 @@ struct Commands uint threadCount = uint.max; @SubCommands - SumType!(AppIdCommand, CertificateCommand, InstallCommand, SignCommand, TrollsignCommand, TeamCommand, ToolCommand, VersionCommand) cmd; + SumType!(AppIdCommand, CertificateCommand, DeviceCommand, InstallCommand, SignCommand, TrollsignCommand, TeamCommand, ToolCommand, VersionCommand) cmd; } mixin CLI!Commands.main!entryPoint; diff --git a/frontends/cli/source/device.d b/frontends/cli/source/device.d new file mode 100644 index 0000000..1bc4b1a --- /dev/null +++ b/frontends/cli/source/device.d @@ -0,0 +1,174 @@ +module device; + +import std.algorithm; +import std.array; +import std.exception; +import std.stdio; +import std.sumtype; +import std.typecons; + +import slf4d; +import slf4d.default_provider; + +import botan.cert.x509.pkcs10; +import botan.filters.data_src; + +import argparse; + +import server.developersession; + +import cli_frontend; + +@(Command("device").Description("Manage registered devices.")) +struct DeviceCommand +{ + int opCall() + { + return cmd.match!( + (ListDevices cmd) => cmd(), + (AddDevice cmd) => cmd(), + (DeleteDevice cmd) => cmd() + ); + } + + @SubCommands + SumType!(ListDevices, AddDevice, DeleteDevice) cmd; +} + +@(Command("list").Description("List registered devices.")) +struct ListDevices +{ + mixin LoginCommand; + + @(NamedArgument("team").Description("Team ID")) + string teamId = null; + + int opCall() + { + auto log = getLogger(); + + string configurationPath = systemConfigurationPath(); + + scope provisioningData = initializeADI(configurationPath); + scope adi = provisioningData.adi; + scope akDevice = provisioningData.device; + + auto appleAccount = login(akDevice, adi); + + if (!appleAccount) { + return 1; + } + + auto teams = appleAccount.listTeams().unwrap(); + + string teamId = this.teamId; + if (teamId != null) { + teams = teams.filter!((elem) => elem.teamId == teamId).array(); + } + enforce(teams.length > 0, "No matching team found."); + + auto team = teams[0]; + + auto devices = appleAccount.listDevices!iOS(team).unwrap(); + + writefln!"You have %d devices registered."(devices.length); + writeln("Currently registered devices:"); + foreach (device; devices) { + writefln!" - Device `%s` of UDID `%s` with the identifier `%s`"(device.name, device.deviceNumber, device.deviceId); + } + + return 0; + } +} + +@(Command("add").Description("Register device.")) +struct AddDevice +{ + mixin LoginCommand; + + @(NamedArgument("team").Description("Team ID")) + string teamId = null; + + @(PositionalArgument(0).Description("Device name")) + string name = void; + + @(PositionalArgument(1).Description("Device UDID")) + string udid = void; + + int opCall() + { + auto log = getLogger(); + + string configurationPath = systemConfigurationPath(); + + scope provisioningData = initializeADI(configurationPath); + scope adi = provisioningData.adi; + scope akDevice = provisioningData.device; + + auto appleAccount = login(akDevice, adi); + + if (!appleAccount) { + return 1; + } + + auto teams = appleAccount.listTeams().unwrap(); + + string teamId = this.teamId; + if (teamId != null) { + teams = teams.filter!((elem) => elem.teamId == teamId).array(); + } + enforce(teams.length > 0, "No matching team found."); + + auto team = teams[0]; + + auto devices = appleAccount.addDevice!iOS(team, name, udid).unwrap(); + log.info("Success!"); + + return 0; + } +} + +@(Command("delete").Description("Unregister device.")) +struct DeleteDevice +{ + mixin LoginCommand; + + @(NamedArgument("team").Description("Team ID")) + string teamId = null; + + @(PositionalArgument(0).Description("Apple device's identifier (not UDID, check device list).")) + string deviceId = void; + + int opCall() + { + auto log = getLogger(); + + string configurationPath = systemConfigurationPath(); + + scope provisioningData = initializeADI(configurationPath); + scope adi = provisioningData.adi; + scope akDevice = provisioningData.device; + + auto appleAccount = login(akDevice, adi); + + if (!appleAccount) { + return 1; + } + + auto teams = appleAccount.listTeams().unwrap(); + + string teamId = this.teamId; + if (teamId != null) { + teams = teams.filter!((elem) => elem.teamId == teamId).array(); + } + enforce(teams.length > 0, "No matching team found."); + + auto team = teams[0]; + + auto devices = appleAccount.deleteDevice!iOS(team, deviceId).unwrap(); + log.info("Success!"); + + return 0; + } +} + diff --git a/frontends/dlangui/dub.selections.json b/frontends/dlangui/dub.selections.json deleted file mode 120000 index 43e1d75..0000000 --- a/frontends/dlangui/dub.selections.json +++ /dev/null @@ -1 +0,0 @@ -../../dub.selections.json \ No newline at end of file diff --git a/frontends/dlangui/dub.selections.json b/frontends/dlangui/dub.selections.json new file mode 100644 index 0000000..a816e87 --- /dev/null +++ b/frontends/dlangui/dub.selections.json @@ -0,0 +1,47 @@ +{ + "fileVersion": 1, + "versions": { + "argparse": "1.3.0", + "arsd-official": "10.9.10", + "automem": "0.6.9", + "bindbc-freetype": "1.0.5", + "bindbc-loader": "1.0.3", + "bindbc-opengl": "1.0.5", + "bindbc-sdl": "1.0.1", + "botan": "1.13.6", + "botan-math": "1.0.4", + "cachetools": "0.4.1", + "concepts": "0.0.9", + "concurrency": "5.0.4", + "dfl": {"version":"224d9348286620c8ea4854690a09e7380d6f5b2f","repository":"git+https://github.com/Dadoum/dfl.git"}, + "dlangui": "0.10.4", + "dqt": {"version":"6a44b55f3a3691da930cb9eefe2a745afe1b764d","repository":"git+https://github.com/tim-dlang/dqt.git"}, + "dsfml": "2.1.1", + "dxml": "0.4.4", + "dynamic-loader": {"version":"65a8b8b8a6d44d47e63bddc985268592ecf47764","repository":"git+https://github.com/Dadoum/dynamicloader.git"}, + "glx-d": "1.1.0", + "gtk_d": "1.0.3", + "icontheme": "1.2.3", + "ikod-containers": "0.0.22", + "inilike": "1.2.2", + "intel-intrinsics": "1.11.15", + "isfreedesktop": "0.1.1", + "keyring": {"path":"../../keyring/"}, + "memutils": "1.0.10", + "mir-core": "1.6.0", + "plist": "~master", + "plist-d": {"version":"30d152e88767611e10048b25777ecb5f9075f87c","repository":"git+https://github.com/Dadoum/libplist-d.git"}, + "progress": "5.0.2", + "provision": {"version":"533dca306b86f9c7801354b78f5187addb58b740","repository":"git+https://github.com/Dadoum/Provision.git"}, + "requests": "2.1.2", + "sideloader": {"path":"../../"}, + "silly": "1.2.0-dev.2", + "slf4d": "2.4.3", + "test_allocator": "0.3.4", + "undead": "1.1.8", + "unit-threaded": "0.10.8", + "windows-headers": "1.0.5", + "x11": "1.0.21", + "xdgpaths": "0.2.5" + } +} diff --git a/frontends/gtk/dub.selections.json b/frontends/gtk/dub.selections.json deleted file mode 120000 index 43e1d75..0000000 --- a/frontends/gtk/dub.selections.json +++ /dev/null @@ -1 +0,0 @@ -../../dub.selections.json \ No newline at end of file diff --git a/frontends/gtk/dub.selections.json b/frontends/gtk/dub.selections.json new file mode 100644 index 0000000..a816e87 --- /dev/null +++ b/frontends/gtk/dub.selections.json @@ -0,0 +1,47 @@ +{ + "fileVersion": 1, + "versions": { + "argparse": "1.3.0", + "arsd-official": "10.9.10", + "automem": "0.6.9", + "bindbc-freetype": "1.0.5", + "bindbc-loader": "1.0.3", + "bindbc-opengl": "1.0.5", + "bindbc-sdl": "1.0.1", + "botan": "1.13.6", + "botan-math": "1.0.4", + "cachetools": "0.4.1", + "concepts": "0.0.9", + "concurrency": "5.0.4", + "dfl": {"version":"224d9348286620c8ea4854690a09e7380d6f5b2f","repository":"git+https://github.com/Dadoum/dfl.git"}, + "dlangui": "0.10.4", + "dqt": {"version":"6a44b55f3a3691da930cb9eefe2a745afe1b764d","repository":"git+https://github.com/tim-dlang/dqt.git"}, + "dsfml": "2.1.1", + "dxml": "0.4.4", + "dynamic-loader": {"version":"65a8b8b8a6d44d47e63bddc985268592ecf47764","repository":"git+https://github.com/Dadoum/dynamicloader.git"}, + "glx-d": "1.1.0", + "gtk_d": "1.0.3", + "icontheme": "1.2.3", + "ikod-containers": "0.0.22", + "inilike": "1.2.2", + "intel-intrinsics": "1.11.15", + "isfreedesktop": "0.1.1", + "keyring": {"path":"../../keyring/"}, + "memutils": "1.0.10", + "mir-core": "1.6.0", + "plist": "~master", + "plist-d": {"version":"30d152e88767611e10048b25777ecb5f9075f87c","repository":"git+https://github.com/Dadoum/libplist-d.git"}, + "progress": "5.0.2", + "provision": {"version":"533dca306b86f9c7801354b78f5187addb58b740","repository":"git+https://github.com/Dadoum/Provision.git"}, + "requests": "2.1.2", + "sideloader": {"path":"../../"}, + "silly": "1.2.0-dev.2", + "slf4d": "2.4.3", + "test_allocator": "0.3.4", + "undead": "1.1.8", + "unit-threaded": "0.10.8", + "windows-headers": "1.0.5", + "x11": "1.0.21", + "xdgpaths": "0.2.5" + } +} diff --git a/frontends/qt/dub.selections.json b/frontends/qt/dub.selections.json deleted file mode 120000 index 43e1d75..0000000 --- a/frontends/qt/dub.selections.json +++ /dev/null @@ -1 +0,0 @@ -../../dub.selections.json \ No newline at end of file diff --git a/frontends/qt/dub.selections.json b/frontends/qt/dub.selections.json new file mode 100644 index 0000000..a816e87 --- /dev/null +++ b/frontends/qt/dub.selections.json @@ -0,0 +1,47 @@ +{ + "fileVersion": 1, + "versions": { + "argparse": "1.3.0", + "arsd-official": "10.9.10", + "automem": "0.6.9", + "bindbc-freetype": "1.0.5", + "bindbc-loader": "1.0.3", + "bindbc-opengl": "1.0.5", + "bindbc-sdl": "1.0.1", + "botan": "1.13.6", + "botan-math": "1.0.4", + "cachetools": "0.4.1", + "concepts": "0.0.9", + "concurrency": "5.0.4", + "dfl": {"version":"224d9348286620c8ea4854690a09e7380d6f5b2f","repository":"git+https://github.com/Dadoum/dfl.git"}, + "dlangui": "0.10.4", + "dqt": {"version":"6a44b55f3a3691da930cb9eefe2a745afe1b764d","repository":"git+https://github.com/tim-dlang/dqt.git"}, + "dsfml": "2.1.1", + "dxml": "0.4.4", + "dynamic-loader": {"version":"65a8b8b8a6d44d47e63bddc985268592ecf47764","repository":"git+https://github.com/Dadoum/dynamicloader.git"}, + "glx-d": "1.1.0", + "gtk_d": "1.0.3", + "icontheme": "1.2.3", + "ikod-containers": "0.0.22", + "inilike": "1.2.2", + "intel-intrinsics": "1.11.15", + "isfreedesktop": "0.1.1", + "keyring": {"path":"../../keyring/"}, + "memutils": "1.0.10", + "mir-core": "1.6.0", + "plist": "~master", + "plist-d": {"version":"30d152e88767611e10048b25777ecb5f9075f87c","repository":"git+https://github.com/Dadoum/libplist-d.git"}, + "progress": "5.0.2", + "provision": {"version":"533dca306b86f9c7801354b78f5187addb58b740","repository":"git+https://github.com/Dadoum/Provision.git"}, + "requests": "2.1.2", + "sideloader": {"path":"../../"}, + "silly": "1.2.0-dev.2", + "slf4d": "2.4.3", + "test_allocator": "0.3.4", + "undead": "1.1.8", + "unit-threaded": "0.10.8", + "windows-headers": "1.0.5", + "x11": "1.0.21", + "xdgpaths": "0.2.5" + } +} diff --git a/frontends/swiftui/dub.selections.json b/frontends/swiftui/dub.selections.json deleted file mode 120000 index 43e1d75..0000000 --- a/frontends/swiftui/dub.selections.json +++ /dev/null @@ -1 +0,0 @@ -../../dub.selections.json \ No newline at end of file diff --git a/frontends/swiftui/dub.selections.json b/frontends/swiftui/dub.selections.json new file mode 100644 index 0000000..a816e87 --- /dev/null +++ b/frontends/swiftui/dub.selections.json @@ -0,0 +1,47 @@ +{ + "fileVersion": 1, + "versions": { + "argparse": "1.3.0", + "arsd-official": "10.9.10", + "automem": "0.6.9", + "bindbc-freetype": "1.0.5", + "bindbc-loader": "1.0.3", + "bindbc-opengl": "1.0.5", + "bindbc-sdl": "1.0.1", + "botan": "1.13.6", + "botan-math": "1.0.4", + "cachetools": "0.4.1", + "concepts": "0.0.9", + "concurrency": "5.0.4", + "dfl": {"version":"224d9348286620c8ea4854690a09e7380d6f5b2f","repository":"git+https://github.com/Dadoum/dfl.git"}, + "dlangui": "0.10.4", + "dqt": {"version":"6a44b55f3a3691da930cb9eefe2a745afe1b764d","repository":"git+https://github.com/tim-dlang/dqt.git"}, + "dsfml": "2.1.1", + "dxml": "0.4.4", + "dynamic-loader": {"version":"65a8b8b8a6d44d47e63bddc985268592ecf47764","repository":"git+https://github.com/Dadoum/dynamicloader.git"}, + "glx-d": "1.1.0", + "gtk_d": "1.0.3", + "icontheme": "1.2.3", + "ikod-containers": "0.0.22", + "inilike": "1.2.2", + "intel-intrinsics": "1.11.15", + "isfreedesktop": "0.1.1", + "keyring": {"path":"../../keyring/"}, + "memutils": "1.0.10", + "mir-core": "1.6.0", + "plist": "~master", + "plist-d": {"version":"30d152e88767611e10048b25777ecb5f9075f87c","repository":"git+https://github.com/Dadoum/libplist-d.git"}, + "progress": "5.0.2", + "provision": {"version":"533dca306b86f9c7801354b78f5187addb58b740","repository":"git+https://github.com/Dadoum/Provision.git"}, + "requests": "2.1.2", + "sideloader": {"path":"../../"}, + "silly": "1.2.0-dev.2", + "slf4d": "2.4.3", + "test_allocator": "0.3.4", + "undead": "1.1.8", + "unit-threaded": "0.10.8", + "windows-headers": "1.0.5", + "x11": "1.0.21", + "xdgpaths": "0.2.5" + } +} diff --git a/source/server/appleaccount.d b/source/server/appleaccount.d index 4059838..0efe460 100644 --- a/source/server/appleaccount.d +++ b/source/server/appleaccount.d @@ -414,8 +414,8 @@ package class AppleAccount { string identityToken = Base64.encode(cast(ubyte[]) (adsid ~ ":" ~ idmsToken)); return nextStepHandler(identityToken, urls, secondaryActionKey, canIgnore).match!( (AppleLoginError error) => AppleLoginResponse(error), - (ReloginNeeded _) => completeAuthentication(), - (Success _) => login(applicationInformation, device, adi, appleId, password, nextStepHandler), + (ReloginNeeded _) => login(applicationInformation, device, adi, appleId, password, nextStepHandler), + (Success _) => completeAuthentication(), ); case 433: /+ anisetteReprovisionRequired +/ log.errorF!"Server requested Anisette reprovision that has not been implemented yet! Here is some debug info: %s"(response2Str);