欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python遠(yuǎn)程郵件控制電腦升級(jí)版

 更新時(shí)間:2019年05月23日 14:47:11   作者:王小濤_同學(xué)  
這篇文章主要為大家詳細(xì)介紹了python3.4遠(yuǎn)程控制電腦開(kāi)關(guān)機(jī),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

由于前邊Python3.4實(shí)現(xiàn)遠(yuǎn)程控制電腦開(kāi)關(guān)機(jī)寫的遠(yuǎn)程操控電腦,使用的POP登陸有使用頻率限制,導(dǎo)致非常被動(dòng),有時(shí)候郵件無(wú)法讀取,下面改用POST網(wǎng)易郵箱的方法,獲取郵件

import urllib.request as request
import http.cookiejar as cookiejar
import urllib.parse
import re
import smtplib
from email.mime.text import MIMEText
import time
import win32com.client
import win32con
import win32api
import os
cj = cookiejar.LWPCookieJar()
cookiesupport = request.HTTPCookieProcessor(cj)
opener = request.build_opener(cookiesupport, request.HTTPHandler)
request.install_opener(opener)
speak = win32com.client.Dispatch('SAPI.SPVOICE')
def Login(username, pwd):
 post_url = 'https://mail.163.com/entry/cgi/ntesdoor?df=mail163_letter&from=web&funcid=loginone&iframe=1&language=-1&passtype=1&product=mail163&net=c&style=-1&race=254_292_276_bj&uid='+ username + "@163.com"
 headers = {
 'Host': 'mail.163.com',
 'Origin': 'http://mail.163.com',
 'Referer': 'http://mail.163.com/',
 'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.39 Safari/537.36'
 }
 post_data = {'savelogin':'0',
 'url2': 'http://mail.163.com/errorpage/error163.htm',
 'username': username,
 'password': pwd
 }
 post_data = urllib.parse.urlencode(post_data).encode('gbk')
 req = request.Request(post_url, post_data, headers=headers)
 page = request.urlopen(req, timeout=20).read().decode('gb2312')
 sid = re.compile(r'sid=(.+?)&df').findall(page)[0]
 return sid
def check_email():
 mail_url = 'http://mail.163.com/js6/s?sid='+Login('******', '******')+'&func=mbox:listMessages&LeftNavRecieveMailClick=1&error=no%20Conext.module&mbox_folder_enter=1'
 mail_data = {
 'var': '<?xml version="1.0"?><object><array name="items"><object><string name="func">mbox:getAllFolders</string><object name="var"><boolean name="stats">true</boolean><boolean name="threads">false</boolean></object></object><object><string name="func">mbox:getFolderStats</string><object name="var"><array name="ids"><string>1,3,18</string></array><boolean name="messages">true</boolean><boolean name="threads">false</boolean></object></object><object><string name="func">mbox:listTags</string><object name="var"><boolean name="stats">true</boolean><boolean name="threads">false</boolean></object></object><object><string name="func">mbox:statMessages</string><object name="var"><array name="fids"><int>1</int><int>2</int><int>3</int><int>4</int><int>18</int><int>5</int></array><object name="filter"><string name="defer">19700101:</string></object></object></object><object><string name="func">mbox:statMessages</string><object name="var"><array name="fids"><int>1</int><int>2</int><int>3</int><int>4</int><int>18</int><int>5</int></array><object name="filter"><string name="defer">:20150617</string></object></object></object></array></object>'
 }
 mail_data = urllib.parse.urlencode(mail_data).encode('utf-8')
 req = request.Request(mail_url, mail_data)
 page = request.urlopen(req, timeout=20).read().decode('utf-8', 'ignore')
 subject = re.compile(r'<string name="subject">(.+?)</string>').findall(page)
 return (subject[len(subject)-1])
def send_email():
 user = '******@163.com'
 pwd = '*******'
 to = ['*****@163.com', '*****@139.com']
 msg = MIMEText('')
 msg['Subject'] = 'OK'
 msg['From'] = user
 msg['To'] = ','.join(to)
 s = smtplib.SMTP('smtp.163.com')
 s.login(user, pwd)
 s.sendmail(user, to, msg.as_string())
 s.close()
