steelersfan 38 Posted July 30, 2016 Report Share Posted July 30, 2016 I want to apply a proxy for users, only if they press a button. I am trying to figure the logic to allow the button to check if there is a proxy written in the text box provided, and if not set the proxy to "None". Is this even possible? Quote Link to post Share on other sites
pash 504 Posted July 30, 2016 Report Share Posted July 30, 2016 Not sure if I understand correctly. on load("Bot Loaded") { set(#UseProxy,$false,"Global") } ui button("Use Proxy") { set(#UseProxy,$true,"Global") } ui button("Un-Use Proxy") { set(#UseProxy,$false,"Global") } ui stat monitor("Use Proxy: ",#UseProxy) loop(10) { if(#UseProxy) { then { change proxy("127.0.0.1:80") } else { change proxy("None") } } navigate("http://www.ubotstudio.com/resources","Wait") wait for browser event("Everything Loaded","") } 1 Quote Link to post Share on other sites
deliter 203 Posted July 30, 2016 Report Share Posted July 30, 2016 comment("you'll need to have a command to launch your original code,put it after the change proxy command,so that if the user clicks run,it runs,it they click UI button they change proxy and it also runs") ui button("load proxy") { set(#fullProxy,$prompt("Type full proxy ip:port"),"Local") if($comparison(#fullProxy,"!= Does not equal",$nothing)) { then { change proxy(#fullProxy) } } } 1 Quote Link to post Share on other sites
steelersfan 38 Posted August 1, 2016 Author Report Share Posted August 1, 2016 I was thinking of having the change proxy command in a define, then having the button only activate the change proxy command, if there is something written into the UI (tied to the proxy variable), by the user. Quote Link to post Share on other sites
steelersfan 38 Posted August 1, 2016 Author Report Share Posted August 1, 2016 I used the method deliter provided (thanks to you both by the way!), but is there any way to ensure that an actual proxy is input? if($comparison(#proxy,"!= Does not equal",$nothing)) { then { change proxy(#proxy) wait(1) navigate("http://whatismyipaddress.com/","Wait") wait for browser event("Everything Loaded","") } else { change proxy("None") alert("No Proxy Being Used! (click ok to continue)") } } This way does not account for an incomplete proxy (or even improper information), is there any way to ensure a proper proxy is input? Quote Link to post Share on other sites
Brutal 164 Posted August 2, 2016 Report Share Posted August 2, 2016 You could have the bot navigate to a place like whatismyip.com and set the displayed ip into a variable, and as long as the ip there is the same one loaded into your proxy change, then the proxy is verified, else, it failed. Get me? Edit: My bad, I didn't look at your code example. Quote Link to post Share on other sites
steelersfan 38 Posted August 4, 2016 Author Report Share Posted August 4, 2016 Still looking for a way to ensure that a proper proxy is input, perhaps by character length? Not sure... Quote Link to post Share on other sites
deliter 203 Posted August 4, 2016 Report Share Posted August 4, 2016 If you have aymans http post plugin there is a proxy check function,if not you can make a function to say navigate to a site,or better yet a script SRC ,like the SRC for jquerry,so it is fast not loading an entire page,if document text contains "jquery" then start,if contains 404 eror(or whatever that URL error is,then reject,ask user to input another proxy,or continue without proxyYou could also use a headless browser in new browser window for even faster check https://code.jquery.com/jquery-1.10.2.js 1 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.