简体   繁体   English

setup.icloud.com两步验证

[英]setup.icloud.com two-step verification

I'm playing around with iLoot , an open source app that let's you download iCloud backups and I was wondering how it is possible to implement the two factor authentication to it. 我正在玩iLoot ,这是一个开源应用程序,让你下载iCloud备份,我想知道如何实现双因素身份验证。

I have 2fa enabled on my account and what I get on the first request is this: 我的帐户启用了2fa,第一次请求的内容是:

First request: 第一个要求:

        auth = "Basic %s" % base64.b64encode("%s:%s" % (login, password))
authenticateResponse = plist_request("setup.icloud.com", "POST", "/setup/authenticate/$APPLE_ID$", "", {"Authorization": auth})

plist_request is just a normal python ( request ) function that request from the url and returns the parsed xml. plist_request只是一个普通的python( 请求 )函数,它从url请求并返回解析的xml。

First response (in xml format): 第一个响应(xml格式):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>protocolVersion</key>
    <string>2</string>

    <key>title</key>
    <string>Verification Required</string>

    <key>localizedError</key>
    <string>MOBILEME_TERMS_OF_SERVICE_UPDATE</string>

    <key>message</key>
    <string>This Apple ID is protected with two-step verification. To sign in, you must verify your identity.</string>

</dict>
</plist>
Request /setup/authenticate/$APPLE_ID$ returned code 409

In case anyone knows what the next call would be to input the two-step verification code, it could help to figure it out. 如果有人知道下一次调用将输入两步验证码的话,它可能有助于弄清楚。

I'm an iOS guy, not backend guy, but my backend team solved this on their side by using the app-specific password, instead of tokens. 我是iOS用户,而不是后端人员,但是我的后端团队通过使用应用程序专用密码而不是令牌来解决这个问题。

This is how user can generate an app-specific password: Generate App-Specific Password 这是用户可以生成应用专用密码的方式: 生成应用专用密码

Then simply use the email and this password, instead of the token formed by dsPrsID:mmeAuthToken. 然后只需使用电子邮件和此密码,而不是dsPrsID形成的令牌:mmeAuthToken。 As I learnt for my teammates, you don't have to do base64 encode, just use that new password, and the url:' https://caldav.icloud.com/ ' 正如我向队友学习的那样,你不需要做base64编码,只需使用新密码和网址:' https : //caldav.icloud.com/ '

Hope this helps. 希望这可以帮助。 It was a nightmare for us, no help at all on the internet. 这对我们来说是一场噩梦,在互联网上根本没有帮助。

UPDATE UPDATE

For more info, these are the steps I used on my side (iOS): 有关更多信息,这些是我在我身边使用的步骤(iOS):

  1. I call https://setup.icloud.com/setup/authenticate/ "email@email.com" , by setting "Basic email:password" as base64 string to "Authorization" http header field. 我打电话给https://setup.icloud.com/setup/authenticate/“email@email.com ,将“基本电子邮件:密码”设置为“授权”http头字段的base64字符串。

  2. I check response status code. 我检查响应状态代码。 If 401, it means the password you are sending is an app specific password, so then I send this password (and email) directly to my server, via our internal API, and they are using it to call iCloud APIs, and return me calendars, etc. 如果是401,则表示您发送的密码是应用程序专用密码,因此我通过内部API将此密码(和电子邮件)直接发送到我的服务器,然后他们使用它来调用iCloud API,并返回我的日历等

  3. If response status code is 409, it means that user tried to login with a normal password, but his account is enabled for 2fa, and I display an error, warning user to go and retrieve his app-specific-password, and use that one, which will lead to step 2, above. 如果响应状态代码为409,则表示用户尝试使用普通密码登录,但是他的帐户已启用2fa,我显示错误,警告用户去检索他的应用专用密码,并使用该密码,这将导致上面的第2步。

I am not saying this is the only way, but this worked for me. 我不是说这是唯一的方法,但这对我有用。 Also, I don't exactly know what's going on on server side, but they are using directly that app-specific-passwrod (and probably the email), to do the job. 此外,我并不完全知道服务器端发生了什么,但他们直接使用特定于应用程序的密码(也可能是电子邮件)来完成这项工作。

you have to replace $appliid$ with your appleid... then you get mmeAuthToken, dsPrsID 你必须用你的appleid替换$ appliid $ ...然后你得到mmeAuthToken,dsPrsID

https setup.icloud.com/setup/get_account_settings dsPrsID:mmeAuthToken as basic auth returns: mmeAuthToken (new/other one!!) https setup.icloud.com/setup/get_account_settings dsPrsID:mmeAuthToken作为基本auth返回:mmeAuthToken(new / other one !!)

the next request for the backup information didn't work for me... i am not that far right now... 下一个备份信息请求对我不起作用......我现在不是那么远了......

docs i've worked with before: 以前曾与我合作过的文档:

https://www.elcomsoft.com/PR/recon_2013.pdf https://deepsec.net/docs/Slides/2013/DeepSec_2013_Vladimir_Katalov_-_Cracking_And_Analyzing_Apple_iCloud_Protocols.pdf https://www.elcomsoft.com/PR/recon_2013.pdf https://deepsec.net/docs/Slides/2013/DeepSec_2013_Vladimir_Katalov_-_Cracking_And_Analyzing_Apple_iCloud_Protocols.pdf

Thanks for your post! 谢谢你的帖子! Brought me to iLoot. 带我去iLoot。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM