Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用netcat从POST请求中的文件发送二进制数据_Php_Post_Netcat - Fatal编程技术网

Php 使用netcat从POST请求中的文件发送二进制数据

Php 使用netcat从POST请求中的文件发送二进制数据,php,post,netcat,Php,Post,Netcat,嗯,我学了一点netcat。 我的服务器上有一个php脚本。 我使用nc-v xx.xxx.xxx.xx 9292然后获取http://xx.xxx.xxx.xx/myscript.php。我看到页面的输出。现在我需要发送一个二进制数据,该数据来自文件中的tcpdump。如前所述:我应该这样使用它: cat request | nc host port 但是当我尝试的时候 cat "/var/www/9292/123bytes" |nc xx.xxx.xxx.xx 9292 或 我收到以下错

嗯,我学了一点netcat。 我的服务器上有一个php脚本。 我使用
nc-v xx.xxx.xxx.xx 9292
然后
获取http://xx.xxx.xxx.xx/myscript.php
。我看到页面的输出。现在我需要发送一个二进制数据,该数据来自文件中的tcpdump。如前所述:我应该这样使用它:

cat request | nc host port
但是当我尝试的时候

cat "/var/www/9292/123bytes" |nc xx.xxx.xxx.xx 9292

我收到以下错误:

HTTP/1.1 400 Bad Request
Date: Wed, 29 Apr 2015 05:12:20 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 385
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Request header field is missing ':' separator.<br />
<pre>
</pre>
</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at ... Port 9292</address>
</body></html>

据我所见,所有标题中都有
。我还建议检查apache版本。如您所见,它比2.2.15旧。有什么建议吗?

我想主机标题中未替换的冒号正是它抱怨的地方。。
HTTP/1.1 400 Bad Request
Date: Wed, 29 Apr 2015 05:12:20 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 385
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Request header field is missing ':' separator.<br />
<pre>
</pre>
</p>
<hr>
<address>Apache/2.4.10 (Debian) Server at ... Port 9292</address>
</body></html>
POST /makeTemplate123.php HTTP/1.1
User-Agent: Cctv-Search/1.0
Content-Type: image/jpeg
Cache-Control: no-cache
Pragma: no-cache
Host: localhost:8050
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 2095

......JFIF.....`.`.....C......
......(.....1#%.(:3=<9387@H\N@DWE78PmQW_bghg>Mqypdx\egc...C......./../cB8Bcccccccccccccccccccccccccccccccccccccccccccccccccc........p.."......................................6......................!..1.A."Qa2q...B....#4Ccr......................................bytes
----1429512044467boundary--