r/learnpython • • Feb 14 '20

Made a script that will clean your mess after death

Recently, there have been a rumor; a man deletes his friend's chrome history after his friend dead.

So, I decided to make a script that will be my buddy. My buddy will clean my chrome history and private files which I added their paths before. Being a very beginner on python, more or less, I think I achieved this project. You add the directories and set the time. On every startup, you will see your date on the screen for 10 secs. When the time comes and if you haven't set extra time on the program, it will delete your browser history and the paths you added. Also you can hide this paths too using windows superhiding method.

Here is the link: https://github.com/hasanaslan7/loyalbuddy

PS: As I said I consider myself as a beginner. If you have any opinions and arrangements on my code, I would be glad to hear them. Also, I couldn't convert this to an exe file. When I did it, I will share it on the same link.

426 Upvotes

109 comments sorted by

196

u/cj6464 Feb 14 '20

There's a python library that allows you to send text messages. Maybe a good idea for a next step would be to allow it to text you every morning and you have to reply within a day or so.

52

u/hasanaslan Feb 14 '20

İnteresting idea, thanks

113

u/Drogen24 Feb 14 '20

That's a good idea until he decides to automate the return texts and ends up living forever.

9

u/nzodd Feb 15 '20

Qin Shihuang wants to know your location.

5

u/stoph_link Feb 15 '20

This would actually work, long as the phone bill payments cease with death (assuming the text message auto reply cease once the phone is disconnected). It just might take a month or two before the phone is actually disconnected so the internet history can be deleted.

2

u/[deleted] Feb 15 '20

Erlich Blachman is alive somewhere

33

u/Shok3001 Feb 14 '20

Hey are you still alive?

18

u/[deleted] Feb 14 '20

idk lemme check... pinches myself

No, yeah, umm, I mean I think I'm alive.

5

u/[deleted] Feb 14 '20

"Hey am I still alive?"

22

u/mrkvicka02 Feb 14 '20

That's not a good idea cos you forget to reply one day and rip your data is gone.

6

u/Kerbart Feb 14 '20

I thought you meant that as a means to send messages from beyond the grave.

disappointed

2

u/[deleted] Feb 15 '20

That is EXACTLY what I thought. The thought of writing texts to be sent after I die made me feel a ‘Black Mirror’-type uneasiness....

10

u/yuhyuh_ Feb 14 '20

I’d say every week

4

u/cj6464 Feb 14 '20

Weekly is a good idea.

3

u/the_battousai89 lifelong beginner Feb 14 '20

Python noob. What library? Thanks!

3

u/cj6464 Feb 14 '20

It's more like a api to interface with a free texting app. It's called twilio and you can find the API and how to set it up. I don't have any tutorials on hand but it shouldn't be hard to find docs and stuff about it.

1

u/the_battousai89 lifelong beginner Feb 14 '20

This is perfect! Thanks for your help!

1

u/industrial_by_trade Feb 15 '20

Twilioquest is a game Twilio developed that teaches you how to use their API. I've haven't used it yet; just heard of it on podcasts.

2

u/[deleted] Feb 14 '20

How does it work? Sends a SMS? Or rather a message from an app like discord?

1

u/Noideal Feb 14 '20

there's also a feature in Gmail that sends a reply saying that your account is no longer active if you don't use it in a specific timeframe. may be a good alternative that doesn't require much babysitting.

79

u/thedeathringer0 Feb 14 '20

I make a machine so that ehen my heart stops it burns my house down and has all the speakers start playing all star by smash mouth

11

u/hasanaslan Feb 14 '20

*Execute Order 66 theme

46

u/[deleted] Feb 14 '20

Then you get sleep apnea and your heart momentarily stops in the middle of the night. Before you realize what's happened you're trapped in your burning house and wake to hear the line, "my world's on fire, how bout yours? That's the way I like it and I'll never get bored".

16

u/running_fridge Feb 14 '20

Well technically during sleep apnoea it's only your breathing that stops. Your heart keeps on beating so we good!

2

u/[deleted] Feb 14 '20

Oh snap! Bring on that app! Yeah, I was misinformed at some point, so thanks for the correction.

1

u/oblivion-age Feb 15 '20

I think eventually the heart would cease if there is no breathing so you're not completely wrong. What we need is an app to shock you automatically if you stop breathing.

3

u/[deleted] Feb 14 '20

If you created that machine and programmed it someone would complain that you hard-coded the song. /s

2

u/oblivion-age Feb 15 '20

Pipe it to elevators and department stores all around the world upon your death.

0

u/Vitaman02 Feb 14 '20

Exceptional. I like the concept.

0

u/[deleted] Feb 14 '20

[deleted]

4

u/thedeathringer0 Feb 14 '20

This is very dark i like the idea

2

u/NotDesperateEggplant Feb 15 '20

While listening to the best music humanity ever made so its a win win I guess

26

u/cellwall-999 Feb 14 '20

Pack the whole damn thing in tkinter.

You'll love it. Great tool btw.

3

u/hasanaslan Feb 14 '20

I will try, thanks

5

u/lovelysad69 Feb 14 '20

i thought tkinter was outdated

