如何从Python访问DVWA登录页面

2024-10-06 12:37:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我想创建一个HTTP调用,其中包含指向localhost//dvwa的套接字/登录名.php. 如果我想要类似的场景www.google.com如何指向localhost/dvwa/登录名.php? 下面是我的代码和错误。我会非常感谢。在

import socket
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
target ="localhost//dvwa//login.php" #input("Enter URL:")"attack.samsclass.info"
s.connect((target,80))
#s.send(r"GET / HTTP/1.1\nHost:{}\n\n".format(target).encode())
print(s.recv(1024))
s.close()

This image shows the complete errorp


Tags: 代码comlocalhosthttptargetwww错误google
1条回答
网友
1楼 · 发布于 2024-10-06 12:37:36

以下代码片段可能对您有所帮助:

import socket
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
target ="localhost"
s.connect((target,80))
s.send(b"GET /dvwa/login.php HTTP/1.1\nHost:{}\n\n".format(target).encode())
print(s.recv(1024).decode())
s.close()

相关问题 更多 >