[Tutor] where to start?
Sun, 28 Jan 2001 08:34:24 +0900
I am hesitant to post this, only because I know the code isn't very good.
Feel free to make constructive criticism.
The program requires another file called cookiesok.txt in the same directory
that contains a list of keywords (1 on each line) that identify acceptable
cookies. The keyword only needs to be a subset of acceptable cookie.
<offtopic>On the encryption side, I am not taking care of it in Python. You
might want to consider a program that creates encrypted, virtual disks from
files that you pre-allocate on your real drives. I use PGP (commercial
version), but I know there are others as well (and even one for Pocket PC).
Everything stored inside the file / virtual drive are encrypted, and a
password is required to mount it. Except for the password, it looks and acts
just like a normal disk.</offtopic>
import sys, os, string, time
f = open("cookiesok.txt", 'r')
ok = f.readlines()
#ls = os.listdir(sys.argv)
os.chdir("c:/Documents and Settings/tucker/Cookies/")
ls = os.listdir('.')
for i in ls:
flag = 0
for j in ok:
sf = string.find(string.lower(i), string.lower(j[:-1]))
if sf > -1:
flag = 1
if not flag:
print 'Cookie %s deleted.' % i
These opinions are my own.
> -----Original Message-----
> From: firstname.lastname@example.org [mailto:email@example.com]On Behalf Of
> Sent: Saturday, January 27, 2001 11:37 PM
> To: firstname.lastname@example.org
> Subject: RE: [Tutor] where to start?
> On Sat, 27 Jan 2001, Gregory Tucker wrote:
> > - A script that deletes web cookies not on my approved list. In
> IE 5 each
> > cookie is saved as a text file; the script searches each .txt
> filename for a
> > keyword and deletes those not found. This method is cookie
> blocking is not
> > effective within a single session, but less intrusive than
> other measures.
> Would you mind posting this one to the list. I've been thinking about
> doing something like this but I just haven't gotten around to it. I use
> Internet Junkbuster which prevents all unapproved cookies from ever being
> placed on my computer, but there are still a few that I'd like to get rid
> of at the end of each day for security purposes.
> One idea I've had is to take the cookies I want to keep and encrypt them
> somehow at the end of the day, and at the same time delete them from the
> cookies folder on Windows, thus preventing anyone using my computer to
> access password protected web sites that I have an account with. Then I
> could have another program that asked for a password before restoring the
> cookies. Just a few thoughts,
> Tutor maillist - Tutor@python.org