pixelit

Problem with Javascript when I use WinHTTP

6 posts in this topic

I have done scripts using _IE functions, but recently I saw WinHTTP and I thought it was a better way. The problem is that sometimes I have a javascript fuction which is "minified" that I need to read to send a POST request which the correct values. At first I though it was pointless but I am realising that a lot of javascript are minified. 

There are a lot of online tools that I could use to un-minified, even I could open a IE process, write the javascript code and eval de function.. but i would like to do it without IE.

Thanks!

Share this post


Link to post
Share on other sites



A way to un-minify is using IE, writing the javascript function and do a document.write(function.toString()). But it's pointless to avoid using IE and finally use it xD

 
 

Share this post


Link to post
Share on other sites

The problem can't be solved in general manner. Things are different from case to case. Sometimes it's easy to figure out what the javascript does and replicate the behavior in AutoIt, sometimes it's possible to execute javascript  code without IE particularly for clean code where generic functions are defined, and sometimes you can't use WinHTTP sensibly at all.
Latest case is very uncommon.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

The problem can't be solved in general manner. Things are different from case to case. Sometimes it's easy to figure out what the javascript does and replicate the behavior in AutoIt, sometimes it's possible to execute javascript  code without IE particularly for clean code where generic functions are defined, and sometimes you can't use WinHTTP sensibly at all.
Latest case is very uncommon.

What I tried to do is unminified and unpack, once that I have the source code I think I'll have a lot of chances. I could execute it or simply extracts the variables that I need and ask for the post request. I don't have an example at the moment, but it's as easy as that sometimes there is a function like javascript:login(username,password) which sends username, password and a random string. If I don't have the random string I cant replicate the behaviour.

 

I could use _IE and simply _IENavigate to the javascript function, but Winhttp is cleaner and faster and never crash.

Share this post


Link to post
Share on other sites

Well, finally I got a silly solution which is to use _IE as a unminifier of javavascript. It's makes no sense if the webpage uses a lot of javascript functions but it could be useful if you want to mostly avoid the use of IE.

 

I still can't believe that I can't deminify code when it's so simple to minify and unminify it using webpages:

to minify http://dean.edwards.name/packer/

to unminify http://jsbeautifier.org/

I am even considering unminify it by using one of these pages and use only winhttp.

P.S.: I try to avoid using too much IE because I don't know why but it's unestable and sometimes crash. Moreover, it seems that winhttp could be use from wine (linux) and I have some of my laptops with ubuntu.

Share this post


Link to post
Share on other sites

This is an example of what I am trying to unminify.

eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4.8=9(a){1 b=e f();1 c=4.g("*");5(1 i=0;i<c.6;i++){2(c.3.h(" ")>=0){1 d=c.3.k(" ");5(1 j=0;j<d.6;j++){2(d[j]==a){b.7(c)}}}l 2(c.3==a){b.7(c)}}m b}',23,23,'|var|if|className|document|for|length|push|getElementsByClassName|function|||||new|Array|getElementsByTagName|indexOf|||split|else|return'.split('|'),0,{}))

Because once it's is unminified I can get the function with a simple regexp.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now