├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── sensor.js └── sensors.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 gondone666 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # parse-sensor 2 | Akamai sensor parser and validator 3 | -------------------------------------------------------------------------------- /sensor.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | function parse_sensor(str) { 4 | const keys = { 5 | '-1,2,-94,-100,': 'key_ver', 6 | '-1,2,-94,-101,': 'user_agent', 7 | '-1,2,-94,-105,': 'events', 8 | '-1,2,-94,-102,': 'informinfo', 9 | '-1,2,-94,-108,': 'forminfo', 10 | '-1,2,-94,-110,': 'kact', 11 | '-1,2,-94,-117,': 'mact', 12 | '-1,2,-94,-111,': 'tact', 13 | '-1,2,-94,-109,': 'doact', 14 | '-1,2,-94,-114,': 'dmact', 15 | '-1,2,-94,-103,': 'pact', 16 | '-1,2,-94,-112,': 'vcact', 17 | '-1,2,-94,-115,': 'url', 18 | '-1,2,-94,-106,': 'vel', 19 | '-1,2,-94,-119,': 'aj', 20 | '-1,2,-94,-122,': 'mr', 21 | '-1,2,-94,-123,': 'sed', 22 | '-1,2,-94,-124,': 'chalenge_C', 23 | '-1,2,-94,-126,': 'chalenge_E', 24 | '-1,2,-94,-127,': 'chalenge_S', 25 | '-1,2,-94,-70,': 'nav_perm', 26 | '-1,2,-94,-80,': 'fpval', 27 | '-1,2,-94,-116,': 'fpval_hash', 28 | '-1,2,-94,-118,': 'o9', 29 | '-1,2,-94,-121,': 'sensor_hash' 30 | }; 31 | const vel=["ke_vel+1","me_vel+32", "te_vel+32", "doe_vel", "dme_vel", "pe_vel", "vel_sum", "ms_after_start1","init_time", "start_ts", "fpcf_td", "d2", "ke_cnt", "me_cnt", "d2/6", "pe_cnt", "te_cnt", "ms_after_start2", "ta", "n_ck", "abck", "abck_hash", "rVal", "rCFP", "fas"]; 32 | const uas=["xagg","psub","lang","prod","plen","pen","wen","den","z1","d3","availWidth","availHeight", "width","height","innerWidth","innerHeight","outerWidth","ua_hash","rnd","start_ts/2","loc"]; 33 | const mact={1:"mousemove", 2:"click", 3:"mousedown", 4:"mouseup"}; 34 | const tact={1:"touchmove", 2:"touchstart", 3: "touchend"} 35 | const pact={3:"pointerdown", 4:"pointerup"}; 36 | const kact={1:"keydown", 2:"keyup", 3:"keypress"}; 37 | const vcact={1:"visibilitychange",2:"onblur",3:"onfocus"}; 38 | let prev=0; 39 | let list={actions:{}}; 40 | let ta=0, ke_vel=0, me_vel=0, pe_vel=0, te_vel=0, doe_vel=0, dme_vel=0; 41 | for (let key in keys) { 42 | let param = str.substring(prev,str.indexOf(key,prev)); 43 | list[keys[key]]=param; 44 | prev=str.indexOf(key,prev)+key.length; 45 | if (param=="") continue; 46 | switch (keys[key]) { 47 | case "user_agent": 48 | const bd=param.match(/cpen(.*?)x12\:(\d+)/g,""); 49 | list["bd"]=bd[0]; 50 | const temp=param.replace(`,${bd[0]},`,"").split(",uaend,"); 51 | list["user_agent"]=temp[0]; 52 | const ua=temp[1].split(","); 53 | for (let i=0;i a - b).forEach((a)=>{ 144 | const ts=a-time; 145 | console.log(`[${ts}ms] - ${list.actions[a]}`); 146 | }) 147 | delete list.actions; 148 | console.log(list); 149 | if (ta-list["ta"]==0) console.log("TA check passed"); else console.log("TA check failed", ta, (ta-list["ta"])); 150 | if (list["ke_vel+1"]-ke_vel-1==0) console.log("KE_VEL check passed"); else console.log("KE_VEL check failed", ke_vel, (list["ke_vel+1"]-ke_vel)); 151 | if (list["me_vel+32"]-me_vel-32==0) console.log("ME_VEL check passed"); else console.log("ME_VEL check failed", me_vel, (list["me_vel+32"]-me_vel)); 152 | if (list["te_vel+32"]-te_vel-32==0) console.log("TE_VEL check passed"); else console.log("TE_VEL check failed", te_vel, (list["te_vel+32"]-te_vel)); 153 | if (list["pe_vel"]-pe_vel==0) console.log("PE_VEL check passed"); else console.log("PE_VEL check failed", pe_vel, (list["pe_vel"]-pe_vel)); 154 | if (list["doe_vel"]-doe_vel==0) console.log("DOE_VEL check passed"); else console.log("DOE_VEL check failed", doe_vel, (list["doe_vel"]-doe_vel)); 155 | if (list["dme_vel"]-dme_vel==0) console.log("DME_VEL check passed"); else console.log("DME_VEL check failed", dme_vel, (list["dme_vel"]-dme_vel)); 156 | if (list["vel_sum"]-ke_vel-me_vel-te_vel-pe_vel-doe_vel-dme_vel==0) console.log("VEL SUM check passed"); else console.log("VEL SUM check failed", dme_vel+doe_vel+ke_vel+me_vel+te_vel+pe_vel, (list["vel_sum"]-ke_vel-me_vel-te_vel-pe_vel-dme_vel-doe_vel)); 157 | if (list["start_ts"]%1e7-list["d3"]<2) console.log("D3 check passed"); else console.log("D3 check failed", list["start_ts"]%1e7-list["d3"]); 158 | let o9=parseInt(list["d3"]); 159 | for (let i=0;i<5;i++) { 160 | const a=parseInt(list["d3"].substring(list["d3"].length-1-i,list["d3"].length-i)); 161 | let t=a % 4; 162 | 2 == t && (t = 3); 163 | let e = String.fromCharCode(42 + t), m = "return a" + e + (a+1) + ";"; 164 | o9=new Function("a", m)(o9); 165 | } 166 | if (o9-list["o9"]==0) console.log("O9 check passed"); else console.log("O9 check failed", o9, list["o9"]-o9); 167 | } 168 | 169 | const sensors = JSON.parse(fs.readFileSync('sensors.txt')); 170 | 171 | for (sensor of sensors) { 172 | parse_sensor(sensor.sensor_data); 173 | } -------------------------------------------------------------------------------- /sensors.txt: -------------------------------------------------------------------------------- 1 | [{"sensor_data":"7a74G7m23Vrp0o5c9047301.54-1,2,-94,-100,Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36,uaend,12147,20030107,de-DE,Gecko,3,0,0,0,389318,1804197,1920,1040,1920,1080,1012,969,1920,,cpen:0,i1:0,dm:0,cwen:0,non:1,opc:0,fc:0,sc:0,wrc:1,isc:0,vib:1,bat:1,x11:0,x12:1,8325,0.802706120309,791145902098.5,loc:-1,2,-94,-101,do_en,dm_en,t_en-1,2,-94,-105,-1,2,-94,-102,-1,2,-94,-108,-1,2,-94,-110,0,1,393,1379,567;1,1,421,1368,560;2,1,478,1383,563;3,1,521,1391,572;4,3,2263,1400,570,-1;5,1,2309,1406,566;6,1,2367,1408,572;7,1,2422,1407,590;8,1,2446,1421,608;9,1,2478,1408,608;10,1,2508,1395,599;11,1,2533,1395,600;12,1,2545,1400,619;13,1,2568,1410,628;14,1,2573,1402,630;15,1,2606,1411,619;16,1,2641,1414,635;17,1,2656,1417,618;18,1,2696,1424,634;19,1,2724,1441,635;20,1,2749,1442,643;21,1,2773,1444,639;22,3,4485,1426,638,-1;23,1,4536,1425,626;24,1,4579,1428,637;25,1,4613,1442,640;26,1,4616,1452,642;27,1,4673,1436,659;28,1,4707,1423,670;29,1,4765,1426,686;30,1,4792,1431,694;31,1,4821,1429,701;32,1,4841,1445,706;33,1,4849,1456,706;34,1,4873,1466,704;35,1,4906,1464,700;36,1,4959,1470,704;37,1,5013,1487,717;38,1,5023,1489,699;39,1,5075,1502,690;40,1,5122,1484,702;41,1,5176,1472,692;42,1,5178,1457,709;43,1,5179,1448,724;44,1,5182,1431,734;45,1,5226,1428,742;46,3,6956,1425,732,-1;47,1,7006,1417,735;48,1,7065,1418,722;49,1,7118,1419,739;50,1,7158,1422,740;51,1,7165,1434,755;52,1,7172,1448,760;53,1,7217,1440,757;54,1,7239,1425,771;55,1,7253,1442,766;56,1,7288,1461,780;57,1,7288,1475,772;58,1,7288,1478,774;59,1,7344,1477,793;60,1,7361,1480,791;61,1,7400,1484,803;62,1,7412,1486,803;63,4,8980,1495,819,-1;64,1,8997,1478,838;65,1,9025,1472,843;66,1,9080,1490,860;67,1,9110,1492,877;68,1,9129,1495,869;69,1,9133,1509,866;70,1,9192,1511,885;71,1,9197,1527,884;72,1,9237,1519,896;73,1,9243,1530,904;74,1,9296,1546,914;75,1,9306,1546,896;76,1,9336,1556,900;77,1,9350,1541,882;-1,2,-94,-117,-1,2,-94,-111,0,138,-1,-1,-1;-1,2,-94,-109,0,138,-1,-1,-1,-1,-1,-1,-1,-1,-1;-1,2,-94,-114,-1,2,-94,-103,3,1324;-1,2,-94,-112,https://www.yeezysupply.com/-1,2,-94,-115,1,597366,32,138,138,0,597675,9350,0,1582291804197,8,16926,0,78,2821,3,0,9354,425476,0,49F45B6C098175075E66D6AEE5076F5B~-1~YAAQVHUWAuWaXl9wAQAAhdjwZwMRxV5JOUSaT01UGjNMcQIo9q6kz6feidC+pKZWE+Crlgc8brrhnU23Bnc/jf9V4NjAQG2VSY2T6fkVJSqlLNAFPBUBYGY5ERpj7zsALbkYls7PE8A4Id+MBwInc2tTNiHe3I6IKti7PeJK2Bvpu7rpvfmCKA1gzs4f8Wi2NEFhlQFOW8d1EBvuRtzCLD0bWgSa4y82OwWhoMKIV17lDS2GyDVEVLpslZd+ST9TvbySLG8FGrMulkzg3gOeJnOHFjPFUe/MUq+eA9V6rZZnpmlZSQqIY/+4dAb5hws=~-1~-1~-1,29868,426,-2055651255,30261693-1,2,-94,-106,1,3-1,2,-94,-119,29,32,33,113,32,18,14,7,9,5,5,4,9,315,-1,2,-94,-122,0,0,0,0,1,0,0-1,2,-94,-123,-1,2,-94,-124,-1,2,-94,-126,-1,2,-94,-127,11321144241322243122-1,2,-94,-70,-739578230;-1395479418;dis;,7,8;true;true;true;-60;true;24;24;true;false;-1-1,2,-94,-80,5591-1,2,-94,-116,45109045-1,2,-94,-118,167028-1,2,-94,-121,;8;8;0"}] --------------------------------------------------------------------------------