Windows Media 8 Encoding Utility 简介

博客主要介绍了Windows Media 8 Encoding Utility,这是一款与Windows系统相关的编码工具。
import socket # 目标服务器配置 SERVER_IP = "192.168.1.108" SERVER_PORT = 80 # 构造报文(注意保留原始格式中的转义字符) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:443\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Header>' # '<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:Username>linzihao</wsse:Username>' # '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' # 'Qtj7NStEy0jJamBcv7Oi1oU08Yw=' # '</wsse:Password>' # '<wsse:Nonce>Bbly9xla5Dy19zbcdPeWmQ==</wsse:Nonce>' # '<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' # '2025-10-30T05:46:37Z' # '</wsu:Created>' # '</wsse:UsernameToken>' # '</Security>' # '</s:Header>' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # 新报文内容(保持原始格式) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # # 完整的请求报文(包含认证头) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:5f2904695f2904a96b523a5a27b254da817bcd066a3da5c9\",nc=00000001,cnonce=\"5114C0217B52D2821F1C47269DE5453E\",opaque=\"64943214654649846565646421\",response=\"3e0f24492be6874cb69e1955868fbbab\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:06300469063004a9abd05593a8dd46cf654a949e09bcd19d\",nc=00000001,cnonce=\"E1E8051AAE6A37F8E1CC566BFE595431\",opaque=\"64943214654649846565646421\",response=\"d6bfcf48164f931d5cade139ca7db3b6\"\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>linzihao</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">cBbNASgvn13AWzfBYG/McefZH1o=</wsse:Password><wsse:Nonce>VBuDixHPQa5VhxUtRapNzg==</wsse:Nonce><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-10-31T03:46:58Z</wsu:Created></wsse:UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.1.108:80\r\n" # "User-Agent: Happytime onvif client V12.7\r\n" # "Content-Type: application/soap+xml; charset=utf-8; action=\"http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime\"\r\n" # "Content-Length: 1783\r\n" # "Connection: close\r\n" # "\r\n" # '<?xml version="1.0" encoding="UTF-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" ' # 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding" ' # 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' # 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' # 'xmlns:wsa="http://www.w3.org/2005/08/addressing" ' # 'xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ' # 'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' # 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ' # 'xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" ' # 'xmlns:tt="http://www.onvif.org/ver10/schema" ' # 'xmlns:tds="http://www.onvif.org/ver10/device/wsdl" ' # 'xmlns:trt="http://www.onvif.org/ver10/media/wsdl" ' # 'xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" ' # 'xmlns:tev="http://www.onvif.org/ver10/events/wsdl" ' # 'xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" ' # 'xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" ' # 'xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" ' # 'xmlns:pt="http://www.onvif.org/ver10/pacs" ' # 'xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" ' # 'xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" ' # 'xmlns:tse="http://www.onvif.org/ver10/search/wsdl" ' # 'xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" ' # 'xmlns:tac="http://www.onvif.org/ver10/accesscontrol/wsdl" ' # 'xmlns:tdc="http://www.onvif.org/ver10/doorcontrol/wsdl" ' # 'xmlns:tth="http://www.onvif.org/ver10/thermal/wsdl" ' # 'xmlns:tcr="http://www.onvif.org/ver10/credential/wsdl" ' # 'xmlns:tar="http://www.onvif.org/ver10/accessrules/wsdl" ' # 'xmlns:tsc="http://www.onvif.org/ver10/schedule/wsdl" ' # 'xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" ' # 'xmlns:tpv="http://www.onvif.org/ver10/provisioning/wsdl" ' # 'xmlns:ter="http://www.onvif.org/ver10/error" >' # '<s:Body>' # '<tds:GetSystemDateAndTime />' # '</s:Body>' # '</s:Envelope>' # ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.1.108\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"admin\",realm=\"Login to 595f962a6e49d8c157d1dea6218657f2\",qop=\"auth\",algorithm=MD5,uri=\"/onvif/device_service\",nonce=\"b252aWYtZGlnZXN0OjY0NDI1MzAwNDAw\",nc=00000001,cnonce=\"AEE942C585CA9337AA6C932729B168B3\",opaque=\"\",response=\"7641183682761179bf6925bc454c8e0e\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) http_request = ( "POST /onvif/device_service HTTP/1.1\r\n" "Host: 192.168.1.108\r\n" "Content-Type: application/soap+xml; charset=utf-8\r\n" 'Authorization: Digest username="admin",realm="Login to 595f962a6e49d8c157d1dea6218657f2",qop="auth",algorithm=MD5,uri="/onvif/device_service",nonce="b252aWYtZGlnZXN0OjY0NDM1NTA2Mjcw",nc=00000001,cnonce="AC6D5124A48ABF8A1A1EC1857CCE8DA9",opaque="",response="22c217025dd5b9f1f72502d639442203"\r\n' "Content-Length: 299\r\n" "\r\n" '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' ) try: # 创建TCP套接字 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((SERVER_IP, SERVER_PORT)) s.sendall(http_request.encode('utf-8')) print(f"已发送 {len(http_request)} 字节到 {SERVER_IP}:{SERVER_PORT}") # 接收响应(可选) response = s.recv(4096) print(f"收到响应: {response.decode('utf-8')}") except Exception as e: print(f"发送失败: {str(e)}") ——参考该实现,写一个python脚本,向192.168.123.213的2020端口发送onvif请求并获取响应,采用digest+wss认证,digest算法使用MD5,第一个请求报文如下: http_request = ( “POST /onvif/device_service HTTP/1.1\r\n” “Host: 192.168.137.213:2020\r\n” “Content-Type: application/soap+xml; charset=utf-8\r\n” “Content-Length: 299\r\n” “\r\n” ‘’ ‘<s:Envelope xmlns:s=“http://www.w3.org/2003/05/soap-envelope”>’ ‘<s:Body xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=“http://www.w3.org/2001/XMLSchema”>’ ‘’ ‘</s:Body>’ ‘</s:Envelope>’ ) 该报文为digest认证的第一个请求,脚本(客户端)收到响应后需要计算response,生成digest认证头(http头部),但是由于我要实现digest+wss,所以脚本(客户端)发的第二个请求报文不仅要在http头部带digest认证信息,还需要在xml消息体包含ws-usernametoken,即采用以下报文消息体: <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>linzihao</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">BWJszKy0GcqTl7CFmKSy07QWILU=</wsse:Password><wsse:Nonce>sUzM+nV8sN66RzShZEyJhw==</wsse:Nonce><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-11-07T06:18:56Z</wsu:Created></wsse:UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope> ——能不能实现该脚本
最新发布
11-08
import socket # 目标服务器配置 SERVER_IP = "192.168.137.128" SERVER_PORT = 2020 # 构造报文(注意保留原始格式中的转义字符) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:443\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Header>' # '<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' # '<wsse:Username>linzihao</wsse:Username>' # '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' # 'Qtj7NStEy0jJamBcv7Oi1oU08Yw=' # '</wsse:Password>' # '<wsse:Nonce>Bbly9xla5Dy19zbcdPeWmQ==</wsse:Nonce>' # '<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' # '2025-10-30T05:46:37Z' # '</wsu:Created>' # '</wsse:UsernameToken>' # '</Security>' # '</s:Header>' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # 新报文内容(保持原始格式) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?>' # '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">' # '<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' # '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>' # '</s:Body>' # '</s:Envelope>' # ) # # 完整的请求报文(包含认证头) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:5f2904695f2904a96b523a5a27b254da817bcd066a3da5c9\",nc=00000001,cnonce=\"5114C0217B52D2821F1C47269DE5453E\",opaque=\"64943214654649846565646421\",response=\"3e0f24492be6874cb69e1955868fbbab\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.137.128:2020\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"linzihao\",realm=\"TP-Link IP-Camera\",qop=\"auth\",algorithm=\"MD5\",uri=\"/onvif/device_service\",nonce=\"TP-Link IP-Camera:06300469063004a9abd05593a8dd46cf654a949e09bcd19d\",nc=00000001,cnonce=\"E1E8051AAE6A37F8E1CC566BFE595431\",opaque=\"64943214654649846565646421\",response=\"d6bfcf48164f931d5cade139ca7db3b6\"\r\n" # "Content-Length: 961\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:Username>linzihao</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">cBbNASgvn13AWzfBYG/McefZH1o=</wsse:Password><wsse:Nonce>VBuDixHPQa5VhxUtRapNzg==</wsse:Nonce><wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2025-10-31T03:46:58Z</wsu:Created></wsse:UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) http_request = ( "POST /onvif/device_service HTTP/1.1\r\n" "Host: 192.168.1.108:80\r\n" "User-Agent: Happytime onvif client V12.7\r\n" "Content-Type: application/soap+xml; charset=utf-8; action=\"http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime\"\r\n" "Content-Length: 1783\r\n" "Connection: close\r\n" "\r\n" '<?xml version="1.0" encoding="UTF-8"?>' '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" ' 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding" ' 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' 'xmlns:wsa="http://www.w3.org/2005/08/addressing" ' 'xmlns:ds="http://www.w3.org/2000/09/xmldsig#" ' 'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' 'xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" ' 'xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" ' 'xmlns:tt="http://www.onvif.org/ver10/schema" ' 'xmlns:tds="http://www.onvif.org/ver10/device/wsdl" ' 'xmlns:trt="http://www.onvif.org/ver10/media/wsdl" ' 'xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" ' 'xmlns:tev="http://www.onvif.org/ver10/events/wsdl" ' 'xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" ' 'xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" ' 'xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" ' 'xmlns:pt="http://www.onvif.org/ver10/pacs" ' 'xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" ' 'xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" ' 'xmlns:tse="http://www.onvif.org/ver10/search/wsdl" ' 'xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" ' 'xmlns:tac="http://www.onvif.org/ver10/accesscontrol/wsdl" ' 'xmlns:tdc="http://www.onvif.org/ver10/doorcontrol/wsdl" ' 'xmlns:tth="http://www.onvif.org/ver10/thermal/wsdl" ' 'xmlns:tcr="http://www.onvif.org/ver10/credential/wsdl" ' 'xmlns:tar="http://www.onvif.org/ver10/accessrules/wsdl" ' 'xmlns:tsc="http://www.onvif.org/ver10/schedule/wsdl" ' 'xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" ' 'xmlns:tpv="http://www.onvif.org/ver10/provisioning/wsdl" ' 'xmlns:ter="http://www.onvif.org/ver10/error" >' '<s:Body>' '<tds:GetSystemDateAndTime />' '</s:Body>' '</s:Envelope>' ) # http_request = ( # "POST /onvif/device_service HTTP/1.1\r\n" # "Host: 192.168.1.108\r\n" # "Content-Type: application/soap+xml; charset=utf-8\r\n" # "Authorization: Digest username=\"admin\",realm=\"Login to 595f962a6e49d8c157d1dea6218657f2\",qop=\"auth\",algorithm=MD5,uri=\"/onvif/device_service\",nonce=\"b252aWYtZGlnZXN0OjY0NDI1MzAwNDAw\",nc=00000001,cnonce=\"AEE942C585CA9337AA6C932729B168B3\",opaque=\"\",response=\"7641183682761179bf6925bc454c8e0e\"\r\n" # "Content-Length: 299\r\n" # "\r\n" # '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' # ) try: # 创建TCP套接字 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((SERVER_IP, SERVER_PORT)) s.sendall(http_request.encode('utf-8')) print(f"已发送 {len(http_request)} 字节到 {SERVER_IP}:{SERVER_PORT}") # 接收响应(可选) response = s.recv(4096) print(f"收到响应: {response.decode('utf-8')}") except Exception as e: print(f"发送失败: {str(e)}") )——POST /onvif/device_service HTTP/1.1 Host: 192.168.1.108 Content-Type: application/soap+xml; charset=utf-8 Content-Length: 299 <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>——把这个报文转代码中形式
11-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值