charles_log_bannersample_0217_McDonarld.chls


[Banner ads 분석]

01. 처음 실제 광고가 어떠한 순서로 요청되고 응답되는 지 charles에서 패킷을 캡처해서 분석해보았다.

찰스에 대한 사용법은 다음의 게시물(link) 참조.


총 5개의 API가 사용되는 것으로 보인다.

https://sdkm.w.inmobi.com 가 처음 호출되고 다음과 같은 응답을 받는다.

HTTP/1.1 200 OK Server: nginx/1.7.4 Date: Fri, 17 Feb 2017 00:06:57 GMT Content-Length: 0 Connection: keep-alive

네트워크 확인하는 용도의 API로 보인다.
두번째로 http://i.w.inmobi.com/showad.asm 가 호출되고 해당 HTTP 요청이 실질적인 ad-request.



sm 복호화 전 

https://docs.google.com/a/inmobi.com/document/d/1KOj0z6M_65ikXpAo9SyM0zPQhnyeKqCpiVw6AQ0ORDA/edit?usp=sharing


위에서 보내는 url 의 파라미터는 자세히 열어보면은 다음과 같은 형태. url이지만 파라미터에 Json 객체/value를 실어보내고 있다. 디바이스 정보 등 



Request 의 헤더정보는 다음과 같다.


POST /showad.asm HTTP/1.1