if __name__ == '__main__':
 while True:
 try:
  cmd = check_email()
  command1 = {'關(guān)機(jī)': 'shutdown -s -t 1',
   '重啟': 'shutdown -r',
   '關(guān)閉瀏覽器': 'taskkill /F /IM chrome.exe',
   '關(guān)閉QQ': 'taskkill /F /IM QQ.exe',
   '關(guān)閉qq': 'taskkill /F /IM QQ.exe',
   '關(guān)閉wifi': 'taskkill /F /IM kwifi.exe',
   '關(guān)閉音樂(lè)': 'taskkill /F /IM cloudmusic.exe',
   '打開(kāi)音樂(lè)': 'D:\\網(wǎng)易云音樂(lè)\\CloudMusic\\cloudmusic.exe',
   '打開(kāi)攝像頭': 'D:\\Python源碼\\攝像頭監(jiān)控.py',
   '打開(kāi)監(jiān)控': 'D:\\Python源碼\\winSpyon.py',
   '打開(kāi)QQ': 'D:\\騰訊QQ\\Bin\\QQ.exe',
   '打開(kāi)qq': 'D:\\騰訊QQ\\Bin\\QQ.exe',
   '打開(kāi)wifi': 'D:\\Chrome\\kwifi\\kwifi.exe',
   '打開(kāi)ss': 'D:\\代理服務(wù)器\\Shadowsocks-win-dotnet4.0-2.3\\Shadowsocks.exe'
   }
  if cmd in command1.keys():
  speak.Speak('計(jì)算機(jī)即將' + cmd)
  send_email()
  if cmd.find('打開(kāi)') == 0:
   win32api.ShellExecute(0, 'open', command1[cmd], '', '', 1)
   if cmd == '打開(kāi)音樂(lè)':
   time.sleep(35)
   win32api.keybd_event(17, 0, 0, 0)
   win32api.keybd_event(18, 0, 0, 0)
   win32api.keybd_event(32, 0, 0, 0)
   win32api.keybd_event(32, 0, win32con.KEYEVENTF_KEYUP, 0)
   win32api.keybd_event(18, 0, win32con.KEYEVENTF_KEYUP, 0)
   win32api.keybd_event(17, 0, win32con.KEYEVENTF_KEYUP, 0)
  else:
   os.system(command1[cmd])
  speak.Speak('計(jì)算機(jī)已經(jīng)' + cmd + ',任務(wù)執(zhí)行完畢!')
  time.sleep(60)
 except:
  time.sleep(120)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • django模板獲取list中指定索引的值方式

    django模板獲取list中指定索引的值方式

    這篇文章主要介紹了django模板獲取list中指定索引的值方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-05-05
  • 使用pyhon繪圖比較兩個(gè)手機(jī)屏幕大小(實(shí)例代碼)

    使用pyhon繪圖比較兩個(gè)手機(jī)屏幕大小(實(shí)例代碼)

    這篇文章主要介紹了使用pyhon繪圖比較兩個(gè)手機(jī)屏幕大小,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-01-01
  • python 實(shí)現(xiàn)12bit灰度圖像映射到8bit顯示的方法

    python 實(shí)現(xiàn)12bit灰度圖像映射到8bit顯示的方法

    這篇文章主要介紹了python 實(shí)現(xiàn)12bit灰度圖像映射到8bit顯示的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • 使用Pandas對(duì)數(shù)據(jù)進(jìn)行篩選和排序的實(shí)現(xiàn)

    使用Pandas對(duì)數(shù)據(jù)進(jìn)行篩選和排序的實(shí)現(xiàn)

    這篇文章主要介紹了使用Pandas對(duì)數(shù)據(jù)進(jìn)行篩選和排序的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • 在Python程序和Flask框架中使用SQLAlchemy的教程

    在Python程序和Flask框架中使用SQLAlchemy的教程

    SQLAlchemy為Python程序與SQL語(yǔ)句之間建立了映射,是Python操作數(shù)據(jù)庫(kù)的利器,這里我們將來(lái)看在Python程序和Flask框架中使用SQLAlchemy的教程,需要的朋友可以參考下
    2016-06-06
  • python爬蟲基本知識(shí)

    python爬蟲基本知識(shí)

    最近在做一個(gè)項(xiàng)目,這個(gè)項(xiàng)目需要使用網(wǎng)絡(luò)爬蟲從特定網(wǎng)站上爬取數(shù)據(jù),于是乎,我打算寫一個(gè)爬蟲系列的文章,與大家分享如何編寫一個(gè)爬蟲。下面這篇文章給大家介紹了python爬蟲基本知識(shí),感興趣的朋友一起看看吧
    2018-03-03
  • python利用Guetzli批量壓縮圖片

    python利用Guetzli批量壓縮圖片

    本篇文章主要介紹了python利用Guetzli批量壓縮圖片,詳細(xì)的介紹了谷歌的開(kāi)源圖片壓縮工具Guetzli,非常具有實(shí)用價(jià)值,需要的朋友可以參考下。
    2017-03-03
  • Python中導(dǎo)入模塊的幾種方式總結(jié)

    Python中導(dǎo)入模塊的幾種方式總結(jié)

    模塊就是用一堆的代碼實(shí)現(xiàn)了一些功能的代碼的集合,通常一個(gè)或者多個(gè)函數(shù)寫在一個(gè).py文件里,下面這篇文章主要給大家介紹了關(guān)于Python中導(dǎo)入模塊的幾種方式,需要的朋友可以參考下
    2022-12-12
  • Python中文編碼知識(shí)點(diǎn)

    Python中文編碼知識(shí)點(diǎn)

    在本篇文章里小編給大家分享了關(guān)于Python中文編碼的相關(guān)知識(shí)點(diǎn)以及對(duì)應(yīng)實(shí)例內(nèi)容,有興趣的朋友們學(xué)習(xí)下。
    2019-02-02
  • 詳解Python?itertools模塊中starmap函數(shù)的應(yīng)用

    詳解Python?itertools模塊中starmap函數(shù)的應(yīng)用

    starmap是一個(gè)非常有用的函數(shù),它屬于itertools模塊中的一部分,本文將詳細(xì)介紹starmap函數(shù)的作用、用法以及實(shí)際應(yīng)用場(chǎng)景,希望對(duì)大家有所幫助
    2024-03-03

最新評(píng)論