6

u/[deleted] Feb 14 '20

Ttk within tkinter has an updated look

2

u/cellwall-999 Feb 14 '20

How outdated?

11

u/lovelysad69 Feb 14 '20

looks ugly and archaic etc, pyqt5 is more modern looking

4

u/cellwall-999 Feb 14 '20

I know but I think tkinter works well with micro projects.

5

u/billsil Feb 14 '20

It’s workable, but it takes more code to do a crappier version of what you want. Might as well use a real GUI development tool that’s less work.

1

u/Yakhov Feb 15 '20

what so you think of kivy for mobile apps?

1

u/billsil Feb 15 '20

I personally don't like it. If I'm on a desktop, I want a real desktop program. I don't write code for phones.

1

u/Yakhov Feb 16 '20

I'm sticking to web apps for now. I just didn't realize I could get what I needed from the GPS through a browser. I think I spent more time looking for answers to if that was possible and getting led down the youtube and google rabbit holes of commercialized search bias that I couldn't make that connection. So many tools if you don't pose the search correctly you can spin your wheels for hours trying to figure out the best approach or mod to solve the problem and then it turns out it's already solved and you just didn't hit the right page.

3

u/[deleted] Feb 14 '20

[removed] — view removed comment

3

u/billsil Feb 14 '20

If you want to get technical, PyQt is free software, as in source code, not as it price if you don’t want to release your source code.

PySide2 is the best of both worlds. They’re 99.9% the same.

3

u/Mariavagh Feb 14 '20

What if you decide to make a coffee while your computer is starting up... You come back and it just performed a factory reset...

2

u/hasanaslan Feb 14 '20

You should set a week time. İn every startup it shows you your due date. So, don't let it approach less than 2 days

5

u/Lupin_17 Feb 14 '20

There is the cx_freeze package for converting a .py into a .exe

I don't know if it still exists,I used it a year ago...

3

u/hasanaslan Feb 14 '20

I'm using pyinstaller and up to today, it was fine. Just having an issue when trying to compile this script

8

u/atamicbomb Feb 14 '20

Great exercise, and will keep your family out, but I doubt the methods python uses make the data irretrievable. Thought TBH they could just get a warrant for google

19

u/Pineapple-Yetti Feb 14 '20

I figured it was more so your family dont find out your porn habits. Not hiding information from the police.

7

u/hasanaslan Feb 14 '20

Kind of. İf i could reach that level, i wouldn't post it here lol

4

u/a1brit Feb 14 '20

There's a similar small python repo / pypi package called 'secure-delete' that writes random data to disk in place of the file.

3

u/clarknova77 Feb 14 '20

Isn't that what the private browsing tab is for?

Does it still leave traces on your hard drive? I've got nothing to hide from the police. My wife, on the other hand, maybe :D

3

u/atamicbomb Feb 14 '20

Ah XD

14

u/Pineapple-Yetti Feb 14 '20

When I'm dead, I'm dead. The embarrassed ones will be my family lol.

1

u/turningsteel Feb 15 '20

Oh I just have a vat of muriatic acid tied above my workspace with an axe that will cut the rope if I don't login once per day. But this OP's way is good too.

1

u/bei60 Feb 18 '20

Do people know incognito exists?

2

u/Vitaman02 Feb 14 '20

Maybe make this run with a pacemaker that has wifi access and then when it detects your heart stopping for more than 10 minutes then it should send a ping to a webserver that deletes everything. I feel like I have gone too far with this project. Nice idea, looks interesting, keep it up! :)

2

u/hasanaslan Feb 14 '20

Ahahahaha cool

2

u/Arnz_3 Feb 14 '20

Maybe you can edit it so it deletes your files if you miss your alarm 2 days in a row

2

u/hasanaslan Feb 14 '20

Makes sense.

2

u/LeSUTHU Feb 15 '20

Can someone help me understand what the codex is being used for?

1

u/hasanaslan Feb 16 '20

I am not that good at hiding passwords on python. So, i wanted to store user's password in a simple file that can be read with text editor. But, if someone could find this file, instead of the password they will find meaningless characters. But my script understand this characters. That's why I wrote that function.

1

u/LeSUTHU Feb 16 '20

oh so this is sort of an encryption method so that only the computer can understand it. That's very cool

0

u/[deleted] Feb 15 '20

[deleted]

1

u/LeSUTHU Feb 16 '20

tbh, I don't think I understand fully but still this helped me get like a slight idea of what it is. Thxs

0

u/[deleted] Mar 01 '20

[deleted]

1

u/LeSUTHU Mar 03 '20

Yeah I really get it now. It kinda feels like the Caesar cipher thing. It's really nice and thanks a lot for the thorough explanation.

2

u/B166er_ Feb 15 '20

I was thinking on something similar to this but instead of a date, it would be a simple action that you have to do when you startup. There is a time limit for doing the action, if the action is not done all your files are deleted.

What could that simple action be? Uhmm, maybe opening a file/dir, maybe doing a particular movement with the mouse, maybe typing something in particular.

Edit: It doesn't need to stop on deleting files, maybe it could trigger a bot to post some things on a social network, liberate files from a private repository or whatever.

