总体流程:登录(注册设备)::拿到返回信息
------》》》购买:生成订单
------》》》下载:download
******ps:购买下载顺序不可逆(登录获得信息可重复使用,无须再登录)
解决思路:从httprequest,webrequest,以及各包名的特点,mas.client.比较靠谱
******************************login*****************************
com.amazon.mas.client.account.summary.AccountSummaryService.onHandleIntent(AccountSummaryService.java:70)
com.amazon.mas.client.account.summary.AccountSummaryProviderImpl.prepareAccountSummary(AccountSummaryProviderImpl.java:343)
com.amazon.mas.client.account.summary.AccountSummaryProviderImpl.prepareAccount(AccountSummaryProviderImpl.java:326)
com.amazon.mas.client.authentication.usernamepassword.DeviceServiceUPAuthenticator.prepareAccount(DeviceServiceUPAuthenticator.java:174)
com.amazon.mas.client.authentication.usernamepassword.RegisterDeviceClient.call(RegisterDeviceClient.java:151)
com.amazon.mas.client.authentication.usernamepassword.RegisterDeviceClient.toWebRequest(RegisterDeviceClient.java:192)
com.amazon.mas.client.http.WebRequest.fromJSON(WebRequest.java:233)
此处可以打印出注册设备所发送的信息,post即可,没有太多参数headers
{"password":"123456","deviceType":"A3GFS040JDOGQR","deviceInfo":{"android.hardware.faketouch.multitouch.jazzhand":"true","deviceDisplayPixelsHeight":"960","networkType":"WIFI","android.hardware.location":"true","android.hardware.screen.landscape":"true","android.hardware.screen.portrait":"true","deviceDensityClassification":"240","deviceDensityScaled":"1.5","isPreloadedUpdate":"false","android.hardware.touchscreen.multitouch.distinct":"true","android.hardware.bluetooth":"true","android.hardware.microphone":"true","carrier":"CMCC","android.hardware.camera.autofocus":"true","android.software.live_wallpaper":"true","openGlEsVersion":"0x00010000","deviceScreenLayout":"SCREENLAYOUT_SIZE_NORMAL","deviceDisplayXDpi":"152.4","display":"U9200-1V100R001CHNC00B109","APILevel":"15","android.hardware.faketouch":"true","android.hardware.camera":"true","deviceDensityLogical":"1.5","manufacturer":"HUAWEI","android.hardware.sensor.proximity":"true","isRooted":"true","cpuABI":"armeabi-v7a","android.hardware.wifi":"true","android.hardware.location.network":"true","model":"U9200","android.hardware.sensor.gyroscope":"true","openGlEsExtensions":"GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_IMG_read_format GL_IMG_texture_compression_pvrtc GL_IMG_texture_format_BGRA8888 GL_IMG_vertex_array_object GL_OES_EGL_p_w_picpath GL_OES_EGL_p_w_picpath_external GL_OES_blend_equation_separate GL_OES_blend_func_separate GL_OES_blend_subtract GL_OES_byte_coordinates GL_OES_compressed_ETC1_RGB8_texture GL_OES_compressed_paletted_texture GL_OES_depth24 GL_OES_draw_texture GL_OES_egl_sync GL_OES_extended_matrix_palette GL_OES_fixed_point GL_OES_framebuffer_object GL_OES_mapbuffer GL_OES_matrix_get GL_OES_matrix_palette GL_OES_point_size_array GL_OES_point_sprite GL_OES_query_matrix GL_OES_read_format GL_OES_required_internalformat GL_OES_rgb8_rgba8 GL_OES_single_precision GL_OES_stencil8 GL_OES_stencil_wrap GL_OES_texture_cube_map GL_OES_texture_env_crossbar GL_OES_texture_mirrored_repeat","android.hardware.wifi.direct":"true","android.hardware.usb.accessory":"true","deviceType":"A3GFS040JDOGQR","android.hardware.sensor.light":"true","deviceNavigation":"NAVIGATION_NONAV","releaseVersion":"4.0.3","deviceDisplayPixelsWidth":"540","deviceDisplayYDpi":"451.55554","android.hardware.camera.flash":"true","sharedLibraries":"android.media.audiofx.dolbymobileaudioeffect android.media.dolby android.test.runner com.android.future.usb.accessory com.android.location.provider com.broadcom.bt.le com.google.widevine.software.drm com.huawei.hwextcamera com.ti.s3d fmradioif javax.obex","android.hardware.telephony":"true","deviceTouchscreen":"TOUCHSCREEN_FINGER","android.hardware.faketouch.multitouch.distinct":"true","android.hardware.touchscreen.multitouch.jazzhand":"true","android.hardware.touchscreen.multitouch":"true","android.hardware.sensor.compass":"true","deviceKeyboard":"KEYBOARD_NOKEYS","ref":"unknown","lastKnownLocation":"unknown","brand":"Huawei","isPreloaded":"false","android.hardware.location.gps":"true","android.hardware.telephony.gsm":"true","isEmulator":"false","android.hardware.camera.front":"true","android.hardware.touchscreen":"true","android.hardware.sensor.accelerometer":"true"},"userId":"RyanJFulmer@teleworm.us"}
*******注册设备返回信息,要多次用到*******
com.amazon.mas.client.account.summary.AccountSummaryService.onHandleIntent(AccountSummaryService.java:70)
com.amazon.mas.client.account.summary.AccountSummaryProviderImpl.prepareAccountSummary(AccountSummaryProviderImpl.java:343)
com.amazon.mas.client.account.summary.AccountSummaryProviderImpl.prepareAccount(AccountSummaryProviderImpl.java:326)
com.amazon.mas.client.authentication.usernamepassword.DeviceServiceUPAuthenticator.prepareAccount(DeviceServiceUPAuthenticator.java:174)
com.amazon.mas.client.authentication.usernamepassword.RegisterDeviceClient.call(RegisterDeviceClient.java:155)
com.amazon.mas.client.authentication.usernamepassword.RegisterDeviceClient.toRegisterDeviceResponse(RegisterDeviceClient.java:224)
com.amazon.mas.client.http.WebResponse.getEntityBody(WebResponse.java:53)
*********************************purchase and downloadurl************************************************************************
com.amazon.mas.client.purchaseservice.PurchaseService.onHandleIntent(PurchaseService.java:60)
com.amazon.mas.client.purchaseservice.PurchaseService.handlePurchaseRequest(PurchaseService.java:90)
com.amazon.mas.client.deviceservice.BasicMasDsClient.invoke(BasicMasDsClient.java:167)
com.amazon.mas.client.deviceservice.BasicMasDsClient.setDefaults(BasicMasDsClient.java:231)
参数:{"headers":{"Accept-Language":"zh-CN","x-venezia-pfm":"AAHKV2X7AFYLW","X-ADP-Request-Digest":"X6YD\/6Y4AIN0Jy90NMLemekeIJd31OCkGGkfz33drtsacPfIRIRRBWMUVbC4UZw\/ZIf07cuF3pRbJpQkpe5hHQf\/ZDIIrfMhnt1vFgYV0lZ9S9Pc3FsmG8PHYcEr0u9b2IondWujprGgi4bRG4yqmBmQoTn9uVLFiLIySiDa6Es41mxzOgGfM8aDWPtguM415YqsCutgE8LpkO\/+DFXMtHIye1mziKs+\/v9mhgd7SlggVk0C4CqBgn2LHJ5ClbB+9AvkjQKI\/83khQ4n7e8FH92UxN011e\/+JRTFQ9cx\/BPSN0DrXm5B7pggvIHyev7Mb6TweVdQnQDQskWYf3jGrw==:2013-07-10T03:33:07","User-Agent":"VeneziaAndroid\/release-5.0010","x-venezia-cor":"CN","X-ADP-Authentication-Token":"{enc:8V\/o\/acXVlYPsVI0iueKSAnxjef46pklvg76HbWS+b9gr+qhW08b3gZ0Lkb3\/A6vlSVnIE2NY+vxIKZ\/9RWf47Upq8qoeBXOi\/JkutHYe5\/Fl5QRHvfoGSwMxg+T6xGQuvcevhkKY3u8lPxGfvsNk5nMDIcptyphHyw\/juThIgrkFbSc14u77hQUTM2s9MKmnuBzlPuYnyDmLbJgOLoLFGaz1ejK6\/ILfdicFPlGC5PJ5qSpPMWtUjZq1SJCBctAa2WksrXRcqtnhchEtDa9yZc1\/zGeDzwhQwIUqxopcqizyP+pqZOu++ILDYZg1JL8KVVt7x9x7EMpNKbE32p3uDEvASFbVN7QV1qyAJ7mHv86x5eNWbN622x0Dogy56oB4+XFCZR8n+mFQMoxPFGaGiVYN7xEbUwmclAS6PDRt2WmwjjHOBby+cGNuze7m23SkNsKfBSHNk+U1rfM88f5A3TtB2xMLltMNbBU13f1L3M0sQ1Q+W1dfDdjldU63ZFUywXOJGEecccmccQ5tPybYtPF8R9UC5Psa\/REhar9oD5PEh7\/ytMWAzSMs5LB55MSzXuRDHd7SlM9KW82J1uhAg0wi8gbi\/vAOzNcQb35HEL9PLiRzZ2ulc+\/X1EewPQRGWRT5u\/NeMGQlVFlGt56Pc3MTpBxC9Z+2IiY0fnRSLn+m3Iyi3\/mabRe0LNwGY+58hz4ktjPWPSSwJFffVNzvRvsPOsiEzArONOBMdJlRN8I1eShOnW\/gBoEfG8Z+ZrxMFebOHqXsGIvrUccVP03nhjc4kF1mj\/TOe3A0EwM9sGDv\/YqLBr59h6tIkz3rSPTS4DfXpYK8ZiINcH2CJ9lOq7fHOmxXZaW8qcZV9DYYSMuVhS4aQvhyDckAwwkUQAndRQCfeMDleGIs+469y9UBkyJXFc9YUEdX0Ult92vGkNEn7dhy1fjN+jSHAYLtUeauHfWlCs6Yxku8ULdPNLb5L\/FlLiaFeKVSVJzhRwi9\/pZQuYRmGCnTTmBFZYjfrW835WKqozyZIwGc9yZfNDVf9UEi56bqEHWcF8mOic0ixE=}{key:l6R6oQZtK7NjtS4M9Mq8C6aWE957fcPDUyRErMz6FfOkxyu7j7\/3xuvxnn\/1n33R+JWyw+pK2MjP+p39ruj4gNKSOSeIQEaniCTrjHN4Ae+HvPu99ECufY\/ADr1p68QcLb4514O0kmtQ0gwLqRdWmmU\/R9PQA8a\/EfXJNEuTG6Ux7njLNxG4QBTthyYASj4LmVK7j6fKD+kFae6S1T62HvRLkihr6caA8cZYwD7XK4JwF2F6l3xJ7ZupD7D5WR\/GKYoA6ab4Q0MSd5SrHr3hSnn31SxBvMB9Chg0v3M30zbuA\/+anHi8k6h6dYXxwVae0RydWeaulNDb6yXjH2LKtA==}{iv:YSdOBrvf1dekbKVK1vSjZA==}{name:QURQVG9rZW5FbmNyeXB0aW9uS2V5}{serial:Mg==}"},"retries":0,"body":{"zeroesPaymentActive":false,"currentVersion":"3","asin":"B0092KDEGG","currentPrice":{"amount":"0.00","unit":"CNY"}},"method":"POST","backoff":[50,150,2000],"timeout":30000,"endpoint":"https:\/\/mas-ext-cn.amazon.cn\/purchaseItem"}
此处设定各种数值,被调用的接口从中取得相应数据。(devicekey ,token 登录时获得,Digest用用几种参数生成,)
POST:
com.amazon.mas.client.purchaseservice.PurchaseService.onHandleIntent(PurchaseService.java:60)
com.amazon.mas.client.purchaseservice.PurchaseService.handlePurchaseRequest(PurchaseService.java:90)
com.amazon.mas.client.deviceservice.BasicMasDsClient.invoke(BasicMasDsClient.java:168)
com.amazon.mas.client.http.BasicHttpClient.invoke(BasicHttpClient.java:215)
------>setHeaders
***Accept-Language:zh-CN
***x-venezia-pf:mAAHKV2X7AFYLW
******X-ADP-Request-Digest;X6YD/6Y4AIN0Jy90NMLemekeIJd31OCkGGkfz33drtsacPfIRIRRBWMUVbC4UZw/ZIf07cuF3pRbJpQkpe5hHQf/ZDIIrfMhnt1vFgYV0lZ9S9Pc3FsmG8PHYcEr0u9b2IondWujprGgi4bRG4yqmBmQoTn9uVLFiLIySiDa6Es41mxzOgGfM8aDWPtguM415YqsCutgE8LpkO/+DFXMtHIye1mziKs+/v9mhgd7SlggVk0C4CqBgn2LHJ5ClbB+9AvkjQKI/83khQ4n7e8FH92UxN011e/+JRTFQ9cx/BPSN0DrXm5B7pggvIHyev7Mb6TweVdQnQDQskWYf3jGrw==:2013-07-10T03:33:07
***User-Agent:VeneziaAndroid/release-5.0010
***x-venezia-cor:CN
***X-ADP-Authentication-Token:{enc:8V/o/acXVlYPsVI0iueKSAnxjef46pklvg76HbWS+b9gr+qhW08b3gZ0Lkb3/A6vlSVnIE2NY+vxIKZ/9RWf47Upq8qoeBXOi/JkutHYe5/Fl5QRHvfoGSwMxg+T6xGQuvcevhkKY3u8lPxGfvsNk5nMDIcptyphHyw/juThIgrkFbSc14u77hQUTM2s9MKmnuBzlPuYnyDmLbJgOLoLFGaz1ejK6/ILfdicFPlGC5PJ5qSpPMWtUjZq1SJCBctAa2WksrXRcqtnhchEtDa9yZc1/zGeDzwhQwIUqxopcqizyP+pqZOu++ILDYZg1JL8KVVt7x9x7EMpNKbE32p3uDEvASFbVN7QV1qyAJ7mHv86x5eNWbN622x0Dogy56oB4+XFCZR8n+mFQMoxPFGaGiVYN7xEbUwmclAS6PDRt2WmwjjHOBby+cGNuze7m23SkNsKfBSHNk+U1rfM88f5A3TtB2xMLltMNbBU13f1L3M0sQ1Q+W1dfDdjldU63ZFUywXOJGEecccmccQ5tPybYtPF8R9UC5Psa/REhar9oD5PEh7/ytMWAzSMs5LB55MSzXuRDHd7SlM9KW82J1uhAg0wi8gbi/vAOzNcQb35HEL9PLiRzZ2ulc+/X1EewPQRGWRT5u/NeMGQlVFlGt56Pc3MTpBxC9Z+2IiY0fnRSLn+m3Iyi3/mabRe0LNwGY+58hz4ktjPWPSSwJFffVNzvRvsPOsiEzArONOBMdJlRN8I1eShOnW/gBoEfG8Z+ZrxMFebOHqXsGIvrUccVP03nhjc4kF1mj/TOe3A0EwM9sGDv/YqLBr59h6tIkz3rSPTS4DfXpYK8ZiINcH2CJ9lOq7fHOmxXZaW8qcZV9DYYSMuVhS4aQvhyDckAwwkUQAndRQCfeMDleGIs+469y9UBkyJXFc9YUEdX0Ult92vGkNEn7dhy1fjN+jSHAYLtUeauHfWlCs6Yxku8ULdPNLb5L/FlLiaFeKVSVJzhRwi9/pZQuYRmGCnTTmBFZYjfrW835WKqozyZIwGc9yZfNDVf9UEi56bqEHWcF8mOic0ixE=}{key:l6R6oQZtK7NjtS4M9Mq8C6aWE957fcPDUyRErMz6FfOkxyu7j7/3xuvxnn/1n33R+JWyw+pK2MjP+p39ruj4gNKSOSeIQEaniCTrjHN4Ae+HvPu99ECufY/ADr1p68QcLb4514O0kmtQ0gwLqRdWmmU/R9PQA8a/EfXJNEuTG6Ux7njLNxG4QBTthyYASj4LmVK7j6fKD+kFae6S1T62HvRLkihr6caA8cZYwD7XK4JwF2F6l3xJ7ZupD7D5WR/GKYoA6ab4Q0MSd5SrHr3hSnn31SxBvMB9Chg0v3M30zbuA/+anHi8k6h6dYXxwVae0RydWeaulNDb6yXjH2LKtA==}{iv:YSdOBrvf1dekbKVK1vSjZA==}{name:QURQVG9rZW5FbmNyeXB0aW9uS2V5}{serial:Mg==}
header设定OK,实际POST ,DATA
com.amazon.mas.client.purchaseservice.PurchaseService.onHandleIntent(PurchaseService.java:60)
com.amazon.mas.client.purchaseservice.PurchaseService.handlePurchaseRequest(PurchaseService.java:90)
com.amazon.mas.client.deviceservice.BasicMasDsClient.invoke(BasicMasDsClient.java:168)
com.amazon.mas.client.http.BasicHttpClient.invoke(BasicHttpClient.java:215)
com.amazon.mas.client.http.WebRequest.fromJSON(WebRequest.java:233)
------->打印出method,url,data
******POST
******https://mas-ext-cn.amazon.cn/purchaseItem
******{"zeroesPaymentActive":false,"currentVersion":"3","asin":"B0092KDEGG","currentPrice":{"amount":"0.00","unit":"CNY"}}
*******[50, 150, 2000]
*************************************有用的URL**********************
downloadurl = 'https://mas-ext-cn.amazon.cn/getDownloadUrl'
purchaseurl = 'https://mas-ext-cn.amazon.cn/purchaseItem'
updateurl = 'https://mas-ext-cn.amazon.cn/updateEntitlementState' //以更新的名义拿到apk最新,的部分信息,包名,icon,version,name等
appstoreurl = 'https://mas-ext-cn.amazon.cn/gp/masclient/appstore'
at com.amazon.mas.client.search.SearchComponent$5.onReceive(SearchComponent.java:442) 此处可以打印出大部分请求的URL,,所有分类,单个详情页的等
********************************************************************
****************Digest 生成getRequestDigest*************************
逻辑流程:SignatureBuilder().withDeviceToken(deviceToken).withPrivateKey(DeviceKey).withBody(body).withHttpVerb(method).withURI(URI.create(endpoint).withCurrentTime().createSignature()
参数:devickey,deviceToken,body,URI,都在大的json串里,method默认POST
作用:用来进行验证,这些参数都作为header post过去,服务器重新加密后比较,相等则通过
b = this.createHash();
[t = this.httpVerb+"\n"+this.fullPath+"\n"+this.timestamp+"\n"
if (this.body != null) t = t + this.body + "\n"
t = t + this.deviceToken
t = getInstance("SHA-256").digest
return t]
s = this.encryptAndEncodeSignature(b,this.privateKey);
getInstance("RSA/ECB/PKCS1Padding");Base64.encodeBytes;
r = s+":"+this.timestamp
return r
********************************************************************
*********************中美不同版本***********************************
下载处理方式一样,就是URL站点不一样,英文版的site为 mas-ext.amazon.com
英文版需要美国IP登录才能购买,从而下载。此处使用代理服务器
注册需要美国address,生成
********************************************************************