ubot_user 0 Posted August 25, 2014 Report Share Posted August 25, 2014 In Ubot Studio there is a "clear cookies" command available for a long time now. The problem is that it only deletes the cookies, not the local storage data. The local storage could be used to save data on the computer just like a cookie. So I was wondering if there is a way to clear it while the ubot is running. I found out that Ubot stores the local storage as files under a folder like %USERPROFILE%\AppData\Local\Temp\2b91-3z06-0348-c305\Local Storage\The folder like (2b91-3z06-0348-c305) is being created on every startup of Ubot. So actually the local storage is being cleared on every startup. But when a bot is running there is no way to delete the local storage files, because they are protected. This message appears: The process cannot access the file because it is used by another process. Could anybody tell me If it is possible to clear the storage somehow. Or at least would you tell me how to ask the ubot team to add support for such function. Thanks! Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 25, 2014 Report Share Posted August 25, 2014 You can use $get filesand pull that location to the Temp folder, and delete each of the files in a loop, or there is file folder management plugins in he forum to empty folder contents as well. Quote Link to post Share on other sites
ubot_user 0 Posted August 26, 2014 Author Report Share Posted August 26, 2014 Thanks for the reply, BotGuru! I tried to apply your suggestion with this bot: ui button("set") { run javascript(" localStorage.setItem('item', 'Local storage var'); document.write('local storage set');")} ui button("delete local storage") { delete file("C:\\Users\\john\\AppData\\Local\\Temp\\1d91-3c06-0348-c805\\Local Storage\\http_www.example.com_0.localstorage")} I did a test in this order:1. navigate to example.com2. click on "set" button. immediately I saw a file called "http_www.example.com_0.localstorage" in the "Local Storage" folder for the current bot instance.3. click on "delete local storage" button. After step 3 I got this error: Script ErrorError: boost::filesystem::removeSource: > > delete file Would you tell me what am I doing wrong? Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 26, 2014 Report Share Posted August 26, 2014 its an error caused from the delete function i havent seen before. it should work Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted August 26, 2014 Report Share Posted August 26, 2014 try to save this to a file.cmd@ECHO offDEL /F /S /Q %TEMP% then execute the file with shell command. this will clear your temp folder Quote Link to post Share on other sites
UBotDev 276 Posted August 26, 2014 Report Share Posted August 26, 2014 I don't think you'll be able to delete the file in question, since it's used/locked by UBot, so I think you two are headed of the track here (at least )... Also, I don't even think that the file you refer to contains data that you are looking for (I think it stores some internal data for threading and thing like that there). Instead I would suggest you refer to this thread: http://www.ubotstudio.com/forum/index.php?/topic/4183-how-to-delete-browser-cookies-when-the-ubot-clear-cookies-sub-does-not-work/ Quote Link to post Share on other sites
ubot_user 0 Posted August 27, 2014 Author Report Share Posted August 27, 2014 (edited) UBotDev is right. I can not delete this files when the bot is running even using "del" command. The post that UBotDev suggested looks very promising, but there is no way to delete the local storage via these commands either. I just tried them. Also the files in "Local Storage" contain the actual data that is saved using the local storage api. Edited August 27, 2014 by ubot_user Quote Link to post Share on other sites
UBotDev 276 Posted August 27, 2014 Report Share Posted August 27, 2014 Those commands always worked for me. You could maybe try to run CCleaner as well. Anyway, what data has been stored to your "computer" that you can't delete? Quote Link to post Share on other sites
ubot_user 0 Posted August 29, 2014 Author Report Share Posted August 29, 2014 (edited) Those commands do not clear local storage. Take for example this bot: ================ BOT STARTS HERE ======================ui button("set data in local storage") { run javascript(" localStorage.setItem('user_id', '123456'); document.write('The site just assigned you an ID');")}ui button("print the data from local storage") { run javascript(" if(localStorage.getItem('user_id')) \{ document.write(localStorage.getItem('user_id')); \} else \{document.write('no data found');\}")} ui button("clear the data in local storage") { run javascript("localStorage.clear();document.write('localstorage cleared');")} ================ BOT ENDS HERE ====================== If you click the button "set data in local storage" you can emulate a site that is assigning you an ID. To verify that this data is available in the local storage you could go to another site, than return to the current one and click "print the data from local storage" (Notice: for this example it does not matter which site you will open.) So obviously whenever you return to this site it could identify you. This could be accomplished with cookies also. The problem is that Ubot Studio can delete cookies, but can not delete local storage. The only way to delete it is to close the bot and reopen it again (or use javascript which is not convinient). I am trying to find a way to delete the local storage without closing and opening the bot and without using javascript. I am wondering if it is possible to start a bot with local storage disabled (like chrome.exe --disable-localstorage) or to execute a command against the chromium engine somehow? Can we access the chromium core? Edited August 29, 2014 by ubot_user Quote Link to post Share on other sites
UBotDev 276 Posted August 29, 2014 Report Share Posted August 29, 2014 Right, wasn't sure if you mean that or not....I think your only option is to use "in new browser" to use a fresh "browser" for each "session" (haven't tried it though)....I've tried with setting the user agent which re-initializes the browser, but the data is still there... EDIT: "in new browser" command solves the problem, just tested it here... 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.