curl - 正确卷曲以复制wireshark捕获
问题描述
我正在尝试从wireshark捕获构建一个curl命令,但不知何故我无法让它工作。
对此有任何帮助吗?
捕获来自同步登录时间的 IP 摄像机的 Web 界面。
Expert Info (Chat/Sequence): PUT /netsdk/system/time/localTime?r=0.1618186405000 HTTP/1.1\r\n
Frame 6749975: 809 bytes on wire (6472 bits), 809 bytes captured (6472 bits) on interface \Device\NPF_{FD7BA0E5-2937-40C4-8217-058F53B4CECE}, id 0
Ethernet II, Src: ASUSTekC_d5:8f:cd (04:92:26:d5:8f:cd), Dst: 9c:a3:aa:36:19:12 (9c:a3:aa:36:19:12)
Internet Protocol Version 4, Src: 192.168.102.100, Dst: 192.168.103.10
Transmission Control Protocol, Src Port: 49497, Dst Port: 80, Seq: 1, Ack: 1, Len: 755
Hypertext Transfer Protocol
PUT /netsdk/system/time/localTime?r=0.9514279744997252 HTTP/1.1\r\n
[Expert Info (Chat/Sequence): PUT /netsdk/system/time/localTime?r=0.9514279744997252 HTTP/1.1\r\n]
Request Method: PUT
Request URI: /netsdk/system/time/localTime?r=0.9514279744997252
Request URI Path: /netsdk/system/time/localTime
Request URI Query: r=0.9514279744997252
Request URI Query Parameter: r=0.9514279744997252
Request Version: HTTP/1.1
Host: 192.168.103.10\r\n
Connection: keep-alive\r\n
Content-Length: 27\r\n
Accept: application/json, text/javascript, */*; q=0.01\r\n
DNT: 1\r\n
X-Requested-With: XMLHttpRequest\r\n
Authorization: Basic YWRtaW46bWF0cml4eDIw\r\n
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36\r\n
Content-Type: application/x-www-form-urlencoded\r\n
Origin: http://192.168.103.10\r\n
Referer: http://192.168.103.10/view.html\r\n
Accept-Encoding: gzip, deflate\r\n
Accept-Language: en-DE,en;q=0.9,de-DE;q=0.8,de;q=0.7,en-GB;q=0.6,en-US;q=0.5\r\n
Cookie: sync_time=true; usr=admin; juanipcam_lang=en; login=admin%2CXXXXXXX; pwd=XXXXXXX\r\n
\r\n
[Full request URI: http://192.168.103.10/netsdk/system/time/localTime?r=0.9514279744997252]
[HTTP request 1/1]
[Response in frame: 6750396]
File Data: 27 bytes
HTML Form URL Encoded: application/x-www-form-urlencoded
这是我到目前为止想出的,但它给了我一个错误
curl -v -H "Accept: application/json, text/javascript, */*;" -H "Content-Type: application/x-www-form-urlencoded" -X PUT --cookie "sync_time=true; usr=admin; juanipcam_lang=en; login=admin%2CXXXXXXX; pwd=XXXXXXX" http://admin:XXXXXXX@192.168.103.11/netsdk/system/time/localTime?r=0.1618186405000
错误:
* Expire in 0 ms for 6 (transfer 0x1dac8b0)
* Trying 192.168.103.11...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x1dac8b0)
* Connected to 192.168.103.11 (192.168.103.11) port 80 (#0)
* Server auth using Basic with user 'admin'
> PUT /netsdk/system/time/localTime?r=0.1618186405000 HTTP/1.1
> Host: 192.168.103.11
> Authorization: Basic YWRtaW46bWF0cml4eDIw
> User-Agent: curl/7.64.0
> Cookie: sync_time=true; usr=admin; juanipcam_lang=en; login=admin%2CXXXXXXX; pwd=XXXXXXX
> Accept: application/json, text/javascript, */*;
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< SERVER: nginx
< CONNECTION: close
< CONTENT-TYPE: text/json
< CONTENT-LENGTH: 153
< CACHE-CONTROL: no-cache
<
* Closing connection 0
{"requestMethod":"PUT","requestURL":"/netsdk/system/time/localTime","requestQuery":"r=0.1618186405000","statusCode":6,"statusMessage":"Invalid Document"}
解决方案
猜猜这个问题是针对我想要做的事情的:)像Magic 8 Ball这样的东西。哈!
不过我现在想通了。对于任何试图做同样的事情的人。跟随Curl给了我一个OK:
curl -v --header "Content-Type: application/x-www-form-urlencoded" -X PUT -d "\"2021-04-12T16:42:19 +02:00"\" http://admin:XXXXXXX@192.168.103.11/netsdk/system/time/localTime?r=0.9514279744997252
推荐阅读
- json - 从嵌套的 Json 字符串中检索 datalab_name
- scala - 没有 Encoder[Row] 类型的隐式参数
- javascript - 如何制作无限滑块
- c# - 如何保护 Web api 以验证客户端应用程序生成的 openid 令牌?
- reactjs - AG Grid 无限行模型不起作用 - 当它位于绘图行的中间时,无法让网格绘制行
- javascript - getByteFrequencyData 获取给定时间的准确数据
- flutter - 在 Dart 中访问 Firestore 数组
- android - 如何将 Koin ViewModel 注入移动到 Base 片段?
- java - 如何从android文件中获取真实的文件路径
- symfony - 在 makefile 命令上添加控制器名称