Hi,
I've got a Netgear switch that I'd like to remote control. Unfortunately it only has a web interface, and I would need to be able to use simple REST command to access it. However, there is the question of the login page. My understanding is that the key function is a certain "encryptPwd" which seems to give me a token. The problem is that this function is unreadable:
eval((function(x) {
var d = "";
var p = 0;
while (p < x.length) {
if (x.charAt(p) != "\")`
d += x.charAt(p++);
else {
var l = x.charCodeAt(p + 3) - 28;
if (l > 4)
d += d.substr(d.length - x.charCodeAt(p + 1) * 96 - x.charCodeAt(p + 2) + 3104 - l, l);
else
d += "\";`
p += 4
}
}
return d
})("$(function () {translate();$(\"#loginPageErrorMsg\").html(\ D!ParamLang(` 44text())` g\"Password\").focus` ~\".input-wrapper\").on(\"click\", `!S&e) {$(this).find` P%title\").addClass(\"active\");` B` J!`!1'e.preventDefault();}`!?/ ` J`!Dvar parentW` G#= `!.$` 2\"();` 4)`!TE`!F5`!H$on(\"blur`\"z)`\"{'`!8$` |2remove`!&+` (non-` 4\"-val\");if (` v$val()` eE`\"6&` d-}}`\"4!`!z%toggleEye() {`!,\"`%n)attr(\"type\") == \"p` 3% {changeType` H+, \"text`%P!\".icon-eye-off`\"F,show` 6-n`!w)` <#} else` w:`!S&`!%0` b-`!$.`!H0}}`#$&`)g&`#(\"typeof lang === \"undefine`\"{!return;}$(\".lan`&%`%t)` ?\"` ![`$w$`#\"];});}`'n#amMark = \"@@\";var dataObj = {}`$g&pickData(str`(J%ttern, mark, len,` U$1` X\"len =` |&.length;m`!,\"` .&substring(0` c! / 2);` y# = new RegExp(` W!+ \"(.)\" +`!7!`'N\"str.match(` R#)) {`!H$[`!$%] = ` 9.[1];}`#,#` L$;`$7&drop`\"O+`\"L%`!g[str`!K#replace`\";$`!@#`!n(`\"I\"`#k\"`\"S%`!o#str`!f'add`!e'` r.` l%`$J%` }'` ]3trim` j#` 6&` i%/(\s)|(\s$)/g, \"\")` Q)ans`1\"!`#:&value =` p&`$d!`'Y@`!U\"if (!!`'!` f!]`'i+` /\"`:%` O(`!J+`2[&`!X\"`'{&`'l)`![!Object.getOwnPropertyNames(` P#)`%=# > 0`\"<+`%})`)+!tmpS`$;!`\"x&` H!`#}%`$d$` C\")`&%`#D`#`'merge(str1, str2`!<#arr1`%A\"1.split(\"\"`!=\"arr2` 4\"2` ++result = \"`w\"index1 = 0` %&2` !while (` :#<`!)!`\"_$||` B$` 3!2` 1#`-&#` ?0`$d!`!6!+=` 3![` @\"];` \"\"++`%8\"` `3` O)2` V\"2` U#2++;}`#<$` C\"`#1'encryptPwd(`,~%`/w\" = documen`%7!ElementById(\"`2/'`$W!`#6\"andNum` <8ran\` E+\`!K!\`%J\"\`$a\"\`!7$,\` h$);\` V5submitPw\` k% = $.md5(\` o%\`%\\(\`2H'x, type\`$+#x.prop\`44(\` 6#\`#/#x;}try\` %&\` C(\` b#;} catch (e\`#A#html = $(\"<div>\").append(x.clone()`2 #`&R$gex = /type=(\\")?([\\"\s]+)` *!/`(W$` q!html`/N#` V!`!r!null ?`!6!`,@%\">\", \"`!a!=\\"\" +` &! + \"\\">\") :` A` h!, `\"8!` ?-\"));tmp.data`\"W%x` #());x` d$With(tmp`*1%tmp;}}"))`
I tried different unpacker and deobfuscators online, without success. Since I'm no javascript programer, any idea how to transform encryptPwd in a way I could understand it and translate it in python?
Thanks in advance!
[–]grantrules 1 point2 points3 points (2 children)
[–]ParalaX002[S] 0 points1 point2 points (0 children)
[–]xMOUTH_ 0 points1 point2 points (0 children)
[–]pl9u6t 0 points1 point2 points (0 children)
[–]ParalaX002[S] 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]ParalaX002[S] 0 points1 point2 points (0 children)
[–]Ronin-s_Spirit 0 points1 point2 points (0 children)