间接信息传递(可以发挥想象实现远程关机==)
import win32com.client
import urllib
import time
import sys,commands
import os
while 1:
(a,b) =urllib.urlretrieve('http://sites.google.com/site/chenlu/Home/MSG.txt?attredirects=0')
print a
time.sleep(30)
print b
try:
file=open(a,"r")
except IOError:
print >> sys.stderr, "File could not be opened"
sys.exit(1)
records=file.readlines()
for record in records:
fields=record.split()
if fields[0]=="OPEN":
massage="net send cs2c-chenlu %s"%(fields[1])
os.system(massage)
time.sleep(60)
file.close()
import urllib
import time
import sys,commands
import os
while 1:
(a,b) =urllib.urlretrieve('http://sites.google.com/site/chenlu/Home/MSG.txt?attredirects=0')
print a
time.sleep(30)
print b
try:
file=open(a,"r")
except IOError:
print >> sys.stderr, "File could not be opened"
sys.exit(1)
records=file.readlines()
for record in records:
fields=record.split()
if fields[0]=="OPEN":
massage="net send cs2c-chenlu %s"%(fields[1])
os.system(massage)
time.sleep(60)
file.close()