- 论坛徽章:
- 0
|
import http,os
from http import client
input=open("pass.txt",'r')
authen_username="admin"
authen_password=input.readline()
header= {
"Accept": "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n",
"Accept-Language": "zh-cn\r\n",
"User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)\r\n",
"Accept-Encoding": "gzip, deflate\r\n",
"Host": "192.168.0.1\r\n",
"Connection": "Keep-Alive\r\n",
}
while(1):
con=client.HTTPConnection("192.168.0.1")
con.request("POST","/postlogin.xgi/",authen_username,authen_password,header)
r=con.getresponse()
if r.status==200:
print ("Success","\n")
else:
print ("Failed","\n")
con.close()
错误提示:TypeError: request() takes at most 5 positional arguments (6 given)
如果我去掉一个参数就显示socket.error: [Errno 10054] 远程主机强迫关闭了一个现有的连接。
为什么啊,我是个新手不明白希望大家不吝赐教
忘了说了我用的是python3.1 |
|