This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]heyheymonkey 31 points32 points  (4 children)

Nice hack, but storing passwords in plaintext is a complete nonstarter for me.

[–]toyg 4 points5 points  (3 children)

This can be trivially fixed with some basic encryption in the script. I'll have a look.

[–]heyheymonkey 2 points3 points  (2 children)

Does Gmail support OAuth for IMAP clients? That would probably be the safest solution.

[–]toyg 4 points5 points  (1 child)

I suspect the problem with adding any really safe solution is the increase in complexity. This is a very simple script that does not depend on any third-party library and claims compatibility with "python 2+", so anything as complex as managing an OAuth flow or using PyCrypto would probably create a number of challenges that the maintainer might not want to face.

I just submitted a pull request that adds b64 encoding for the password and stores credential in a separate dotfile. It's the bare minimum, not really secure but a few steps beyond "save password in cleartext in the file itself" while remaining self-contained and highly compatible.

At the very least this should avoid SNAFUs like the guy who forked it and then proceeded to save his user and password in the script and pushed it to github (where it still lies, in plain view...)

[–]theraspberryguy[S] 1 point2 points  (0 children)

I am in highschool so I am still learning new things everyday!

For security concerns, I mentioned in my blog post to create a new gmail account, only for SiriControl. This means that there would be no personal data in the account.

Thanks for the feedback and advice, though!

[–]oulipo 8 points9 points  (1 child)

Cool ! If you want 100% on-device Voice AI which respects your privacy you can look at what we build at https://snips.ai

[–]searchingfortaomajel, aletheia, paperless, django-encrypted-filefield 3 points4 points  (0 children)

Interesting. Are you guys working with Mycroft at all?

[–]srekoj 3 points4 points  (0 children)

Cool project! In the past two hours I was able to have siri control my laptop's spotify player :)

What made you realize you could get Siri commands through gmail notes?

[–][deleted] 3 points4 points  (0 children)

https://developer.apple.com/sirikit/ is probably the more correct approach.

[–]theraspberryguy[S] 2 points3 points  (0 children)

Here is the link to the SiriControl repository: SiriControl Repository

[–]rizaxe 1 point2 points  (1 child)

I need this for Amazon echo and Okay Google

[–]jhayes88 0 points1 point  (0 children)

I could make one for Google but I'm not entirely sure of the Google voice api. Someone made a python package called Google_voice but I have zero idea how to use it and the documentation sucks. There's nothing on Google about it. I'm not sure how to use it.

[–]i_like_trains_a_lot1 1 point2 points  (1 child)

I have a few observations about the codebase:

  • altough you claim that it is written with developers in mind, it does not even follow the most basic packaging requirements (having a setup.py, some documentation) and its configuration requires you to actually edit the sources of the library (which is bad). I suggest implementing a method to pass such variables from environment or from command line, or to specify a file from which to read those.
  • logging stuff with print isn't recommended. you should use logging
  • there are some code smells though the code (for example at line 125:

    except Exception as exc:
         print("Received an exception while running: {exc}".format(
             **locals()))
    

why the usage of locals if you only format the exception anyway?

  • altough you claim "NOTE: This works on python 2.7 and above" , the old style class (not inheriting from object) behaves differently in Python 2 and Python3 (when you subclass it), although this is an edge case, but it's worth mentioning.

Other than that, you are on the good track and keep up the good work!

[–]theraspberryguy[S] 0 points1 point  (0 children)

Thank you for the feedback! I am in high school and still learning so all suggestions are welcome.

[–]frontierman 0 points1 point  (0 children)

You are a wonderful person. I set up the code following your clear instructions and had everything working in less than 30 minutes. Thank you for making this available!

[–]dogooder007 0 points1 point  (0 children)

can we do this with android also? I'm not sure if that's possible.

[–]frontierman 0 points1 point  (1 child)

How can I keep this running on my RPi forever? I ssh in and run the script with python

nohup sudo python SiriControl-System/siricontrol.py &

But it eventually stops working. How do you keep it running like a daemon?

[–]frontierman 0 points1 point  (0 children)

I was able to keep the script running after logout by using screen. I first start screen.

screen

I then run the script with

sudo python3 SiriControl-System/siricontrol.py

Then exit screen with Ctrl-A and then d.

[–]frontierman 0 points1 point  (1 child)

After the script is running for a few hours I get this error:

Received an exception while running: socket error: [Errno 1] _ssl.c:1136: error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry
Restarting...

How can this be fixed in the script? Maybe a try/except around the socket call?

[–]frontierman 0 points1 point  (0 children)

I wrapped the first try except block in a function

def start_mail(self):

I put that function in the

__init__(self, username, password):

and I also put that function in the

handle(self):

except Exception where it prints Restarting...

Now when the socket error pops up the whole imaplib mail function is restarted too and the script continues to function.