我就是那个很不起眼的Feather

此页保留~哈哈~ Mail: mailto:[email protected] BLOG: http://blog.sohu.com/members/andelf/


   1 from urllib import thishost,urlopen
   2 from time import time
   3 myip = thishost()
   4 myname = 'l_PwPUE~IBo<'
   5 mypass = 'k@?6SYhabQA4'
   6 def login(ip,username,password):
   7     logurl = r'http://172.31.1.21/ClientProcess.jsp?MsgType=0&LocalIP='+\
   8              ip+r'&username='+username+r'&password='+password
   9     f = urlopen(logurl).read()
  10     for i in f.split('&'):
  11         if i.startswith('loginKey'):
  12             a = i.replace('loginKey=','')
  13         elif i.startswith('username='):
  14             b = i.replace('username=','')
  15     if a and b:
  16         return (a, b)
  17     else: raise RuntimeError
  18 def logout(ip,cname,logkey):
  19     outurl = r'http://172.31.1.21/ClientProcess.jsp?MsgType=3&ISNNO=1021&LocalIP='+\
  20               ip+r'&UserName='+cname+r'&LoginKey='+logkey+'&isPNP=0&httpIP='+ip
  21     f = urlopen(outurl).read()
  22     if f.find('ipconfig=0')!= -1:
  23         return True
  24     else: return False
  25 print '*********Network Client For SXBCTV*********'
  26 print 'Program By Feather ([email protected])'
  27 print 'Now login to the server....'
  28 try:
  29     p = login(myip, myname, mypass)
  30 except:
  31     print 'Login Error, Check Connection Please!'
  32 if p:
  33     start = time()
  34     key = p[0]
  35     cname = p[1]
  36     print 'You are Login As %s ,The Key is %s' % (cname, key)
  37 else :
  38     print 'Login Error, Check Connection Please!'
  39 while True:
  40     cmd = raw_input("Type 'exit' While You Want To Disconnect: \n>>>")
  41     if cmd in ['exit', 'bye', 'quit', 'logoff', 'disconnect']:
  42         if logout(myip, cname, key):
  43             end = time()
  44             print 'Time Lasted(s):', end-start
  45             print "You've Disconnected from the Server!!" 
  46             raise SystemExit
  47         else:
  48             print 'Error occured......'
  49             raise SystemExit

["个人网页类"]