Device data into separate file + better debug log

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
Domenico Iezzi 2017-09-16 19:12:06 +02:00
parent 9d29d9971a
commit 8d39d03304
3 changed files with 121 additions and 99 deletions

144
config.py
View File

@ -1,5 +1,7 @@
import googleplay_pb2
import time
import os
import configparser
# separator used by search.py, categories.py, ...
SEPARATOR = ";"
@ -7,79 +9,79 @@ SEPARATOR = ";"
LANG = "en_US"
GOOGLE_PUBKEY = "AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ=="
# All the following data is taken from play-store-api
# https://github.com/yeriomin/play-store-api/blob/master/src/main/resources/device-bacon.properties
# The device used as a reference is a OnePlus One (bacon)
config = configparser.ConfigParser()
filepath = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'device.properties')
print(filepath)
config.read(filepath)
device = {}
for (key, value) in config.items('angler'):
device[key] = value
LIB_LIST = "com.qualcomm.qcnvitems,com.android.location.provider,com.android.future.usb.accessory,android.ext.shared,javax.obex,android.ext.services,com.dsi.ant.antradio_library,com.qualcomm.qcrilhook,android.test.runner,org.apache.http.legacy,com.android.nfc_extras,com.android.media.remotedisplay,com.android.mediadrm.signer"
FEATURE_LIST = "android.hardware.sensor.proximity,android.hardware.sensor.accelerometer,android.hardware.faketouch,org.cyanogenmod.appsuggest,android.hardware.usb.accessory,android.hardware.telephony.cdma,android.software.backup,android.hardware.touchscreen,android.hardware.touchscreen.multitouch,android.software.print,android.hardware.consumerir,org.cyanogenmod.partner,org.cyanogenmod.telephony,android.software.voice_recognizers,android.hardware.fingerprint,android.hardware.sensor.gyroscope"
",android.hardware.audio.low_latency,android.hardware.opengles.aep,android.hardware.bluetooth,android.hardware.camera.autofocus,com.google.android.feature.GOOGLE_BUILD,android.hardware.telephony.gsm,android.software.sip.voip,org.cyanogenmod.profiles,android.hardware.usb.host,com.cyanogenmod.android,android.hardware.audio.output,android.hardware.camera.flash,android.hardware.camera.front,android.hardware.sensor.hifi_sensors,android.hardware.screen.portrait,android.hardware.nfc"
",com.nxp.mifare,android.hardware.sensor.stepdetector,org.cyanogenmod.audio,org.cyanogenmod.theme,android.software.home_screen,android.hardware.microphone,org.cyanogenmod.statusbar,android.hardware.bluetooth_le,android.hardware.sensor.compass,android.hardware.touchscreen.multitouch.jazzhand,android.hardware.sensor.barometer,android.software.app_widgets,android.software.input_methods,android.hardware.sensor.light,android.software.device_admin,android.hardware.camera"
",org.cyanogenmod.hardware,android.hardware.screen.landscape,org.cyanogenmod.weather,org.cyanogenmod.performance,android.software.managed_users,android.software.webview,android.hardware.sensor.stepcounter,android.hardware.camera.capability.manual_post_processing,org.cyanogenmod.livedisplay,android.hardware.camera.any,android.hardware.camera.capability.raw,android.software.connectionservice,android.hardware.touchscreen.multitouch.distinct,android.hardware.location.network"
",android.software.sip,android.hardware.camera.capability.manual_sensor,android.hardware.camera.level.full,android.hardware.wifi.direct,android.software.live_wallpaper,com.google.android.feature.GOOGLE_EXPERIENCE,com.google.android.feature.EXCHANGE_6_2,org.cyanogenmod.theme.v1,org.cyanogenmod.livelockscreen,android.hardware.location.gps,android.software.midi,android.hardware.nfc.hce,android.hardware.wifi,android.hardware.location,android.hardware.telephony"
LOCALE_LIST = "hi,so_ET,ro_MD,in,sn_ZW,sw_UG,es_BO,dyo,ru_KZ,en_JE,zu,en_JM,pt_BR,en_MS,ar_SD,en_ZM,es_PA,en_GG,es_SV,en_SE,es,rof,fr_SC,fr_GA,en_CM,ta,en_SX,fr_MC,fy,to,fr_RW,en_SD,qu,en_KE,rw_RW,gv_IM,sv_FI,cgg,pt_GW,fr_CF,sv_SE,dje,en_SS,ar_DZ,si,es_UY,ar_SA,tr_TR,dua,fr_BL,nb_SJ,fr_CA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,en_VI,en_BM,se,en_IE,en_SL,khq,en_CH,ee_GH,ko,lb_LU,en_AT,nn,ar_ER,lrc,ar_TD,ar_MR,fr_YT,en_GH,en_MU,si_LK,gv,ky_KG,nl_NL,rm_CH,ar_IL,ti,iw,hy_AM,se_FI,pt_TL,en_AG,or,bez,ff_SN,en_IM,fr_MA,en_MT,nd_ZW,fi_FI,en_NZ,de_BE,fr_KM,bas,ak,nl_AW,ar_AE,kab,ar_EG,ur,es_AR,ar_DJ,ar_KM,kkj,fi,lu,fr_FR,ebu,os,ne_IN,ln_AO,gu,zh,os_GE,sg_CF,mn_MN,gl,lg_UG,ko_KP,rn,mzn,es_US,hi_IN,ar_LY,ms_BN,fr_NC,so_DJ,ii,en_ER,ar_SS,kea,ln_CG,fr_MU"
",nb,yo,nnh,en_VC,ewo,en_CA"
GL_EXTENSIONS = "GL_AMD_compressed_ATC_texture,GL_AMD_performance_monitor,GL_ANDROID_extension_pack_es31a,GL_APPLE_texture_2D_limited_npot,GL_ARB_vertex_buffer_object,GL_ARM_shader_framebuffer_fetch_depth_stencil,GL_EXT_YUV_target,GL_EXT_blit_framebuffer_params,GL_EXT_buffer_storage,GL_EXT_color_buffer_float,GL_EXT_color_buffer_half_float,GL_EXT_copy_image,GL_EXT_debug_label,GL_EXT_debug_marker,GL_EXT_discard_framebuffer,GL_EXT_disjoint_timer_query,GL_EXT_draw_buffers_indexed,GL_EXT_geometry_shader"
",GL_EXT_gpu_shader5,GL_EXT_multisampled_render_to_texture,GL_EXT_primitive_bounding_box,GL_EXT_robustness,GL_EXT_sRGB,GL_EXT_sRGB_write_control,GL_EXT_shader_framebuffer_fetch,GL_EXT_shader_io_blocks,GL_EXT_tessellation_shader,GL_EXT_texture_border_clamp,GL_EXT_texture_buffer,GL_EXT_texture_cube_map_array,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_format_BGRA8888,GL_EXT_texture_norm16,GL_EXT_texture_sRGB_R8,GL_EXT_texture_sRGB_decode,GL_EXT_texture_type_2_10_10_10_REV"
",GL_KHR_blend_equation_advanced,GL_KHR_blend_equation_advanced_coherent,GL_KHR_debug,GL_KHR_no_error,GL_KHR_texture_compression_astc_hdr,GL_KHR_texture_compression_astc_ldr,GL_OES_EGL_image,GL_OES_EGL_image_external,GL_OES_EGL_sync,GL_OES_blend_equation_separate,GL_OES_blend_func_separate,GL_OES_blend_subtract,GL_OES_compressed_ETC1_RGB8_texture,GL_OES_compressed_paletted_texture,GL_OES_depth24,GL_OES_depth_texture,GL_OES_depth_texture_cube_map,GL_OES_draw_texture"
",GL_OES_element_index_uint,GL_OES_framebuffer_object,GL_OES_get_program_binary,GL_OES_matrix_palette,GL_OES_packed_depth_stencil,GL_OES_point_size_array,GL_OES_point_sprite,GL_OES_read_format,GL_OES_rgb8_rgba8,GL_OES_sample_shading,GL_OES_sample_variables,GL_OES_shader_image_atomic,GL_OES_shader_multisample_interpolation,GL_OES_standard_derivatives,GL_OES_stencil_wrap,GL_OES_surfaceless_context,GL_OES_texture_3D,GL_OES_texture_compression_astc,GL_OES_texture_cube_map"
",GL_OES_texture_env_crossbar,GL_OES_texture_float,GL_OES_texture_float_linear,GL_OES_texture_half_float,GL_OES_texture_half_float_linear,GL_OES_texture_mirrored_repeat,GL_OES_texture_npot,GL_OES_texture_stencil8,GL_OES_texture_storage_multisample_2d_array,GL_OES_vertex_array_object,GL_OES_vertex_half_float,GL_OVR_multiview,GL_OVR_multiview2,GL_OVR_multiview_multisampled_render_to_texture,GL_QCOM_alpha_test,GL_QCOM_extended_get,GL_QCOM_tiled_rendering,GL_EXT_multi_draw_arrays"
",GL_EXT_shader_texture_lod,GL_IMG_multisampled_render_to_texture,GL_IMG_program_binary,GL_IMG_read_format,GL_IMG_shader_binary,GL_IMG_texture_compression_pvrtc,GL_IMG_texture_format_BGRA8888,GL_IMG_texture_npot,GL_IMG_vertex_array_object,GL_OES_byte_coordinates,GL_OES_extended_matrix_palette,GL_OES_fixed_point,GL_OES_fragment_precision_high,GL_OES_mapbuffer,GL_OES_matrix_get,GL_OES_query_matrix,GL_OES_required_internalformat,GL_OES_single_precision,GL_OES_stencil8"
libList = device['sharedlibraries'].split(",")
featureList = device['features'].split(",")
localeList = device['locales'].split(",")
glList = device['gl.extensions'].split(",")
platforms = device['platforms'].split(",")
def getDeviceConfig():
deviceConfig = googleplay_pb2.DeviceConfigurationProto()
deviceConfig.touchScreen = int(device['touchscreen'])
deviceConfig.keyboard = int(device['keyboard'])
deviceConfig.navigation = int(device['navigation'])
deviceConfig.screenLayout = int(device['screenlayout'])
deviceConfig.hasHardKeyboard = False if device['hashardkeyboard'] == 'false' else True
deviceConfig.hasFiveWayNavigation = False if device['hasfivewaynavigation'] == 'false' else True
deviceConfig.screenDensity = int(device['screen.density'])
deviceConfig.screenWidth = int(device['screen.width'])
deviceConfig.screenHeight = int(device['screen.height'])
deviceConfig.glEsVersion = int(device['gl.version'])
for x in platforms:
deviceConfig.nativePlatform.append(x)
for x in libList:
deviceConfig.systemSharedLibrary.append(x)
for x in featureList:
deviceConfig.systemAvailableFeature.append(x)
for x in localeList:
deviceConfig.systemSupportedLocale.append(x)
for x in glList:
deviceConfig.glExtension.append(x)
return deviceConfig
libList = LIB_LIST.split(",")
featureList = FEATURE_LIST.split(",")
localeList = LOCALE_LIST.split(",")
glList = GL_EXTENSIONS.split(",")
currentTime = int(time.time())
def getAndroidBuild():
androidBuild = googleplay_pb2.AndroidBuildProto()
androidBuild.id = device['build.fingerprint']
androidBuild.product = device['build.hardware']
androidBuild.carrier = device['build.brand']
androidBuild.radio = device['build.radio']
androidBuild.bootloader = device['build.bootloader']
androidBuild.device = device['build.device']
androidBuild.sdkVersion = int(device['build.version.sdk_int'])
androidBuild.model = device['build.model']
androidBuild.manufacturer = device['build.manufacturer']
androidBuild.buildProduct = device['build.product']
androidBuild.client = device['client']
androidBuild.otaInstalled = False
androidBuild.timestamp = int(time.time())
androidBuild.googleServices = int(device['gsf.version'])
return androidBuild
deviceConfig = googleplay_pb2.DeviceConfigurationProto()
deviceConfig.touchScreen = 3
deviceConfig.keyboard = 1
deviceConfig.navigation = 1
deviceConfig.screenLayout = 2
deviceConfig.hasHardKeyboard = False
deviceConfig.hasFiveWayNavigation = False
deviceConfig.screenDensity = 420
deviceConfig.screenWidth = 1080
deviceConfig.screenHeight = 1920
deviceConfig.nativePlatform.append("armeabi-v7a")
deviceConfig.nativePlatform.append("armeabi")
for x in libList:
deviceConfig.systemSharedLibrary.append(x)
for x in featureList:
deviceConfig.systemAvailableFeature.append(x)
for x in localeList:
deviceConfig.systemSupportedLocale.append(x)
deviceConfig.glEsVersion = 131072
for x in glList:
deviceConfig.glExtension.append(x)
def getAndroidCheckin():
androidCheckin = googleplay_pb2.AndroidCheckinProto()
androidCheckin.build.CopyFrom(getAndroidBuild())
androidCheckin.lastCheckinMsec = 0
androidCheckin.cellOperator = device['celloperator']
androidCheckin.simOperator = device['simoperator']
androidCheckin.roaming = device['roaming']
androidCheckin.userNumber = 0
return androidCheckin
androidBuild = googleplay_pb2.AndroidBuildProto()
androidBuild.id = 'oneplus/bacon/A0001:6.0.1/MHC19Q/ZNH2KAS1KN:user/release-keys'
androidBuild.product = 'bacon'
androidBuild.carrier = 'oneplus'
androidBuild.radio = '.4.0.1.c7-00013-M8974AAAAANAZM-1'
androidBuild.bootloader = 'unknown'
androidBuild.device = 'A0001'
androidBuild.sdkVersion = 25
androidBuild.model = 'A0001'
androidBuild.manufacturer = 'OnePlus'
androidBuild.buildProduct = 'bacon'
androidBuild.client = 'android-google'
androidBuild.otaInstalled = False
androidBuild.timestamp = currentTime
androidBuild.googleServices = 10548448
androidCheckin = googleplay_pb2.AndroidCheckinProto()
androidCheckin.build.CopyFrom(androidBuild)
androidCheckin.lastCheckinMsec = 0
androidCheckin.cellOperator = '310260'
androidCheckin.simOperator = '310260'
androidCheckin.roaming = 'mobile-notroaming'
androidCheckin.userNumber = 0
def getAndroidCheckinRequest():
request = googleplay_pb2.AndroidCheckinRequest()
request.id = 0
request.checkin.CopyFrom(getAndroidCheckin())
request.locale = 'en_US'
request.timeZone = 'America/New_York'
request.version = 3
request.deviceConfiguration.CopyFrom(getDeviceConfig())
request.fragment = 0
return request

