Jump to content
UBot Underground

Searching for a way to clear the local storage


Recommended Posts

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!

Link to post
Share on other sites

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.com
2. 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 Error
Error: boost::filesystem::remove
Source: > > delete file
 
Would you tell me what am I doing wrong?
Link to post
Share on other sites

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/

Link to post
Share on other sites

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 by ubot_user
Link to post
Share on other sites

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?

Link to post
Share on other sites

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 by ubot_user
Link to post
Share on other sites

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...

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...