十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
参考
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名申请、虚拟空间、营销软件、网站建设、合作网站维护、网站推广。
https://www.cnblogs.com/puyangsky/p/5326384.html
参考了网上很多博客拼出如下代码实现了登录ilom管理页面的登录
好像管理页面用了js渲染无法取到想的值未能实现巡检功能
#-*- coding:utf-8 -*-
import sys
from HTMLParser import HTMLParser
from bs4 import BeautifulSoup
from PyQt4.QtWebKit import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import requests
import re
url = "https://192.40.1.8/iPages/i_login.asp"
session = requests.session()
r = session.get(url,verify = False)
content = r.content
pattern = re.compile('"loginToken", ".*"')
match = re.findall(pattern, content)
strx = "".join(match)
xsrf = re.findall(r"\s\"(.*)\"",strx)
print (xsrf)
login_data = {
'loginToken': xsrf,
'username': "oper",
'password': "Aassw0rd1"
}
header1 = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.22 Safari/537.36 SE 2.X MetaSr 1.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language": "zh-CN,zh;q=0.8",
"Accept-Encoding": "gzip, deflate,sdch",
"Content-Type": "application/x-www-form-urlencoded",
# "X-Requested-With": "XMLHttpRequest",
"Content-Length": "81",
"Connection": "keep-alive",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
}
baseurl = "https://192.40.1.8/iPages/loginProcessor.asp"
content = session.post(baseurl, headers = header1, data = login_data,verify=False)
content1=session.get("https://192.40.1.8/iPages/ilomtree.asp",headers = header1,verify=False)
print (content1.content)
class Render(QWebPage):
def __init__(self,url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
self.loadFinished.connect(self._loadFinished)
self.mainFrame().load(QUrl(url))
self.app.exec_()
def _loadFinished(self, result):
self.frame = self.mainFrame()
self.app.quit()
url = 'view-source:https://192.40.1.8/iPages/ilomtree.asp'
r = Render(url)
html = r.frame.toHtml()
html = html.toUtf8()
html = unicode(html,'utf8','ignore')
print html