I have a program installed K9 Web Protection in my PC. It detects any changes made in the hosts file and blocks the access to that website. I have made these changes in my hosts file

::ffff: google.com www.google.com google.com www.google.com

Now what happens is, if I make changes in hosts file after once opening the website that is its cookie is stored then it does not display warning. but once I clear the cookies it detects the change and website does not open. Is there any way I can store a cookie file permanently and use it anytime? What I tried is I extended the lifetime of a cookie to 2050 and then copying the cookie.sqlite file from the c:users>acer>appdata>local>google>chrome>userdata>default to desktop and then clear the cookies of browser. Afterwards, I copied the desktop file to same directory but K9 again got hold of that.

  • Can I make a cookie permanent and store it at a different location and use it whenever I want?
  • Other links are opening but not Google, why?
  • You do understand Google has multiple IP addresses for their domains, and they can change, so your host solution shouldn’t be used. You should create an exception for a google. – Ramhound May 31 '18 at 16:31
  • @user3701825, that was a bad edit. Please don't abuse `code` for some highlighting. – Arjan Jun 1 '18 at 8:01
  • i have solved the problem what i did is i allowed google.com in k9 settings – Sudhir Sharma Jun 1 '18 at 8:02

Technically, the browser could indeed ignore the cookie's lifetime that the server has defined, which you already proved yourself. You might even be able to create some script that alters that .sqlite file without the need to copy it.

Such changes will make the browser send the cookie's name and value (but not its expiry date) to the server along with the next request. However, at that point it's up to the server:

  • Most cookies don't include much details at all, expect for some random unique id, which the server needs to know as well. So if, for example, the server has already removed that expired unique id from its database, it will not find a match with the cookie that the browser sent, and ignore it. Or it might recognize it, but still reject it as it knows better.

  • Some cookies might have a value that itself somehow declares an expiration date.

  • Many servers will refresh the cookie every now and then, or even in every response. So, even if the altered cookie was accepted, the browser might very well overwrite it with a new value and new expiration date as soon as that cookie was sent to the server and the server returned a new cookie.

I'd say chances for success are low, and very much depend on the website.

A .sqlite file is basically a SQL database, and maybe some update cookies set expires = ... where name = ... might do the trick, if the browser does not somehow secure its contents. You might also be able to change a "session" cookie into a permanent cookie by adding an expiry date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.