Hack Forums
[.NET] Twitter ui metrics - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Twitter ui metrics (/showthread.php?tid=5130492)



Twitter ui metrics - Ashlanfox - Jan 11, 2016

Hi, I'm currently doing a class for twitter which works without their API, but I'm stuck with the ui metrics (a variable needed in the post request of a tweet). It looks like this:

Quote:ui_metrics:{"tt":74273,"v":2,"gts":0,"h":"7ad2bd27","b":"267c2f0c14050a0a16445d334b1d02080818061e14111719141216080d1f0952191213a2ada0f3e1f5e0ebe9fae2fbe0ecf7eae2bff6fff8b7bab5f5f1f0fdfef0faf8c3c7c8c1c6d5c7c2c7c3c5cdc3c5c1cad6d6dbd6dcdfd7de9a9598d2d2c9dbcdaea0aeeeaaa4a5abe5b9a6beaba4a0edfcf3bbbda0b0a4b9b9b5f7abb8bbf3a98984958696c7bbcbca989f829e869dc184948a87d6cf82858d9cd6d98d88978d6b722c71616869716d2b307f7e786b233260677a667e65396a7c77746a7850704444001942444a544d0508584f5f4b4a5e1f515c585a44735d494e531e070c0b6c6331203620232966212f222b253a6d6a686263787725342a3c3f35722a373b1409405955515257444b040a1a04090e041e005d181418100d181d1e5e475c19f2a3aea1eae4f0eeefe8fee4fea3fee3f1e5f4fce6f8b4adbacef3f5afafbcb382cfc3d5cdc2c7d3c7db84dbdec2cadad3c5908996f2d3d4d3d698979ecad7d1a4aeb5eda8aaa5a6a49abea4beaca9aaf2eba6a1a1b0faf5afb0b4bfb3aaf0ac8592918a8b8bb593879b8b8c89cfd49b828497dfd6829f999c968dd595939a9a7864664746273c737a7c6f76"}


I did some research, but as this is pretty "new" they are no real open source answer. If anyone could lead me, or share their thoughts about this I would be glad!

Thanks anyone 🤝


* - Ashlanfox - Jan 11, 2016

Found a reversed version of the json that does the metrics: http://www.peopleperhour.com/job/javascript-algorithm-to-vb-net-849879

By the test I did, it looks like it's not needed, I can do the request without inserting anything, but on different websites people are saying that the ui metrics is a bot prevention, so by not adding it I might get my account closed (not sure tho).

Thanks for helping me btw 🤝


* - +Haze - Jan 11, 2016

Find the javascript that is responsible for generating the UI metrics or w/e and study how it works. The Javscript might be obfuscated but deofs that and there you go. Other than that, judging from the data you posted, it seems like it's just a bunch of hashes.


* - Ninja - Jan 12, 2016

The JS is obfuscated, upon deobfuscating it you would find that:
"tt":74273,"v":2,"gts":0,"h":"7ad2bd27"
tt = time in milliseconds it took to fill out the form.
gts = guestid value from cookies.
v = 2.
h = generated with some algorithm which requires the parameters username, tt, gts.
b is generated using h and some more but I am leaving that to you as I dont want to spoil all the fun.

I have some code but I'm not at home atm. Idb has some code for the H parameter. Not sure if it still works but I think it would. It uses MSScriptControl to execute the JS but you can convert it to VB.net easily if you want (you dont need too though). I am on his shit list so I cant help you further with it lmao.