34
device.properties Normal file
View File

@ -0,0 +1,34 @@
[angler]
UserReadableName = Nexus 6P (api23)
Build.FINGERPRINT = google/angler/angler:6.0.1/MTC20L/3230295:user/release-keys
Build.HARDWARE = angler
Build.BRAND = google
Build.RADIO = unknown
Build.BOOTLOADER = angler-03.54
Build.DEVICE = angler
Build.VERSION.SDK_INT = 23
Build.MODEL = Nexus 6P
Build.MANUFACTURER = Huawei
Build.PRODUCT = angler
TouchScreen = 3
Keyboard = 1
Navigation = 1
ScreenLayout = 2
HasHardKeyboard = false
HasFiveWayNavigation = false
Screen.Density = 560
Screen.Width = 1440
Screen.Height = 2392
Platforms = arm64-v8a,armeabi-v7a,armeabi
SharedLibraries = com.google.widevine.software.drm,com.google.android.media.effects,com.google.android.camera.experimental2015,com.android.location.provider,com.quicinc.cneapiclient,com.android.future.usb.accessory,javax.obex,com.google.android.gms,com.qualcomm.qcrilhook,android.test.runner,com.google.android.dialer.support,com.google.android.maps,org.apache.http.legacy,com.android.media.remotedisplay,com.android.mediadrm.signer
Features = android.hardware.sensor.proximity,android.hardware.sensor.accelerometer,android.hardware.faketouch,org.cyanogenmod.appsuggest,android.hardware.usb.accessory,android.hardware.telephony.cdma,android.software.backup,android.hardware.touchscreen,android.hardware.touchscreen.multitouch,android.software.print,android.hardware.consumerir,org.cyanogenmod.partner,org.cyanogenmod.telephony,android.software.voice_recognizers,android.hardware.fingerprint,android.hardware.sensor.gyroscope,android.hardware.audio.low_latency,android.hardware.opengles.aep,android.hardware.bluetooth,android.hardware.camera.autofocus,com.google.android.feature.GOOGLE_BUILD,android.hardware.telephony.gsm,android.software.sip.voip,org.cyanogenmod.profiles,android.hardware.usb.host,com.cyanogenmod.android,android.hardware.audio.output,android.hardware.camera.flash,android.hardware.camera.front,android.hardware.sensor.hifi_sensors,android.hardware.screen.portrait,android.hardware.nfc,com.nxp.mifare,android.hardware.sensor.stepdetector,org.cyanogenmod.audio,org.cyanogenmod.theme,android.software.home_screen,android.hardware.microphone,org.cyanogenmod.statusbar,android.hardware.bluetooth_le,android.hardware.sensor.compass,android.hardware.touchscreen.multitouch.jazzhand,android.hardware.sensor.barometer,android.software.app_widgets,android.software.input_methods,android.hardware.sensor.light,android.software.device_admin,android.hardware.camera,org.cyanogenmod.hardware,android.hardware.screen.landscape,org.cyanogenmod.weather,org.cyanogenmod.performance,android.software.managed_users,android.software.webview,android.hardware.sensor.stepcounter,android.hardware.camera.capability.manual_post_processing,org.cyanogenmod.livedisplay,android.hardware.camera.any,android.hardware.camera.capability.raw,android.software.connectionservice,android.hardware.touchscreen.multitouch.distinct,android.hardware.location.network,android.software.sip,android.hardware.camera.capability.manual_sensor,android.hardware.camera.level.full,android.hardware.wifi.direct,android.software.live_wallpaper,com.google.android.feature.GOOGLE_EXPERIENCE,com.google.android.feature.EXCHANGE_6_2,org.cyanogenmod.theme.v1,org.cyanogenmod.livelockscreen,android.hardware.location.gps,android.software.midi,android.hardware.nfc.hce,android.hardware.wifi,android.hardware.location,android.hardware.telephony
Locales = af,af_NA,af_ZA,agq,ak,ak_GH,am,am_ET,ar,ar_AE,ar_BH,ar_DJ,ar_DZ,ar_EG,ar_EH,ar_ER,ar_IL,ar_IQ,ar_JO,ar_KM,ar_KW,ar_LB,ar_LY,ar_MA,ar_MR,ar_OM,ar_PS,ar_QA,ar_SA,ar_SD,ar_SO,ar_SS,ar_SY,ar_TD,ar_TN,ar_YE,as,as_IN,asa,az,bas,be,be_BY,bem,bez,bg,bg_BG,bm,bn,bn_BD,bn_IN,bo,bo_CN,bo_IN,br,br_FR,brx,bs,ca,ca_AD,ca_ES,ca_FR,ca_IT,cgg,chr,cs,cs_CZ,cy,cy_GB,da,da_DK,da_GL,dav,de,de_AT,de_BE,de_CH,de_DE,de_LI,de_LU,dje,dsb,dua,dyo,dz,dz_BT,ebu,ee,ee_GH,ee_TG,el,el_CY,el_GR,en,en_AG,en_AI,en_AS,en_AU,en_BB,en_BE,en_BM,en_BS,en_BW,en_BZ,en_CA,en_CC,en_CK,en_CM,en_CX,en_DG,en_DM,en_ER,en_FJ,en_FK,en_FM,en_GB,en_GD,en_GG,en_GH,en_GI,en_GM,en_GU,en_GY,en_HK,en_IE,en_IM,en_IN,en_IO,en_JE,en_JM,en_KE,en_KI,en_KN,en_KY,en_LC,en_LR,en_LS,en_MG,en_MH,en_MO,en_MP,en_MS,en_MT,en_MU,en_MW,en_MY,en_NA,en_NF,en_NG,en_NR,en_NU,en_NZ,en_PG,en_PH,en_PK,en_PN,en_PR,en_PW,en_RW,en_SB,en_SC,en_SD,en_SG,en_SH,en_SL,en_SS,en_SX,en_SZ,en_TC,en_TK,en_TO,en_TT,en_TV,en_TZ,en_UG,en_UM,en_US,en_VC,en_VG,en_VI,en_VU,en_WS,en_ZA,en_ZM,en_ZW,eo,es,es_AR,es_BO,es_CL,es_CO,es_CR,es_CU,es_DO,es_EA,es_EC,es_ES,es_GQ,es_GT,es_HN,es_IC,es_MX,es_NI,es_PA,es_PE,es_PH,es_PR,es_PY,es_SV,es_US,es_UY,es_VE,et,et_EE,eu,eu_ES,ewo,fa,fa_AF,fa_IR,ff,ff_CM,ff_GN,ff_MR,ff_SN,fi,fi_FI,fil,fo,fo_FO,fr,fr_BE,fr_BF,fr_BI,fr_BJ,fr_BL,fr_CA,fr_CD,fr_CF,fr_CG,fr_CH,fr_CI,fr_CM,fr_DJ,fr_DZ,fr_FR,fr_GA,fr_GF,fr_GN,fr_GP,fr_GQ,fr_HT,fr_KM,fr_LU,fr_MA,fr_MC,fr_MF,fr_MG,fr_ML,fr_MQ,fr_MR,fr_MU,fr_NC,fr_NE,fr_PF,fr_PM,fr_RE,fr_RW,fr_SC,fr_SN,fr_SY,fr_TD,fr_TG,fr_TN,fr_VU,fr_WF,fr_YT,fur,fy,fy_NL,ga,ga_IE,gd,gd_GB,gl,gl_ES,gsw,gu,gu_IN,guz,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ug,uk,uk_UA,ur,ur_IN,ur_PK,uz,vai,vi,vi_VN,vun,wae,xog,yav,ji,yo,yo_BJ,yo_NG,zgh,zh,zu,zu_ZA
Client = android-google
GSF.version = 10548448
Vending.version = 80798000
CellOperator = 310260
SimOperator = 310260
Roaming = mobile-notroaming
TimeZone = Europe/Moscow
GL.Version = 196610
GL.Extensions = GL_AMD_compressed_ATC_texture,GL_AMD_performance_monitor,GL_ANDROID_extension_pack_es31a,GL_APPLE_texture_2D_limited_npot,GL_ARB_vertex_buffer_object,GL_ARM_shader_framebuffer_fetch_depth_stencil,GL_EXT_YUV_target,GL_EXT_blit_framebuffer_params,GL_EXT_buffer_storage,GL_EXT_color_buffer_float,GL_EXT_color_buffer_half_float,GL_EXT_copy_image,GL_EXT_debug_label,GL_EXT_debug_marker,GL_EXT_discard_framebuffer,GL_EXT_disjoint_timer_query,GL_EXT_draw_buffers_indexed,GL_EXT_geometry_shader,GL_EXT_gpu_shader5,GL_EXT_multisampled_render_to_texture,GL_EXT_primitive_bounding_box,GL_EXT_robustness,GL_EXT_sRGB,GL_EXT_sRGB_write_control,GL_EXT_shader_framebuffer_fetch,GL_EXT_shader_io_blocks,GL_EXT_tessellation_shader,GL_EXT_texture_border_clamp,GL_EXT_texture_buffer,GL_EXT_texture_cube_map_array,GL_EXT_texture_filter_anisotropic,GL_EXT_texture_format_BGRA8888,GL_EXT_texture_norm16,GL_EXT_texture_sRGB_R8,GL_EXT_texture_sRGB_decode,GL_EXT_texture_type_2_10_10_10_REV,GL_KHR_blend_equation_advanced,GL_KHR_blend_equation_advanced_coherent,GL_KHR_debug,GL_KHR_no_error,GL_KHR_texture_compression_astc_hdr,GL_KHR_texture_compression_astc_ldr,GL_OES_EGL_image,GL_OES_EGL_image_external,GL_OES_EGL_sync,GL_OES_blend_equation_separate,GL_OES_blend_func_separate,GL_OES_blend_subtract,GL_OES_compressed_ETC1_RGB8_texture,GL_OES_compressed_paletted_texture,GL_OES_depth24,GL_OES_depth_texture,GL_OES_depth_texture_cube_map,GL_OES_draw_texture,GL_OES_element_index_uint,GL_OES_framebuffer_object,GL_OES_get_program_binary,GL_OES_matrix_palette,GL_OES_packed_depth_stencil,GL_OES_point_size_array,GL_OES_point_sprite,GL_OES_read_format,GL_OES_rgb8_rgba8,GL_OES_sample_shading,GL_OES_sample_variables,GL_OES_shader_image_atomic,GL_OES_shader_multisample_interpolation,GL_OES_standard_derivatives,GL_OES_stencil_wrap,GL_OES_surfaceless_context,GL_OES_texture_3D,GL_OES_texture_compression_astc,GL_OES_texture_cube_map,GL_OES_texture_env_crossbar,GL_OES_texture_float,GL_OES_texture_float_linear,GL_OES_texture_half_float,GL_OES_texture_half_float_linear,GL_OES_texture_mirrored_repeat,GL_OES_texture_npot,GL_OES_texture_stencil8,GL_OES_texture_storage_multisample_2d_array,GL_OES_vertex_array_object,GL_OES_vertex_half_float,GL_OVR_multiview,GL_OVR_multiview2,GL_OVR_multiview_multisampled_render_to_texture,GL_QCOM_alpha_test,GL_QCOM_extended_get,GL_QCOM_tiled_rendering,GL_EXT_multi_draw_arrays,GL_EXT_shader_texture_lod,GL_IMG_multisampled_render_to_texture,GL_IMG_program_binary,GL_IMG_read_format,GL_IMG_shader_binary,GL_IMG_texture_compression_pvrtc,GL_IMG_texture_format_BGRA8888,GL_IMG_texture_npot,GL_IMG_vertex_array_object,GL_OES_byte_coordinates,GL_OES_extended_matrix_palette,GL_OES_fixed_point,GL_OES_fragment_precision_high,GL_OES_mapbuffer,GL_OES_matrix_get,GL_OES_query_matrix,GL_OES_required_internalformat,GL_OES_single_precision,GL_OES_stencil8

