Javascript



  • Hi, i need run a function maked in js but openbullet does't support this:

    BEGIN SCRIPT JavaScript
    var window = {};
    !function(r){"use strict";function e(r,e,n){var s,c,h,p,l,A,d,E,w,b=0,H=[],U=0,F=!1,S=[],m=[],y=!1;if(s=(n=n||{}).encoding||"UTF8",(w=n.numRounds||1)!==parseInt(w,10)||w<1)throw Error("numRounds must a integer >= 1");if(0!==r.lastIndexOf("SHA-",0))throw Error("Chosen SHA variant is not supported");if(A=function(e,n){return v(e,n,r)},d=function(e,n,t,o){var a;if("SHA-224"!==r&&"SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");for(a=15+(n+65>>>9<<4);e.length<=a;)e.push(0);for(e[n>>>5]|=128<<24-n%32,n+=t,e[a]=4294967295&n,e[a-1]=n/4294967296|0,t=e.length,n=0;n<t;n+=16)o=v(e.slice(n,n+16),o,r);if("SHA-224"===r)e=[o[0],o[1],o[2],o[3],o[4],o[5],o[6]];else{if("SHA-256"!==r)throw Error("Unexpected error in SHA-2 implementation");e=o}return e},E=function(r){return r.slice()},"SHA-224"===r)l=512,p=224;else{if("SHA-256"!==r)throw Error("Chosen SHA variant is not supported");l=512,p=256}h=f(e,s),c=g(r),this.setHMACKey=function(e,n,t){var o;if(!0===F)throw Error("HMAC key already set");if(!0===y)throw Error("Cannot set HMAC key after calling update");if(e=(n=f(n,s=(t||{}).encoding||"UTF8")(e)).binLen,n=n.value,t=(o=l>>>3)/4-1,o<e/8){for(n=d(n,e,0,g(r));n.length<=t;)n.push(0);n[t]&=4294967040}else if(e/8<o){for(;n.length<=t;)n.push(0);n[t]&=4294967040}for(e=0;e<=t;e+=1)S[e]=909522486^n[e],m[e]=1549556828^n[e];c=A(S,c),b=l,F=!0},this.update=function(r){var e,n,t,o=0,a=l>>>5;for(r=(e=h(r,H,U)).binLen,n=e.value,e=r>>>5,t=0;t<e;t+=a)o+l<=r&&(c=A(n.slice(t,t+a),c),o+=l);b+=o,H=n.slice(o>>>5),U=r%l,y=!0},this.getHash=function(e,n){var f,s,h,l;if(!0===F)throw Error("Cannot call getHash after setting HMAC key");switch(h=i(n),e){case"HEX":f=function(r){return t(r,p,h)};break;case"B64":f=function(r){return o(r,p,h)};break;case"BYTES":f=function(r){return a(r,p)};break;case"ARRAYBUFFER":try{s=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}f=function(r){return u(r,p)};break;default:throw Error("format must be HEX, B64, BYTES, or ARRAYBUFFER")}for(l=d(H.slice(),U,b,E(c)),s=1;s<w;s+=1)l=d(l,p,0,g(r));return f(l)},this.getHMAC=function(e,n){var f,s,h,w;if(!1===F)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=i(n),e){case"HEX":f=function(r){return t(r,p,h)};break;case"B64":f=function(r){return o(r,p,h)};break;case"BYTES":f=function(r){return a(r,p)};break;case"ARRAYBUFFER":try{f=new ArrayBuffer(0)}catch(e){throw Error("ARRAYBUFFER not supported by this environment")}f=function(r){return u(r,p)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, or ARRAYBUFFER")}return s=d(H.slice(),U,b,E(c)),w=A(m,g(r)),f(w=d(s,p,l,w))}}function n(){}function t(r,e,n){var t,o,a="";for(e/=8,t=0;t<e;t+=1)o=r[t>>>2]>>>8*(3+t%4*-1),a+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return n.outputUpper?a.toUpperCase():a}function o(r,e,n){var t,o,a,u="",i=e/8;for(t=0;t<i;t+=3)for(o=t+1<i?r[t+1>>>2]:0,a=t+2<i?r[t+2>>>2]:0,a=(r[t>>>2]>>>8*(3+t%4*-1)&255)<<16|(o>>>8*(3+(t+1)%4*-1)&255)<<8|a>>>8*(3+(t+2)%4*-1)&255,o=0;o<4;o+=1)u+=8*t+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-o)&63):n.b64Pad;return u}function a(r,e){var n,t,o="",a=e/8;for(n=0;n<a;n+=1)t=r[n>>>2]>>>8*(3+n%4*-1)&255,o+=String.fromCharCode(t);return o}function u(r,e){var n,t,o=e/8,a=new ArrayBuffer(o);for(t=new Uint8Array(a),n=0;n<o;n+=1)t[n]=r[n>>>2]>>>8*(3+n%4*-1)&255;return a}function i(r){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(r=r||{},e.outputUpper=r.outputUpper||!1,!0===r.hasOwnProperty("b64Pad")&&(e.b64Pad=r.b64Pad),"boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function f(r,e){var n;switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(r){case"HEX":n=function(r,e,n){var t,o,a,u,i,f=r.length;if(0!=f%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],i=(n=n||0)>>>3,t=0;t<f;t+=2){if(o=parseInt(r.substr(t,2),16),isNaN(o))throw Error("String of HEX type contains invalid characters");for(a=(u=(t>>>1)+i)>>>2;e.length<=a;)e.push(0);e[a]|=o<<8*(3+u%4*-1)}return{value:e,binLen:4*f+n}};break;case"TEXT":n=function(r,n,t){var o,a,u,i,f,s,c,h,p=0;if(n=n||[0],f=(t=t||0)>>>3,"UTF8"===e)for(h=3,u=0;u<r.length;u+=1)for(a=[],(o=r.charCodeAt(u))<128?a.push(o):o<2048?(a.push(192|o>>>6),a.push(128|63&o)):o<55296||57344<=o?a.push(224|o>>>12,128|o>>>6&63,128|63&o):(u+=1,o=65536+((1023&o)<<10|1023&r.charCodeAt(u)),a.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),i=0;i<a.length;i+=1){for(s=(c=p+f)>>>2;n.length<=s;)n.push(0);n[s]|=a[i]<<8*(h+c%4*-1),p+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=2,a="UTF16LE"===e||"UTF16LE"!==e&&!1,u=0;u<r.length;u+=1){for(o=r.charCodeAt(u),!0===a&&(o=(i=255&o)<<8|o>>>8),s=(c=p+f)>>>2;n.length<=s;)n.push(0);n[s]|=o<<8*(h+c%4*-1),p+=2}return{value:n,binLen:8*p+t}};break;case"B64":n=function(r,e,n){var t,o,a,u,i,f,s,c=0;if(-1===r.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=r.indexOf("="),r=r.replace(/\=/g,""),-1!==o&&o<r.length)throw Error("Invalid '=' found in base-64 string");for(e=e||[0],f=(n=n||0)>>>3,o=0;o<r.length;o+=4){for(i=r.substr(o,4),a=u=0;a<i.length;a+=1)u|=(t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(i[a]))<<18-6*a;for(a=0;a<i.length-1;a+=1){for(t=(s=c+f)>>>2;e.length<=t;)e.push(0);e[t]|=(u>>>16-8*a&255)<<8*(3+s%4*-1),c+=1}}return{value:e,binLen:8*c+n}};break;case"BYTES":n=function(r,e,n){var t,o,a,u,i;for(e=e||[0],a=(n=n||0)>>>3,o=0;o<r.length;o+=1)t=r.charCodeAt(o),u=(i=o+a)>>>2,e.length<=u&&e.push(0),e[u]|=t<<8*(3+i%4*-1);return{value:e,binLen:8*r.length+n}};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(r){throw Error("ARRAYBUFFER not supported by this environment")}n=function(r,e,n){var t,o,a,u,i;for(e=e||[0],o=(n=n||0)>>>3,i=new Uint8Array(r),t=0;t<r.byteLength;t+=1)a=(u=t+o)>>>2,e.length<=a&&e.push(0),e[a]|=i[t]<<8*(3+u%4*-1);return{value:e,binLen:8*r.byteLength+n}};break;default:throw Error("format must be HEX, TEXT, B64, BYTES, or ARRAYBUFFER")}return n}function s(r,e){return r>>>e|r<<32-e}function c(r,e,n){return r&e^~r&n}function h(r,e,n){return r&e^r&n^e&n}function p(r){return s(r,2)^s(r,13)^s(r,22)}function l(r){return s(r,6)^s(r,11)^s(r,25)}function A(r){return s(r,7)^s(r,18)^r>>>3}function d(r){return s(r,17)^s(r,19)^r>>>10}function E(r,e){var n=(65535&r)+(65535&e);return((r>>>16)+(e>>>16)+(n>>>16)&65535)<<16|65535&n}function w(r,e,n,t){var o=(65535&r)+(65535&e)+(65535&n)+(65535&t);return((r>>>16)+(e>>>16)+(n>>>16)+(t>>>16)+(o>>>16)&65535)<<16|65535&o}function b(r,e,n,t,o){var a=(65535&r)+(65535&e)+(65535&n)+(65535&t)+(65535&o);return((r>>>16)+(e>>>16)+(n>>>16)+(t>>>16)+(o>>>16)+(a>>>16)&65535)<<16|65535&a}function g(r){var e,t=[];if(0!==r.lastIndexOf("SHA-",0))throw Error("No SHA variants supported");switch(t=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428],e=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],r){case"SHA-224":break;case"SHA-256":t=e;break;case"SHA-384":case"SHA-512":t=[new n,new n,new n,new n,new n,new n,new n,new n];break;default:throw Error("Unknown SHA variant")}return t}function v(r,e,n){var t,o,a,u,i,f,s,g,v,U,F,S,m,y,R,B,k,T,C,L,Y,x=[];if("SHA-224"!==n&&"SHA-256"!==n)throw Error("Unexpected error in SHA-2 implementation");for(L=Number,F=E,S=w,m=b,y=A,R=d,B=p,k=l,C=h,T=c,Y=H,n=e[0],t=e[1],o=e[2],a=e[3],u=e[4],i=e[5],f=e[6],s=e[7],U=0;U<64;U+=1)x[U]=U<16?(v=1*U,new L(g=r.length<=v?0:r[v],v=r.length<=v+1?0:r[v+1])):S(R(x[U-2]),x[U-7],y(x[U-15]),x[U-16]),g=m(s,k(u),T(u,i,f),Y[U],x[U]),v=F(B(n),C(n,t,o)),s=f,f=i,i=u,u=F(a,g),a=o,o=t,t=n,n=F(g,v);return e[0]=F(n,e[0]),e[1]=F(t,e[1]),e[2]=F(o,e[2]),e[3]=F(a,e[3]),e[4]=F(u,e[4]),e[5]=F(i,e[5]),e[6]=F(f,e[6]),e[7]=F(s,e[7]),e}var H;H=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],"function"==typeof define&&define.amd?define(function(){return e}):"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(module.exports=e),exports=e):r.jsSHA=e}(window);
    "use strict";var _0x43ff=["ARRAYBUFFER","length","push","update","getHash","fYjhG","LnwHb","setUint32","ctrzX","wDKtS","charCodeAt","TpsJNEBijheNDRLdrSzflynvqtollSYE","buffer","OIIzR","getUint16","forEach","aZppU","max","min","Wihmu","dGugs"];!function(a,r){!function(r){for(;--r;)a.push(a.shift())}(++r)}(_0x43ff,104);var _0xa425=function(r,a){return _0x43ff[r-=0]},proofOfWork=function(x){var r=function(r,a){if("dGugs"===_0xa425("0x0")){for(var x=new jsSHA("SHA-256",_0xa425("0x1")),n=[],t=0;t<r[_0xa425("0x2")];t++)n[_0xa425("0x3")](r[t]);for(var e=0;e<a[_0xa425("0x2")];e++)n[_0xa425("0x3")](a[e]);return x[_0xa425("0x4")](new Uint8Array(n)),new Uint8Array(x[_0xa425("0x5")](_0xa425("0x1")))}for(var f=new jsSHA("SHA-256","ARRAYBUFFER"),_=[],i=0;i<r[_0xa425("0x2")];i++)_[_0xa425("0x3")](r[i]);for(var u=0;u<a.length;u++)_[_0xa425("0x3")](a[u]);return f[_0xa425("0x4")](new Uint8Array(_)),new Uint8Array(f[_0xa425("0x5")](_0xa425("0x1")))},i=function(r){return(r[0]<<24|r[1]<<16|r[2]<<8|r[3])>>>0},e=function r(x,n){if("VDUSg"!==_0xa425("0x6")){for(var t=[],e=0;e<x[_0xa425("0x2")];e++)t[_0xa425("0x3")](n(x[e],e));return new Uint8Array(t)}var f=[u(a),u(b)],_=f[0];return i(r(f[1],function(r,a){return r^_[a]}))},u=function(r){if("LnwHb"===_0xa425("0x7")){var a=new ArrayBuffer(4);return new DataView(a)[_0xa425("0x8")](0,r,!1),new Uint8Array(a)}for(var x=[],n=0;n<arr[_0xa425("0x2")];n++)x[_0xa425("0x3")](fn(arr[n],n));return new Uint8Array(x)},t=function(r){return i(e(u(r),function(r){return~r}))},f=function(r,a){if(_0xa425("0x9")==_0xa425("0x9")){var x=[u(r),u(a)],n=x[0];return i(e(x[1],function(r,a){return r^n[a]}))}var t=[A[swap[1]],A[swap[0]]];A[swap[0]]=t[0],A[swap[1]]=t[1]},_=function(r){if(_0xa425("0xa")==_0xa425("0xa")){for(var a=new Uint8Array(new ArrayBuffer(r[_0xa425("0x2")])),x=0;x<r.length;x++)a[x]=r[_0xa425("0xb")](x);return a}var t=new ArrayBuffer(4);return new DataView(t)[_0xa425("0x8")](0,n,!1),new Uint8Array(t)},o=_(_0xa425("0xc")),w=parseInt([!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[+[]]),A=_(x),h=new Uint8Array([A[0],A[1],A[2],A[3]]);0===i(h)&&(h=new Uint8Array([0,0,0,1]));for(var c=new DataView(r(o,h)[_0xa425("0xd")]),s=[],v=0;v<5;v++)_0xa425("0xe"),_0xa425("0xe"),s[_0xa425("0x3")]([c.getUint16(4*v)%x[_0xa425("0x2")],c[_0xa425("0xf")](4*v+2)%x[_0xa425("0x2")]]);s[_0xa425("0x10")](function(r){_0xa425("0x11")==_0xa425("0x11")?(r[0]=(f(r[0],w)%x[_0xa425("0x2")]+x[_0xa425("0x2")])%x.length,r[1]=((Math[_0xa425("0x12")](r[1],t(w))-Math.min(r[1],t(w)))%x[_0xa425("0x2")]+x.length)%x.length):(r[0]=(f(r[0],w)%x.length+x.length)%x.length,r[1]=((Math[_0xa425("0x12")](r[1],t(w))-Math[_0xa425("0x13")](r[1],t(w)))%x[_0xa425("0x2")]+x[_0xa425("0x2")])%x[_0xa425("0x2")])}),s[_0xa425("0x10")](function(r){if("TPzTw"===_0xa425("0x14")){for(var a=new Uint8Array(new ArrayBuffer(str[_0xa425("0x2")])),x=0;x<str[_0xa425("0x2")];x++)a[x]=str.charCodeAt(x);return a}var n=[A[r[1]],A[r[0]]];A[r[0]]=n[0],A[r[1]]=n[1]});for(var U=r(A,h),y=0,g=3;0<=g;g--)y=y<<8|U[g];return y>>>0};
    var result = proofOfWork("+7jHF4loEdO05Qt1rO11RQTuvDBENWeG");
    END SCRIPT -> VARS "result"
    

    the parameter of the function proofOfWork alternate every request, is possible to run this in openbullet?

    Note: Don't come to talk about selenium



  • The openbullet use the lib Jint how i update this in my mod? this lib have too much updates.



  • @ManoPlayBRL The easiest way would be to download the latest jint release and then compile the source using that. (And pray that it works)



  • If that doesn't work you can always make something external in node.js and use the shell block or make a simple local hosted api that OB calls to



  • note: was extremely easy and took 1min to setup with node.js. I believe this will require node.js as an NPM package is required to run this script.

    https://imgur.com/980ZzWr

    Super easy. Good luck 😄



  • @Pure I know it would be much simpler to make an API with nodejs but I was wondering if there was any chance of doing it directly with openbullet Still thanks for your reply.


Log in to reply