AltServer-Linux icon indicating copy to clipboard operation
AltServer-Linux copied to clipboard

Lighter Anisette server

Open Dadoum opened this issue 2 years ago • 14 comments

I was myself making an AltServer for Linux when I saw yours. Mine was incomplete but I managed to generate Anisette on Linux in a lighter and more efficient way than the way this AltServer does. It uses Apple Music libraries from the Android APK and generates in few seconds this output:

{
    "X-Apple-I-MD-M":"<80 bytes long base64 string>",
    "X-Apple-I-MD":"<40 bytes long base64 string>",
    "X-Apple-I-MD-RINFO":"8 digits integer",
    "X-Apple-I-MD-LU":"<64 bytes long hex string>",
    "X-Mme-Device-Id":"<40 bytes long hex string>",
}

Is it sufficient ? And how should work a server ?

link to my repo

Dadoum avatar Jun 19 '22 17:06 Dadoum

You can see the needed headers with this:

curl https://sideloadly.io/anisette/irGb3Quww8zrhgqnzmrx | jq

typically it has these:

{
  "X-Apple-I-Client-Time": "2022-06-22T12:48:11Z",
  "X-Apple-I-MD": "AAAABQAAABDnCI2aAjo8uE47dzNBsOfRAAAAAQ==",
  "X-Apple-I-MD-LU": "CE99147F8610526892ED1AC53931EF38552A2CB64C2DC433D242FDAE789A7F80",
  "X-Apple-I-MD-M": "wbxShQ1m2WmGT+Sf496k3tYfwQhrzQ+79dQKNUVBzpz/rO+4faO/k3ZjePXDCXk1jMefsXn7NllulZOH",
  "X-Apple-I-MD-RINFO": "17106176",
  "X-Apple-I-SRL-NO": "0",
  "X-Apple-I-TimeZone": "GMT+0",
  "X-Apple-Locale": "en_GB",
  "X-MMe-Client-Info": "<iMac11,3> <Mac OS X;10.15.6;19G2021> <com.apple.AuthKit/1 (com.apple.dt.Xcode/3594.4.19)>",
  "X-Mme-Device-Id": "F6C158F4-BD50-4EDD-B897-9BE4349EEED5"
}

NyaMisty avatar Jun 22 '22 12:06 NyaMisty

As for your provision header, I believe X-Apple-I-Client-Time X-Apple-I-TimeZone X-Apple-Locale can be simply filled. But X-MMe-Client-Info needs more consideration

NyaMisty avatar Jun 22 '22 12:06 NyaMisty

I added X-Mme-Client-Info, and I changed it to the one provided by the server you're using now. Since provisioning just needs to put the Client Info as a header (and actually does not use it to make the actual content of provisioning) it can be easily customized.

Dadoum avatar Jun 22 '22 13:06 Dadoum

We don't know if Apple actually uses it. Long time ago apple uses this to distinguish Xcode and Cydia Impactor. By the way, for all those other simple fields (Time & Locale headers) I still suggest you to provide it altogether, as AltServer currently still rely on them.

NyaMisty avatar Jun 22 '22 16:06 NyaMisty

X-Mme-Client-Info still needs to be present with a very specific format since Apple Provisioning server refuses anything which is not Windows or macOS, not using an official Apple app etc…

Anyway it now generates everything !

Dadoum avatar Jun 22 '22 17:06 Dadoum

I added an Anisette Server !

Dadoum avatar Jun 22 '22 18:06 Dadoum

Also, if you want you can modify the server to regenerate each time a new Anisette machine. But it can't be used for an Anisette server since there is a cooldown of few seconds each time you want to generate an ID. But maybe by trying regenerating every time Anisette, (and if it doesn't work just output the one we have) + randomizing the only things that matters for Anisette (Serial number + arc4random output), maybe we could make a better general Anisette server.

Dadoum avatar Jun 22 '22 20:06 Dadoum

I added GitHub Actions in my repo, you can now download anisette_server easily.

I can't get AltServer-Linux working on my computer, but I don't think it's related to this server. Can you please try it out?

Dadoum avatar Jul 09 '22 20:07 Dadoum

Ok it was related to the server, I made a dumb mistake, now it works !

Dadoum avatar Jul 10 '22 20:07 Dadoum

That's brilliant. Would you mind make a small README for me so that I can add it into this repo?

NyaMisty avatar Jul 11 '22 05:07 NyaMisty

Something like this ?

## Troubleshooting

> I get `Unable to sign you in to your Apple ID. Try again later. (-36607)` when I try to install an app

This is related to the public Anisette server. To fix this error, download [the latest version of anisette-server from this link](https://github.com/Dadoum/Provision/actions), and setup it accordingly to the README there (get the Apple Music APK, and extract from it the lib/ folder and place it next to anisette_server executable).

Then launch AltServer-Linux with `ALTSERVER_ANISETTE_SERVER=http://127.0.0.1:6969` environment variable (write this in the beginning of the command line before writing ./AltServer-x86_64).

Preview:

Troubleshooting

I get Unable to sign you in to your Apple ID. Try again later. (-36607) when I try to install an app

This is related to the public Anisette server. To fix this error, download the latest version of anisette-server from this link, and setup it accordingly to the README there (get the Apple Music APK, and extract from it the lib/ folder and place it next to anisette_server executable).

Then launch AltServer-Linux with ALTSERVER_ANISETTE_SERVER=http://127.0.0.1:6969 environment variable (write this in the beginning of the command line before writing ./AltServer-x86_64).

Dadoum avatar Jul 11 '22 11:07 Dadoum

Should I change anything in this readme ?

Dadoum avatar Jul 26 '22 19:07 Dadoum

@Dadoum Any way you could make the steps more convenient? Finding a specific APK online and extracting it is a bit weird, especially when you could do it automatically since Apple distributes the apk themselves at https://www.apple.com/lae/apple-music/android-download/ (with Android user agent goes to this direct link) https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk Especially if this was a single line solution someone could copy paste, or even integrated into AltServer-Linux, it would be a lot more user-friendly.

j5155 avatar Oct 01 '22 02:10 j5155

@Dadoum Any way you could make the steps more convenient? Finding a specific APK online and extracting it is a bit weird, especially when you could do it automatically since Apple distributes the apk themselves at https://www.apple.com/lae/apple-music/android-download/ (with Android user agent goes to this direct link) https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk Especially if this was a single line solution someone could copy paste, or even integrated into AltServer-Linux, it would be a lot more user-friendly.

The only issue of automatic APK download is that I don't want to download a big file without user consent. I could make a CLI prompt for it, but to address the whole user-friendlyness problem, I am currently remaking a full AltServer implementation on Linux (with headless and GUI) but I don't have much time these days to finish it soon. [^1]

Hence why I opened this issue. I wanted the APK downloading and everything else to be implemented in AltServer (also because currently, anisette_server is not compatible with 32 bits machines because of one of the dependencies I use, and that if it was integrated deeper in AltServer it could have called directly the right executables).

[^1]: EDIT: I made it, https://github.com/Dadoum/Sideloader

Dadoum avatar Oct 01 '22 11:10 Dadoum