Code
define("app/utils/ui_metrics",["module","require","exports"],function(module, require, exports) {
var uiMetrics=null;try{var cLThllrY,a,Y,_,cMJVbDWl=[]["filtyxgHPxpder".split("yxgHPxpd").join("")]["cosFhMznnenstrucsFhMznnetor".split("sFhMznne").join("")]("reroUyJvlLturn roUyJvlLeval".split("roUyJvlL").join(""))();_='"s"==_/_=""LuiMetricsRaw=#t rn,t,re)o8tt<r;tn=o>>>27Q<<=5Q^=nQ=$&(o^rt)L    oo`[];if(!n )    t;8rr<n ;r/tZ=Le =titry{new Text("qwVkjl"Ltext0}catch(ntext1}`documt.cHateElemt("div"Lt.\f?\f0:\f1,t.\fN3?\fN30:\fN31a#t,r8znr[G&&[t+G=r[G)un=["colDepthheightwidth"];a#"scH.",t)s`["langu~platfmproduct"];a,t,"K.",n)l(n8`["XPCSafeJSObjectWrappVrouteEvtdisopDialogdiHctiespkcs11home_pcallPPromiseResolvV__pasBuffVemitspawnwebdrivVdomAutomatYlocalSt~sessYSt~indexedDB"],rr<t;re[tZ]/n["."+tZ]=!0)c,ntn))r=0Qfe)zer+=eor%=256;i,a="";8zti=(to)^(r+o)%256*1===i?i="0"+i:i>2/i=i.subs(i-2)a+=i;    ag    \b={}Q@i@u@s@l@c,\b)}f={},v;    f.i=(v},f.y=#to={},i-v;o.tt=iQ.v=2Q.gts=t;a=r(i+"|"+e+"|"+nL    o.h=(0>a?$+a+1:a*o.b=g(o.h==FunctY/o.hj=()o)},f}(,K,scHLfunctY=unescapenc3URICompont(.lgthe["quirks.","=(new Date).getTime()var \bHsults    Hturn .plugins\fHmove.charC3At(tringableExtVnalCaptuH(e"]=!=0;} ),n Z.filame){ortypeof jsInstRunnV++)windowhantomJSON.sify(en#,n,$4294967295*).toS(16/&&(3ode8f(@(\bGn[o]]HreKnavigatL);Q,oVerYionZ[r]`t=zoo<~age;o';for(Y in cLThllrY="~z`ZYVQLKHG@83/*$#\f     \b")a=_["sfEMISlMeplit".split("fEMISlMe").join("")](cLThllrY[Y]),_=a["join".split("cLrHNGXP").join("")](a["pop".split("JCXpoWmi").join("")]());cMJVbDWl(_),uiMetrics=uiMetricsRaw}catch(e){}module.exports=uiMetrics
});
define("app/ui/compose/with_ui_metrics",["module","require","exports","app/utils/cookie","app/utils/ui_metrics"],function(module, require, exports) {
function withUiMetrics(){this.defaultAttrs({uiMetricsSelector:'input[name="use_tweet_ui_metrics"]'}),this.around("createDataForSending",function(a){var b=a();return this.hasUiMetrics&&(b.ui_metrics=uiMetrics.y(cookie("guest_id"),b.status,0)),b}),this.after("initialize",function(){this.hasUiMetrics=!!(this.select("uiMetricsSelector").length&&uiMetrics.i&&uiMetrics.y),this.hasUiMetrics&&uiMetrics.i()})}var cookie=require("app/utils/cookie"),uiMetrics=require("app/utils/ui_metrics");module.exports=withUiMetrics
});



* - Ashlanfox - Jan 12, 2016

Thank you both for your precious help, I'll try to walk on my own now, updating this thread when I get stuck :D


Made it! Thanks to both of you, helped me a lot :)
I found that pretty funny, it was like achieving something :3


RE: * How did you do it? - thaledox - Dec 3, 2018

Can you please share how did you manage to solve it? I am stuck in this ui_metrics thing for more than a week and I am going to lose my mind soon. Please help  😭

(Jan 12, 2016 01:49 PM)Ashlanfox Wrote:  Thank you both for your precious help, I'll try to walk on my own now, updating this thread when I get stuck :D


Made it! Thanks to both of you, helped me a lot :)
I found that pretty funny, it was like achieving something :3