Bot-Factory 602 Posted June 3, 2014 Report Share Posted June 3, 2014 Hello. Here is a simple example how to load a cookie from the browser into a variable and use it with the HTTP plugin: ui button("Browser") { BrowserCookie() } ui button("Http Get") { httpgetbutton() } define BrowserCookie { clear cookies navigate("http://www.html-kit.com/tools/cookietester/", "Wait") run javascript("document.cookie=\"username=MyPersonalCookie\";") navigate("http://www.html-kit.com/tools/cookietester/", "Wait") set(#cookie, $eval("var x = document.cookie; x;"), "Global") } define httpgetbutton { plugin command("HTTP post.dll", "http container") { plugin command("HTTP post.dll", "http cookiecontainer mode", "Basic") plugin command("HTTP post.dll", "http cookies string", "{#cookie}HTTPGET") set(#httpget, $plugin function("HTTP post.dll", "$http get", "http://www.html-kit.com/tools/cookietester/", $plugin function("HTTP post.dll", "$http useragent string", "Chrome 32.0 Win7 64-bit"), "", "", ""), "Global") load html(#httpget) } }Using this technique on a live website is much harder thing to do. Depending on the website, they could use techniques to prevent session stealing. Sometimes they encrypt the IP adress into a cookie. Which still would work. But they could also use other variables. Sometimes you need to scrape something from the website and combine that with the cookie to login. So the technique to move a cookie from the browser to http plugin and the other way around is really simple. But knowing which cookies to store and what you have to change / manipulate is the tricky part. Dan 4 Quote Link to post Share on other sites
jamesfar 15 Posted June 3, 2014 Report Share Posted June 3, 2014 How to use the cookie back to the browser if we used new browser node? Quote Link to post Share on other sites
Bot-Factory 602 Posted June 3, 2014 Author Report Share Posted June 3, 2014 How to use the cookie back to the browser if we used new browser node?It's in the example: run javascript("document.cookie=\"username=MyPersonalCookie\";") Just replace the text with the variable where you have the cookies stored. Dan Quote Link to post Share on other sites
Marton 48 Posted June 4, 2014 Report Share Posted June 4, 2014 Nice example Dan! I like the cookie tester site. One tiny observation: I don't think you need to declare the variable "x" in the javascript, simply doing this should be enough: set(#cookie, $eval("document.cookie;"), "Global") I have a question, maybe you know the answer to this. Shouldn't each "http container" have its own separate cookies? I deleted the "http cookies string" command, but the cookies seem to be used for the next "http get" function too. Look at this: http://www.screencast.com/t/wyXMesE1 Clear Cookies command from the plugin doesn't seem to help either. Thanks,Marton EDIT: adding this to the container seems to "clear" the cookies, but I still don't get why the two containers share the cookies: plugin command("HTTP post.dll", "http cookies string", "") Quote Link to post Share on other sites
ptlrc 2 Posted June 4, 2014 Report Share Posted June 4, 2014 load cookie to http post works, but load cookie to ubot browser not works for me Quote Link to post Share on other sites
Marton 48 Posted June 4, 2014 Report Share Posted June 4, 2014 load cookie to http post works, but load cookie to ubot browser not works for me It's working well, make sure you are using the latest HTTP Post plugin (v 2.5.1.0). Quote Link to post Share on other sites
ptlrc 2 Posted June 4, 2014 Report Share Posted June 4, 2014 thanks for your quick reply, and please help me out again i do have the latest http post plugin . what i am trying is to save a ubot browser cookie , and then i can use it next time. i have tested in this way: after login ubot forum in ubot browser manuallythen run the following code set(#cookie, $eval("var x = document.cookie;x;"), "Global")clear cookiesnavigate("http://www.ubotstudio.com/forum/", "Wait")wait for browser event("Everything Loaded", "")wait(2)run javascript("document.cookie=\"{#cookie}\";")navigate("http://www.ubotstudio.com/forum/", "Wait") it is not logged in when navigate ubot forum Quote Link to post Share on other sites
Bot-Factory 602 Posted June 4, 2014 Author Report Share Posted June 4, 2014 The important cookies are probably set to HTTPOnly. That means you can not read them via JavaScript. Not sure how the http plugin handles them. Have to ask Aymen.Dan Quote Link to post Share on other sites
noname 2 Posted May 17, 2015 Report Share Posted May 17, 2015 helloi couldn't figure the java script part outhow would i go about loading a cookie like this into the browser not HTTP pluginbut ubot browser IOUASTR=Mozilla%2F%35.%30+%28Windows+NT+%36.%33%3B+rv%3A%33%36.%30%29+Gecko%2F%32%30%31%30%30%31%30%31+Firefox%2F%33%36.%30datr=ANEzVckgJ9qz6o1IpovWLtaq; Path=/; Domain=facebook.com; HttpOnly; Max-Age=63071995; Expires=Tue, 18-Apr-2017 16:00:18 GMTc_user=100004947046093; Path=/; Domain=facebook.com; Secure; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTfr=0xMBM316SSivqpESh.AWUIZ8Y7Mlsx5DdfRrvZ1P96wzQ.BVM9ER._I.AAA.0.AWW4NdSn; Path=/; Domain=facebook.com; HttpOnly; Max-Age=7775995; Expires=Sat, 18-Jul-2015 16:00:18 GMTxs=154%3AcOg-1_7HV-P69Q%3A2%3A1429459217%3A5943; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTcsm=2; Path=/; Domain=facebook.com; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTlu=RgmB6H9WkHtsrIUSRZTW_Fbw; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=63071995; Expires=Tue, 18-Apr-2017 16:00:18 GMTs=Aa7pnFTbtOB43gwW.BVM9ER; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMT Quote Link to post Share on other sites
Bot-Factory 602 Posted May 18, 2015 Author Report Share Posted May 18, 2015 helloi couldn't figure the java script part outhow would i go about loading a cookie like this into the browser not HTTP pluginbut ubot browser IOUASTR=Mozilla%2F%35.%30+%28Windows+NT+%36.%33%3B+rv%3A%33%36.%30%29+Gecko%2F%32%30%31%30%30%31%30%31+Firefox%2F%33%36.%30datr=ANEzVckgJ9qz6o1IpovWLtaq; Path=/; Domain=facebook.com; HttpOnly; Max-Age=63071995; Expires=Tue, 18-Apr-2017 16:00:18 GMTc_user=100004947046093; Path=/; Domain=facebook.com; Secure; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTfr=0xMBM316SSivqpESh.AWUIZ8Y7Mlsx5DdfRrvZ1P96wzQ.BVM9ER._I.AAA.0.AWW4NdSn; Path=/; Domain=facebook.com; HttpOnly; Max-Age=7775995; Expires=Sat, 18-Jul-2015 16:00:18 GMTxs=154%3AcOg-1_7HV-P69Q%3A2%3A1429459217%3A5943; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTcsm=2; Path=/; Domain=facebook.com; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMTlu=RgmB6H9WkHtsrIUSRZTW_Fbw; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=63071995; Expires=Tue, 18-Apr-2017 16:00:18 GMTs=Aa7pnFTbtOB43gwW.BVM9ER; Path=/; Domain=facebook.com; Secure; HttpOnly; Max-Age=251972866777; Expires=Sat, 01-Jan-10000 06:59:59 GMT That's not possibe (http only).Dan Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.