View File

@ -39,27 +39,19 @@ class GooglePlayAPI(object):
"""Google Play Unofficial API Class
Usual APIs methods are login(), search(), details(), bulkDetails(),
download(), browse(), reviews() and list().
toStr() can be used to pretty print the result (protobuf object) of the
previous methods.
toDict() converts the result into a dict, for easier introspection."""
SERVICE = "androidmarket"
download(), browse(), reviews() and list()."""
URL_LOGIN = "https://android.clients.google.com/auth"
ACCOUNT_TYPE_HOSTED_OR_GOOGLE = "HOSTED_OR_GOOGLE"
authSubToken = None
ac2dmToken = None
gsfId = None
def __init__(self, debug=False):
# you must use a device-associated androidId value
self.preFetch = {}
self.lang = config.LANG
self.debug = debug
self.gsfId = None
self.ac2dmToken = None
self.authSubToken = None
def encrypt_password(self, login, passwd):
@ -156,7 +148,7 @@ class GooglePlayAPI(object):
"X-DFE-Encoded-Targets":
"CAEScFfqlIEG6gUYogFWrAISK1WDAg+hAZoCDgIU1gYEOIACFkLMAeQBnASLATlASUuyAyqCAjY5igOMBQzfA/IClwFbApUC4ANbtgKVAS7OAX8YswHFBhgDwAOPAmGEBt4OfKkB5weSB5AFASkiN68akgMaxAMSAQEBA9kBO7UBFE1KVwIDBGs3go6BBgEBAgMECQgJAQIEAQMEAQMBBQEBBAUEFQYCBgUEAwMBDwIBAgOrARwBEwMEAg0mrwESfTEcAQEKG4EBMxghChMBDwYGASI3hAEODEwXCVh/EREZA4sBYwEdFAgIIwkQcGQRDzQ2fTC2AjfVAQIBAYoBGRg2FhYFBwEqNzACJShzFFblAo0CFxpFNBzaAd0DHjIRI4sBJZcBPdwBCQGhAUd2A7kBLBVPngEECHl0UEUMtQETigHMAgUFCc0BBUUlTywdHDgBiAJ+vgKhAU0uAcYCAWQ/"
"5ALUAw1UwQHUBpIBCdQDhgL4AY4CBQICjARbGFBGWzA1CAEMOQH+BRAOCAZywAIDyQZ2MgM3BxsoAgUEBwcHFia3AgcGTBwHBYwBAlcBggFxSGgIrAEEBw4QEqUCASsWadsHCgUCBQMD7QICA3tXCUw7ugJZAwGyAUwpIwM5AwkDBQMJA5sBCw8BNxBVVBwVKhebARkBAwsQEAgEAhESAgQJEBCZATMdzgEBBwG8AQQYKSMUkAEDAwY/CTs4/wEaAUt1AwEDAQUBAgIEAwYEDx1dB2wGeBFgTQ",
"User-Agent": "Android-Finsky/7.1.15 (api=3,versionCode=80798000,sdk=25,device=A0001,hardware=bacon,product=bacon)",
"User-Agent": "Android-Finsky/7.1.15 (api=3,versionCode=80798000,sdk=23,device=angler,hardware=angler,product=angler)",
}
if self.gsfId is not None:
headers["X-DFE-Device-Id"] = "{0:x}".format(self.gsfId)
@ -169,14 +161,7 @@ class GooglePlayAPI(object):
headers["Content-Type"] = "application/x-protobuffer"
url = "https://android.clients.google.com/checkin"
request = googleplay_pb2.AndroidCheckinRequest()
request.id = 0
request.checkin.CopyFrom(config.androidCheckin)
request.locale = self.lang
request.timeZone = 'America/New_York'
request.version = 3
request.deviceConfiguration.CopyFrom(config.deviceConfig)
request.fragment = 0
request = config.getAndroidCheckinRequest()
stringRequest = request.SerializeToString()
res = requests.post(url, data=stringRequest,
@ -185,9 +170,6 @@ class GooglePlayAPI(object):
response.ParseFromString(res.content)
securityToken = "{0:x}".format(response.securityToken)
gsfId = "{0:x}".format(response.androidId)
print("GsfId value: %d" % response.androidId)
print("Hex string representation of gsfId: %s" % gsfId)
# checkin again to upload gfsid
request2 = googleplay_pb2.AndroidCheckinRequest()
@ -204,7 +186,7 @@ class GooglePlayAPI(object):
def uploadDeviceConfig(self):
upload = googleplay_pb2.UploadDeviceConfigRequest()
upload.deviceConfiguration.CopyFrom(config.deviceConfig)
upload.deviceConfiguration.CopyFrom(config.getDeviceConfig())
headers = self.getDefaultHeaders()
headers["X-DFE-Enabled-Experiments"] = "cl:billing.select_add_instrument_by_default"
headers["X-DFE-Unsupported-Experiments"] = "nocache:billing.use_charging_poller,market_emails,buyer_currency,prod_baseline,checkin.set_asset_paid_app_field,shekel_test,content_ratings,buyer_currency_in_app,nocache:encrypted_apk,recent_changes"
@ -216,7 +198,6 @@ class GooglePlayAPI(object):
res = requests.post(url, data=stringRequest,
headers=headers, verify=ssl_verify)
response = googleplay_pb2.ResponseWrapper.FromString(res.content)
print(res.text)
def login(self, email=None, password=None, ac2dmToken=None, gsfId=None):
@ -272,7 +253,11 @@ class GooglePlayAPI(object):
raise LoginError("Auth token not found.")
self.gsfId = self.checkin(email)
if self.debug:
print("Google Services Framework Id: %s" % "{0:x}".format(self.gsfId))
self.getAuthSubToken(email, encryptedPass)
if self.debug:
print("Uploading device configuration")
self.uploadDeviceConfig()
def getAuthSubToken(self, email, passwd):
@ -341,7 +326,7 @@ class GooglePlayAPI(object):
verify=ssl_verify)
data = response.content
cluster = googleplay_pb2.SearchClusterResponse.FromString(data)
return cluster.preFetch[0].response.wrapper.wrapper.cluster[0].doc[0]
return cluster.preFetch[0].response.wrapper.wrapper.cluster[0].doc[0]
def details(self, packageName):
"""Get app details from a package name.
@ -432,8 +417,9 @@ class GooglePlayAPI(object):
params=params, verify=ssl_verify)
resObj = googleplay_pb2.ResponseWrapper.FromString(response.content)
if "ErrorMessage" in str(resObj):
raise DecodeError
print(resObj)
if resObj.commands.displayErrorMessage != "":
raise DecodeError(resObj.commands.displayErrorMessage)
else:
dlToken = resObj.payload.buyResponse.downloadToken
path = "delivery"