码迷,mamicode.com
首页 > 系统相关 > 详细

linux连接远程桌面

时间:2016-05-06 10:54:19      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/bin/env python3
#-*-encoding:utf-8-*-

import re
import os
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import http.cookiejar
 
filename = /tmp/cookie.txt

cookie = http.cookiejar.MozillaCookieJar(filename)
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie))
postdata = urllib.parse.urlencode({username : username,  userpwd : password}).encode(encoding=UTF8)

loginUrl = http://xxxx/login

result = opener.open(loginUrl,postdata)

cookie.save(ignore_discard=True, ignore_expires=True)

gradeUrl = http://xxxx

result = opener.open(gradeUrl)


‘‘‘以上是抓取网页数据,下面是筛选地址‘‘‘


file = result.read().decode(utf-8)
r = file.partition(所有已启用且异常)
file = r[2]

p=re.compile([a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2})
list_mac = p.findall(file)
p=re.compile([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}:[0-9]{4,5})
list_ip = p.findall(file)
p=re.compile(秘密)
list_user = p.findall(file)
ip_user = list(zip(list_ip, list_user))
name = dict(zip(list_mac, ip_user))
for i in name.values():
    user = i[1]
    ip = i[0]
    os.environ[user] = str(user)
    os.environ[ip] = str(ip)
    os.system(rdesktop -u ${user} -p password -a 16 -r clipboard:PRIMARYCLIPBOARD ${ip} &)

 

linux连接远程桌面

标签:

原文地址:http://www.cnblogs.com/hygs/p/5464588.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!