[英]How can I trace the source of HTML from a div while using a tool such as FireBug so that I can alter it in the backend?
[英]How can i login to this site with requests module in python based on the request headers i got from firebug tool?
GET /some/home.php HTTP/1.1
Host: 10.10.10.10
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://10.10.10.10/some/lverify.php
Cookie: PHPSESSID=98gngotqd668112db9e5u2emo0
Connection: keep-alive
這是HTML表格
<form action="lverify.php" method="post">
<fieldset>
<legend>Log in</legend>
<label for="login">Username</label>
<input id="user" class="uname" type="text" maxlength="55" name="user">
<div class="clear"></div>
<label for="password">Password</label>
<input id="hotel_pwd" class="pwd" type="password" maxlength="25" name="pwd">
<div class="clear"></div>
<div class="clear"></div>
<br>
<input class="button" type="Submit" value="Log in" style="margin: -20px 0 0 287px;" name="Submit">
</fieldset>
</form>
#!/usr/bin/python
import requests
payload = {'user': 'abc', 'pwd': '1234'}
r = requests.post("http://10.10.10.10/some/home.php", data=payload)
i am not unable to get it working
#!/usr/bin/python
import requests
payload = { 'user': 'abc', 'pwd': '1234', 'Submit' : 'Log in' }
r = requests.Session() ## use this object for any POST or GET from now on ##
login = r.post("http://10.10.10.10/some/home.php", data=payload)
您應該現在可以登錄。
如果不是,請嘗試在headers
使用“ User-Agent”和“ Referer”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.