我想我已经超越了我的头脑,我的问题可能过于笼统,但希望有人可以指出我正确的方向。
我试图对我们基于网络的监控应用程序(WhatsUpGold)中使用的URL进行反向工程,以通过python脚本禁用对主机的监控。我已经使用Charles向我显示帖子的URL和数据,但我无法使用python-requests
(由于我缺乏python和网络知识)。
当您点击“停用”按钮时,这是发布到服务器的数据。按钮,双重urlencoded(我已更改用户,IP和主机):
__DIALOG_OUT_PARAM.MB_ANSWER=DISABLE_%3A1&__DIALOGRESULT=-1&__DIALOGCLOSING=DlgM
essageBox.asp&__FORMID=%7BB1F8B816-52D1-463E-8669-44C01E276FC5%7D&DlgDevicePrope
rtiesActiveMonitors.oListActiveMonitors=1&_isDirty=true&DlgDevicePropertiesActiv
eMonitors.DIALOGRETURNURL=%2FNmConsole%2FDeviceManagement%2FDlgDeviceProperties%
2FDlgDevicePropertiesSummary%2FDlgDevicePropertiesSummary.asp&DlgDevicePropertie
sActiveMonitors.SAVEDFORMSTATE=%253cSavedFormState%253e%253cFormVariables%253e%2
53coElement%2520sName%3D%2522ShowAspFormDialog.VISITEDFORM%2522%2520sValue%3D%25
22visited%2522%2F%253e%253coElement%2520sName%3D%2522_isDirty%2522%2520sValue%3D
%2522false%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesSummary
.DIALOGRETURNURL%2522%2520sValue%3D%2522%2FNmConsole%2F%24Nm%2FCore%2FForm-AspFo
rms%2Finc%2FShowAspFormDialog.asp%2522%2F%253e%253coElement%2520sName%3D%2522Dlg
DevicePropertiesSummary.SAVEDFORMSTATE%2522%2520sValue%3D%2522%25253cSavedFormSt
ate%25253e%25253cFormVariables%25253e%25253coElement%252520sName%3D%252522__VIEW
STATE%252522%252520sValue%3D%252522%2525253cViewState%2F%2525253e%0D%0A%252522%2
F%25253e%25253c%2FFormVariables%25253e%25253cQueryStringVariables%2F%25253e%2525
3c%2FSavedFormState%25253e%2522%2F%253e%253coElement%2520sName%3D%2522DlgDeviceP
ropertiesSummary.VISITEDFORM%2522%2520sValue%3D%2522visited%2522%2F%253e%253coEl
ement%2520sName%3D%2522__VIEWSTATE%2522%2520sValue%3D%2522%25253cViewState%25253
e%25253coElement%252520sName%3D%252522DlgDevicePropertiesSummary.sNote%252522%25
2520sValue%3D%252522This%252520device%252520was%252520cloned%252520from%252520th
e%252520device%252520%27server1%27%252520on%2525207%2F3%2F2013%25252010%3A51%3A0
5%252520AM.%252522%2F%25253e%25253coElement%252520sName%3D%252522DlgDeviceProper
tiesSummary.nDeviceID%252522%252520sValue%3D%2525222096%252522%2F%25253e%25253co
Element%252520sName%3D%252522DlgDevicePropertiesSummary.nBestStateID%252522%2525
20sValue%3D%2525224%252522%2F%25253e%25253coElement%252520sName%3D%252522DlgDevi
cePropertiesSummary.sDeviceTypeName%252522%252520sValue%3D%252522RedHat%252522%2
F%25253e%25253coElement%252520sName%3D%252522DlgDevicePropertiesSummary.sHostNam
e%252522%252520sValue%3D%252522server2%252522%2F%25253e%25253coElement%252520sNa
me%3D%252522DlgDevicePropertiesSummary.sNetworkAddress%252522%252520sValue%3D%25
252210.10.10.10%252522%2F%25253e%25253coElement%252520sName%3D%252522DlgDevicePr
opertiesSummary.sDisplayName%252522%252520sValue%3D%252522server2%252522%2F%2525
3e%25253coElement%252520sName%3D%252522DlgDevicePropertiesSummary.nWorstStateID%
252522%252520sValue%3D%2525224%252522%2F%25253e%25253coElement%252520sName%3D%25
2522DlgDevicePropertiesSummary.nSelectedProperty%252522%252520sValue%3D%252522-1
%252522%2F%25253e%25253coElement%252520sName%3D%252522DlgDevicePropertiesSummary
.nDeviceTypeID%252522%252520sValue%3D%25252235%252522%2F%25253e%25253coElement%2
52520sName%3D%252522bWriteRights%252522%252520sValue%3D%2525221%252522%2F%25253e
%25253coElement%252520sName%3D%252522DlgDevicePropertiesSummary.sWebUserName%252
522%252520sValue%3D%252522user1%252522%2F%25253e%25253c%2FViewState%25253e%0D%0A
%2522%2F%253e%253c%2FFormVariables%253e%253cQueryStringVariables%2F%253e%253c%2F
SavedFormState%253e&DlgDevicePropertiesSummary.VISITEDFORM=visited&DlgDeviceProp
ertiesActiveMonitors.VISITEDFORM=visited&__VIEWSTATE=%253cViewState%253e%253coEl
ement%2520sName%3D%2522DlgDevicePropertiesSummary.sNote%2522%2520sValue%3D%2522T
his%2520device%2520was%2520cloned%2520from%2520the%2520device%2520%27server1%27%
2520on%25207%2F3%2F2013%252010%3A51%3A05%2520AM.%2522%2F%253e%253coElement%2520s
Name%3D%2522DlgDevicePropertiesActiveMonitors.nDeviceID%2522%2520sValue%3D%25222
096%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesActiveMonitors
.bPollingOrder%2522%2520sValue%3D%25220%2522%2F%253e%253coElement%2520sName%3D%2
522DlgDevicePropertiesSummary.nDeviceID%2522%2520sValue%3D%25222096%2522%2F%253e
%253coElement%2520sName%3D%2522DlgDevicePropertiesSummary.nBestStateID%2522%2520
sValue%3D%25224%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesSu
mmary.sDeviceTypeName%2522%2520sValue%3D%2522RedHat%2522%2F%253e%253coElement%25
20sName%3D%2522DlgDevicePropertiesSummary.sHostName%2522%2520sValue%3D%2522serve
r2%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesSummary.sNetwor
kAddress%2522%2520sValue%3D%252210.10.10.10%2522%2F%253e%253coElement%2520sName%
3D%2522DlgDevicePropertiesSummary.sDisplayName%2522%2520sValue%3D%2522server2%25
22%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesActiveMonitors.nSele
ctedProperty%2522%2520sValue%3D%25222%2522%2F%253e%253coElement%2520sName%3D%252
2DlgDevicePropertiesSummary.nWorstStateID%2522%2520sValue%3D%25224%2522%2F%253e%
253coElement%2520sName%3D%2522DlgDevicePropertiesSummary.nSelectedProperty%2522%
2520sValue%3D%2522-1%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropert
iesSummary.nDeviceTypeID%2522%2520sValue%3D%252235%2522%2F%253e%253coElement%252
0sName%3D%2522bWriteRights%2522%2520sValue%3D%25221%2522%2F%253e%253coElement%25
20sName%3D%2522DlgDevicePropertiesActiveMonitors.sWebUserName%2522%2520sValue%3D
%2522user1%2522%2F%253e%253coElement%2520sName%3D%2522DlgDevicePropertiesActiveM
onitors.nNewMonitorIDCounter%2522%2520sValue%3D%25221%2522%2F%253e%253coElement%
2520sName%3D%2522DlgDevicePropertiesSummary.sWebUserName%2522%2520sValue%3D%2522
user1%2522%2F%253e%253c%2FViewState%253e%0D%0A
请求标题:
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0
Referer:https://whatsup.mydomain.com/NmConsole/CoreNm/DlgMessageBox/DlgMessageBox.asp
Host:whatsup.mydomain.com
Connection:keep-alive
Accept-Language:en-US,en;q=0.5
Accept-Encoding:gzip, deflate
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
我尝试使用以下代码发布它...它并没有失败,但它也没有发布。
auth = 'username:password'
url = 'https://whatsup.mydomain.com/NmConsole/DeviceManagement/DlgDeviceProperties/DlgDevicePropertiesActiveMonitors/DlgDevicePropertiesActiveMonitors.asp'
headers = {'accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8','content-type': 'application/x-www-form-urlencoded'}
payload = [code block above]
req = requests.post(url,payload,headers=headers,auth=auth)
我并不认为这是一个简单的答案......但也许是一些指向何处的指示。
谢谢, 胜者。
答案 0 :(得分:0)
我建议做
req = requests.post(url, data=json.dumps(payload),headers=headers,auth=auth)
我这里只发送有效载荷“make noise”,因为你没有具体说明你发送的内容。