User-Agent: Mozilla/5.0 (Linux; Android 5.0.2; SM-A500S Build/LRX22G; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36

Content-Length: 1358

Content-Type: application/x-www-form-urlencoded

Host: i.w.inmobi.com

Connection: Keep-Alive

Accept-Encoding: gzip


[Response
]

{"ads":[{"pubContent":"\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n \u003ctitle\u003e\u003c/title\u003e\n \u003cmeta name\u003d\"viewport\" content\u003d\"user-scalable\u003d0, minimum-scale\u003d1.0, maximum-scale\u003d1.0\"/\u003e\n \u003cstyle type\u003d\"text/css\"\u003e\n body {margin: 0; overflow: hidden;}\n \u003c/style\u003e\n \u003clink rel\u003d\"dns-prefetch\" href\u003d\"//i.l.inmobicdn.net\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript type\u003d\"text/javascript\" src\u003d\"https://i.l.inmobicdn.net/sdk/sdk/500/android/mraid.js\"\u003e \u003c/script\u003e\n\u003cdiv style\u003d\"display:none; position:absolute;\" id\u003d\"0clickTarget\"\u003e\u003c/div\u003e\n \u003cdiv style\u003d\"display:none; position:absolute;\" id\u003d\"im_9429_clickTarget\"\u003e\u003c/div\u003e\n\u003cscript type\u003d\"text/javascript\"\u003e\n(function() {var d\u003d_im_imai,e\u003dwindow,g\u003dencodeURIComponent,k\u003ddocument,l\u003d\u0027addEventListener\u0027,m\u003d\u0027prototype\u0027,p\u003d\u0027fireAdReady\u0027,q\u003d\u0027setAttribute\u0027,r\u003d\u0027getTime\u0027,s\u003d\u0027\u0027,t\u003d\u0027\u0026\u0027,v\u003d\u00270\u0027,w\u003d\u00272\u0027,x\u003d\u0027\u003d\u0027,y\u003d\u0027?\u0027,z\u003d\u0027SKStoreContentLoaded\u0027,A\u003d\u0027addReadyHandler\u0027,B\u003d\u0027clickCallback\u0027,C\u003d\u0027clickTarget\u0027,D\u003d\u0027disableAutoFireAdReady\u0027,E\u003d\u0027error\u0027,F\u003d\u0027fireAdFailed\u0027,G\u003d\u0027fireAdReady\u0027,H\u003d\u0027height\u0027,I\u003d\u0027iatSendClick\u0027,J\u003d\u0027iframe\u0027,L\u003d\u0027img\u0027,M\u003d\u0027impressionCallback\u0027,N\u003d\u0027loadSKStore\u0027,O\u003d\u0027m\u003d\u0027,P\u003d\u0027openLandingPage\u0027,Q\u003d\u0027ready\u0027,R\u003d\u0027recordEvent\u0027,S\u003d\u0027seamless\u0027,T\u003d\u0027src\u0027,U\u003d\u0027width\u0027;\ne.inmobi\u003de.inmobi||{};var V\u003de.inmobi;V.getTime\u003dfunction(){return(new Date)[r]()};V.g\u003dV.g||[];V.a\u003dfunction(a,b){for(var c\u003dV.g,f\u003d0;f\u003cc.length;f++)c[f].call(this,a,b)};V.recordEvent\u003dV.a;V.b\u003d!0;V.addReadyHandler\u003dfunction(){d[l](Q,function(){V.b\u0026\u0026d[p]()})};V.fireAdReady\u003dfunction(){d[p]()};V.fireAdFailed\u003dfunction(){d.fireAdFailed()};V.disableAutoFireAdReady\u003dfunction(){V.b\u003d!1};\nfunction W(a){function b(a,b){c.a(a,b)}this.f\u003da.lp;this.e\u003da.ct;this.m\u003da.tc;this.o\u003da.bcu;this.d\u003da.ns;this.i\u003da.lpom;this.q\u003da.fb;this.p\u003da.fbom;this.b\u003d!0;this.j\u003dV[r]();this.l\u003d0;this.n\u003da.sc;this.h\u003d!1;this.c\u003dmraid;imraid\u0026\u0026imraid.loadSKStore\u0026\u0026(this.c\u003dimraid);a\u003dthis.d;var c\u003dthis;e[a+N]\u003dfunction(){c.loadSKStore()};e[a+P]\u003dfunction(){X(c);if(c.h)c.h\u003d!1,c.c.showSKStore(c.f);else{var a\u003dY(c,c.f);W.k[c.i](a)}};e[a+B]\u003dfunction(){Z(c)};e[a+M]\u003dfunction(){$(c)};e[a+R]\u003dfunction(a,b){c.a(a,b)};e[a+G]\u003dfunction(){c[p]()};\ne[a+F]\u003dfunction(){c.fireAdFailed()};e[a+A]\u003dfunction(){V.addReadyHandler()};e[a+D]\u003dfunction(){V.b\u003d!1};e[a+R]\u003db;this.n\u0026\u0026V.g.push(b)}V.Imai\u003dW;W.k\u003d{3:d.openExternal,4:d.openEmbedded,5:d.ios.openItunesProductView};function Y(a,b){return b.replace(/\\$TS/g,s+V[r]()).replace(/\\$LTS/g,s+a.j).replace(/\\$STS/g,s+a.l)}W[m].loadSKStore\u003dfunction(){if(5\u003d\u003dthis.i){var a\u003dthis;a.c[l](z,function(){a.h\u003d!0});mraid[l](Q,function(){a.c.loadSKStore(a.f)})}};\nfunction X(a){var b\u003d!1;d[l](E,function(){b||(b\u003d!0,a.a(103),W.k[a.p](a.q))})}function Z(a){d.onUserInteraction();var b\u003de[a.d+I];b\u0026\u0026b();if(null!\u003da.e)for(var b\u003da.e.length,c\u003d0;c\u003cb;c++)d.pingInWebView(Y(a,a.e[c]))}function $(a){a.l\u003dV[r]();if(null!\u003da.m)try{var b\u003dk.getElementById(a.d+C),c\u003da.m,f\u003dk.createElement(J);f[q](S,S);f[q](H,v);f[q](U,w);b.appendChild(f);var h\u003df.contentWindow;h\u0026\u0026(h.document.write(c),h.document.close())}catch(u){}}\nW[m].a\u003dfunction(a,b){var c\u003dthis,f\u003dy,h\u003dthis.o;0\u003c\u003dh.indexOf(y)\u0026\u0026(f\u003dt);h+\u003df+O+a;if(b)for(var u in b)h+\u003dt+g(u)+x+g(b[u]);1\u003d\u003da\u0026\u0026(this.j\u003dV[r]());if(3\u003d\u003da||4\u003d\u003da)d.ping(h,!0);else{var K\u003dfunction(a,b,f){if(!(0\u003e\u003df)){var h\u003dk.getElementById(c.d+C),n\u003dk.createElement(L);n[q](T,a);n[q](H,v);n[q](U,w);void 0!\u003dn[l]\u0026\u0026n[l](E,function(){e.setTimeout(function(){3E5\u003cb\u0026\u0026(b\u003d3E5);K(a,2*b,f-1)},b*Math.random())},!1);h.appendChild(n)}};K(h,1E3,5)}18\u003d\u003da\u0026\u0026$(this);8\u003d\u003da\u0026\u0026Z(this)};W[m].fireAdReady\u003dfunction(){d[p]()};\nW[m].fireAdFailed\u003dfunction(){d.fireAdFailed()};})();\n (function() {var a\u003dwindow,c\u003d\u0027handleClick\u0027,e\u003d\u0027handleTouchEnd\u0027,f\u003d\u0027handleTouchStart\u0027;a.inmobi\u003da.inmobi||{};function g(b,h){this.b\u003dh;this.a\u003dthis.c\u003d!1;var d\u003dthis;a[b+c]\u003dfunction(){d.click()};a[b+f]\u003dfunction(){d.start(a.event)};a[b+e]\u003dfunction(){d.end()}}a.inmobi.OldTap\u003dg;g.prototype.click\u003dfunction(){this.c||this.b()};g.prototype.start\u003dfunction(b){this.a\u003dthis.c\u003d!0;b\u0026\u0026b.preventDefault()};g.prototype.end\u003dfunction(){this.a\u0026\u0026(this.a\u003d!1,this.b())};})();\n\nnew window.inmobi.Imai({\"bcu\":\"http://au.w.inmobi.com/c.asm/C/-1/ee5agctlnz/1kqk/w/64/m1/u/0/0/0/-1/496584f6-015a-1000-f6a2-00d60b0b0094/a610/0/-1/0/1/x/-1/NW/-1/0/sdk/6.1.0/dir/Y29tLmlubW9iaS5iYW5uZXIuc2FtcGxl/BCoCOCB3ZWIxMDA2X2Fkc19oa2cxX3N1cHBseS11bXBfcHJvZAA\\u003d/-1/AA\\u003d\\u003d/7/f1181449\",\"ns\":\"0\",\"lpom\":0,\"fbom\":0,\"sc\":true});\n new window.inmobi.Imai({\"lp\":\"http://diagnostics-lp.inmobi.com\",\"ct\":[\"http://c.w.inmobi.com/c.asm/C/b/ee5agctlnz/1kqk/w/64/m1/u/0/0/0/eyJVSUQiOiI0M2U3Yzk2OC00NjllLTQyZmYtOGMyOS03NGRmYTU3YWFlYTkiLCJHUElEIjoiNDNlN2M5NjgtNDY5ZS00MmZmLThjMjktNzRkZmE1N2FhZWE5In0~/496584f6-015a-1000-f693-00d773e20094/a610/0/-1/1/1/x/14311893/NW/2t/0/sdk/6.1.0/dir/Y29tLmlubW9iaS5iYW5uZXIuc2FtcGxl/Nob-yMOQVag4WTVtd2NlaHpZQ25EY1ZaS2ZMN3VGVThPZ2FJS0hLR0dlbFdVWndFQm5pa2NTWXBSOUk1M2V3PT0YBkJBTk5FUhw8Joqw3uPF3ernSiIAADnVwK0Bgn3CuwHI4gEQ0okC1IYD3JwBoJkC8KgCsD-2rQG-PiJIIHdlYjEwMDZfYWRzX2hrZzFfc3VwcGx5LXVtcF9wcm9kIgA\\u003d/0/AA\\u003d\\u003d/7/9cc9b154?at\\u003d2\\u0026am\\u003d1\\u0026ct\\u003d$TS\\u0026lt\\u003d$LTS\\u0026st\\u003d$STS\"],\"bcu\":\"http://et.w.inmobi.com/c.asm/C/b/ee5agctlnz/1kqk/w/64/m1/u/0/0/0/eyJVSUQiOiI0M2U3Yzk2OC00NjllLTQyZmYtOGMyOS03NGRmYTU3YWFlYTkiLCJHUElEIjoiNDNlN2M5NjgtNDY5ZS00MmZmLThjMjktNzRkZmE1N2FhZWE5In0~/496584f6-015a-1000-f693-00d773e20094/a610/0/-1/0/1/x/14311893/NW/2t/0/sdk/6.1.0/dir/Y29tLmlubW9iaS5iYW5uZXIuc2FtcGxl/Nob-yMOQVag4WTVtd2NlaHpZQ25EY1ZaS2ZMN3VGVThPZ2FJS0hLR0dlbFdVWndFQm5pa2NTWXBSOUk1M2V3PT0YBkJBTk5FUhw8Joqw3uPF3ernSiIAADnVwK0Bgn3CuwHI4gEQ0okC1IYD3JwBoJkC8KgCsD-2rQG-PiJIIHdlYjEwMDZfYWRzX2hrZzFfc3VwcGx5LXVtcF9wcm9kIgA\\u003d/0/AA\\u003d\\u003d/7/a40cf079\",\"ns\":\"im_9429_\",\"lpom\":3,\"fbom\":3,\"sc\":true});\n new window.inmobi.OldTap(\"im_9429_\", function() {window[\u0027im_9429_openLandingPage\u0027](); window[\u0027im_9429_recordEvent\u0027](8);});\n window[\u0027im_9429_loadSKStore\u0027]();\n\u003c/script\u003e\n\u003cscript src\u003d\"mraid.js\"\u003e\u003c/script\u003e\n\u003cdiv id\u003d\"Sprout_ZId1K5YF0gcSelgy_div\" data-creativeId\u003d\"ZId1K5YF0gcSelgy\"\u003e\u003c/div\u003e\n\u003cscript type\u003d\"text/javascript\"\u003e\nvar _Sprout \u003d _Sprout || {};\n\n/* 3rd Party Impression Tracker: a tracking pixel URL for tracking 3rd party impressions */\n_Sprout.impressionTracker \u003d \"PUT_IMPRESSION_TRACKER_HERE\";\n\n/* 3rd Party Click Tracker: A URL or Macro like %c for third party exit tracking */\n_Sprout.clickTracker \u003d \"PUT_CLICK_TRACKER_HERE\";\n\n/* Publisher Label: What you want to call this line-item in Studio reports */\n_Sprout.publisherLabel \u003d \"PUT_PUBLISHER_LABEL_HERE\";\n\n/* External variables: parameters for dynamic ads */\n_Sprout.xvars \u003d {\n \"dspname\" : \"Shazam\"\n};\n\n\n_Sprout._inMobiAdTagTracking\u003d{st:new Date().getTime(),rr:0};_Sprout[\"ZId1K5YF0gcSelgy\"]\u003d{querystring:{__im_curl:\"http:\\/\\/et.w.inmobi.com\\/c.asm\\/C\\/b\\/ee5agctlnz\\/1kqk\\/w\\/64\\/m1\\/u\\/0\\/0\\/0\\/eyJVSUQiOiI0M2U3Yzk2OC00NjllLTQyZmYtOGMyOS03NGRmYTU3YWFlYTkiLCJHUElEIjoiNDNlN2M5NjgtNDY5ZS00MmZmLThjMjktNzRkZmE1N2FhZWE5In0~\\/496584f6-015a-1000-f693-00d773e20094\\/a610\\/0\\/-1\\/0\\/1\\/x\\/14311893\\/NW\\/2t\\/0\\/sdk\\/6.1.0\\/dir\\/Y29tLmlubW9iaS5iYW5uZXIuc2FtcGxl\\/Nob-yMOQVag4WTVtd2NlaHpZQ25EY1ZaS2ZMN3VGVThPZ2FJS0hLR0dlbFdVWndFQm5pa2NTWXBSOUk1M2V3PT0YBkJBTk5FUhw8Joqw3uPF3ernSiIAADnVwK0Bgn3CuwHI4gEQ0okC1IYD3JwBoJkC8KgCsD-2rQG-PiJIIHdlYjEwMDZfYWRzX2hrZzFfc3VwcGx5LXVtcF9wcm9kIgA\u003d\\/0\\/AA\u003d\u003d\\/7\\/a40cf079\",__im_sdk:\"$SDK_VERSION_ID\",click:\"http:\\/\\/c.w.inmobi.com\\/c.asm\\/C\\/b\\/ee5agctlnz\\/1kqk\\/w\\/64\\/m1\\/u\\/0\\/0\\/0\\/eyJVSUQiOiI0M2U3Yzk2OC00NjllLTQyZmYtOGMyOS03NGRmYTU3YWFlYTkiLCJHUElEIjoiNDNlN2M5NjgtNDY5ZS00MmZmLThjMjktNzRkZmE1N2FhZWE5In0~\\/496584f6-015a-1000-f693-00d773e20094\\/a610\\/0\\/-1\\/1\\/1\\/x\\/14311893\\/NW\\/2t\\/0\\/sdk\\/6.1.0\\/dir\\/Y29tLmlubW9iaS5iYW5uZXIuc2FtcGxl\\/Nob-yMOQVag4WTVtd2NlaHpZQ25EY1ZaS2ZMN3VGVThPZ2FJS0hLR0dlbFdVWndFQm5pa2NTWXBSOUk1M2V3PT0YBkJBTk5FUhw8Joqw3uPF3ernSiIAADnVwK0Bgn3CuwHI4gEQ0okC1IYD3JwBoJkC8KgCsD-2rQG-PiJIIHdlYjEwMDZfYWRzX2hrZzFfc3VwcGx5LXVtcF9wcm9kIgA\u003d\\/0\\/AA\u003d\u003d\\/7\\/9cc9b154\",adFormat:\"expandable\",__im_recordEventFun:\"im_9429_recordEvent\",__geo_lat:\"$GEO_LAT\",__geo_lng:\"$GEO_LNG\",__geo_cc:\"$GEO_CC\",__geo_zip:\"$GEO_ZIP\",__js_esc_geo_city:\"$JS_ESC_GEO_CITY\",openLandingPage:\"im_9429_openLandingPage\", __im_videoReferenceCallback: \"im_9429_videoRefCallback\", __use_secure:\"$SECURE\"!\u003d\u003d\"false\"?\"true\":\"false\", __site_pref: (\"$JS_ESC_SITE_PREFERENCES_JSON\".charAt(0) \u003d\u003d\u003d \"$\"? {} : JSON.parse(\"$JS_ESC_SITE_PREFERENCES_JSON\"))}};var _sproutReadyEvt\u003ddocument.createEvent(\"Event\");_sproutReadyEvt.initEvent(\"sproutReady\",true,true);window.dispatchEvent(_sproutReadyEvt);var sr, sp\u003d\"/load/ZId1K5YF0gcSelgy.inmobi.html.js\", _Sprout_load\u003dfunction(){var e\u003ddocument.getElementsByTagName(\"script\"),e\u003de[e.length-1],t\u003ddocument.createElement(\"script\");t.async\u003d!0;t.type\u003d\"text/javascript\";((window[\u0027_Sprout\u0027][\u0027ZId1K5YF0gcSelgy\u0027][\u0027querystring\u0027][\u0027__use_secure\u0027]!\u003d\u003d\u0027false\u0027)?sr\u003d\"https://i.l.inmobicdn.net/studio\":sr\u003d\"http://i.l.inmobicdn.net/studio\");t.src\u003dsr+sp;e.parentNode.insertBefore(t,e.nextSibling)};\"0\"\u003d\u003d\u003dwindow[\"_Sprout\"][\"ZId1K5YF0gcSelgy\"][\"querystring\"][\"__im_sdk\"]||\"complete\"\u003d\u003d\u003ddocument.readyState?_Sprout_load():window.addEventListener(\"load\",_Sprout_load,!1)\u003c/script\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n","markupType":"html","expiry":3300,"metaInfo":{"creativeType":"unknown","iasEnabled":false}}],"requestId":"496584f6-015a-1000-f600-00d000000090"}


Code Alignment



+ Recent posts