1

u/hasanaslan Feb 16 '20

Nice idea. But it needs more effort.

2

u/coolestdad92 Feb 15 '20

What are you having to hide you creepo

1

u/hasanaslan Feb 16 '20

The secret ingredient is crime

37

u/[deleted] Feb 14 '20

"He is not the hero we deserve,but the hero we need"

20

u/jess_611 Feb 14 '20

Can you make it just burn my entire phone?

13

u/o15i17 Feb 14 '20

It's not kinda possible, phone batteries didn't output high voltages to harm phone but maybe maybe somehow we can overload the battery and make it explode but there's no guarantee that it will destroy everything

60

u/jess_611 Feb 14 '20

We just need a Samsung Note 7 in that case...

1

u/billsil Feb 15 '20

Just run Waze. What a horrible app, even when it's not actively doing anything on Android. I had installed it the week before and used it once. I was driving, it was ~95 degrees, and I had to cool off my Samsung S6 by repeatedly burning my hand.

3

u/randomizeri Feb 14 '20

Maybe you could make a phone case or something lol

7

u/PM_me_ur_data_ Feb 14 '20

A cool extension to this that you could make to teach yourself how to work with APIs and webscraping would be to script the program to search local news websites and obituary pages for your name (and other identifying information, if you have a common name) and delete your history if it finds you dead.

3

u/Shadow_Road Feb 14 '20

Have you read Daemon?

1

u/PM_me_ur_data_ Feb 14 '20

Nope, although I just looked it up and it seems as dystopian as I'd expect for someone responding to a comment about a computer checking to see if you're dead or not.

2

u/Shadow_Road Feb 15 '20

It's pretty good

1

u/mekkr_ Feb 15 '20

Daemon is fucking fantastic.

1

u/Shadow_Road Feb 15 '20

Freedom is pretty badass too. I wish there was a third book in the series (or more).

1

u/mekkr_ Feb 15 '20

You should check out nexus by ramez naam, similar kind of vibe.

2

u/Shadow_Road Feb 15 '20

Looks good. I'll add it to my list.

1

u/mekkr_ Feb 15 '20

Enjoy :)

2

u/VitalYin Feb 14 '20

When it deletes does the files go to recycle bin?

0

u/hasanaslan Feb 14 '20

No, completely will be deleted

10

u/phillymjs Feb 14 '20

I would like to propose that you rename this project to Shovel Buddy, as that term has been around for a long time.

3

u/Puff_0 Feb 14 '20

Gotta love this idea.

3

u/ahmedmokhles Custom text Feb 14 '20

Made my day lmao

2

u/kellyjames436 Feb 14 '20

Very useful idea thanks for sharing

2

u/[deleted] Feb 14 '20

I had to re read the startup time thing three times. I think you should set it so if someone doesn't enter a certain code in 2 minutes the code deletes the files. So if your dead, the next person won't know that code and won't know what changed.

Great idea for a program!

2

u/pwnrzero Feb 14 '20

I'm going to show this to my brother and be like, "BEHOLD! This is what programmers do in their free time. That and DeepCreamPy from a year or two back are the Lord's work.

2

u/Barnard87 Feb 14 '20

Rimuru would be proud.

2

u/[deleted] Feb 14 '20

I hope you'd have feelings after death to make it work properly.

2

u/[deleted] Feb 14 '20

this is dark. but cool !

2

u/tarck Feb 14 '20

setting password is another option

2

u/torhne Feb 15 '20

What about Jail... lol...

1

u/dataBlockerCable Feb 14 '20

I work on a DR-like plan that I update periodically and document for a friend of mine with whom I trust my life and what to do with my assets should I pass. It's not complete because I've found that I have such a vast digital footprint and I have to constantly check to see if the site's behaviour is the same. I don't think there would ever be a script solution but this would definitely help for local machine purposes.

1

u/mitwilsch Feb 14 '20

Password services like LastPass offer a secondary/emergency access, you could send that off to a trusted relative/friend to take care of your accounts (Banks, social media, etc)

1

u/TheOneTrueDataSci Feb 14 '20

Maybe encrypt using asymmetric keys is better, that way you can always restore your data if a fuckup happens

1

u/thewindmage Feb 14 '20

So, I've thought of a potential flaw to account for. What happens if you die before the day you set it to expire, and someone comes along and gets your history before your python buddy has a chance to delete it?

2

u/h6nry Indentation Error: Feb 14 '20

There's a need for Webcam access and user identification here!

1

u/errorseven Feb 15 '20

A kill switch is only good if it can actually verify you are dead. I'd have it grab obituaries of local papers (everything is online these daya) and look for my name, it would also scan every page in case it's an Darwin award type death that was worthy of front page or 3rd page or somewhere. It would only do this if I hadn't checked in with whatever method I chose, in which case I'd prefer to have it backup and encrypt all my data before destroying it in case you know flight was delayed, or some reason that caused undue delay.

1

u/oblivion-age Feb 15 '20

So this is how the python community thinks, I am relieved.

1

u/ImReadyPutMeInCoach Feb 14 '20

BLAST MY CACHE!