{"id":582,"date":"2019-08-03T10:27:31","date_gmt":"2019-08-03T02:27:31","guid":{"rendered":"https:\/\/fick707.com\/?p=582"},"modified":"2019-08-03T10:27:31","modified_gmt":"2019-08-03T02:27:31","slug":"netcat","status":"publish","type":"post","link":"https:\/\/fick707.com\/?p=582","title":{"rendered":"netcat"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.oschina.net\/translate\/linux-netcat-command\">\u8f6c\u8f7d\u81ea\uff1ahttps:\/\/www.oschina.net\/translate\/linux-netcat-command<\/a><\/p>\n\n\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12876\" data-translated-paragraph-id=\"12989\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<p><a href=\"https:\/\/linux.die.net\/man\/1\/nc\">nc\u547d\u4ee4\u53c2\u8003\u624b\u518c<\/a><\/p>\n<p>\u00a0<\/p>\n<p><strong>netcat<\/strong>\u662f\u7f51\u7edc\u5de5\u5177\u4e2d\u7684\u745e\u58eb\u519b\u5200\uff0c\u5b83\u80fd\u901a\u8fc7TCP\u548cUDP\u5728\u7f51\u7edc\u4e2d\u8bfb\u5199\u6570\u636e\u3002\u901a\u8fc7\u4e0e\u5176\u4ed6\u5de5\u5177\u7ed3\u5408\u548c\u91cd\u5b9a\u5411\uff0c\u4f60\u53ef\u4ee5\u5728\u811a\u672c\u4e2d\u4ee5\u591a\u79cd\u65b9\u5f0f\u4f7f\u7528\u5b83\u3002\u4f7f\u7528netcat\u547d\u4ee4\u6240\u80fd\u5b8c\u6210\u7684\u4e8b\u60c5\u4ee4\u4eba\u60ca\u8bb6\u3002<\/p>\n<p><strong>netcat<\/strong>\u6240\u505a\u7684\u5c31\u662f\u5728\u4e24\u53f0\u7535\u8111\u4e4b\u95f4\u5efa\u7acb\u94fe\u63a5\u5e76\u8fd4\u56de\u4e24\u4e2a\u6570\u636e\u6d41\uff0c\u5728\u8fd9\u4e4b\u540e\u6240\u80fd\u505a\u7684\u4e8b\u5c31\u770b\u4f60\u7684\u60f3\u50cf\u529b\u4e86\u3002\u4f60\u80fd\u5efa\u7acb\u4e00\u4e2a\u670d\u52a1\u5668\uff0c\u4f20\u8f93\u6587\u4ef6\uff0c\u4e0e\u670b\u53cb\u804a\u5929\uff0c\u4f20\u8f93\u6d41\u5a92\u4f53\u6216\u8005\u7528\u5b83\u4f5c\u4e3a\u5176\u5b83\u534f\u8bae\u7684\u72ec\u7acb\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e9b\u4f7f\u7528netcat\u7684\u4f8b\u5b50.<\/p>\n<p>[A(172.31.100.7) B(172.31.100.23)]<\/p>\n<p>\u00a0<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12877\" data-translated-paragraph-id=\"12996\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<p>Linux netcat \u547d\u4ee4\u5b9e\u4f8b\uff1a<\/p>\n<h3>1\uff0c\u7aef\u53e3\u626b\u63cf<\/h3>\n<p>\u7aef\u53e3\u626b\u63cf\u7ecf\u5e38\u88ab\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u9ed1\u5ba2\u7528\u6765\u53d1\u73b0\u5728\u4e00\u4e9b\u673a\u5668\u4e0a\u5f00\u653e\u7684\u7aef\u53e3\uff0c\u5e2e\u52a9\u4ed6\u4eec\u8bc6\u522b\u7cfb\u7edf\u4e2d\u7684\u6f0f\u6d1e\u3002<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -z -v -n 172.31.100.7 21-25<\/span><\/pre>\n\u53ef\u4ee5\u8fd0\u884c\u5728TCP\u6216\u8005UDP\u6a21\u5f0f\uff0c\u9ed8\u8ba4\u662fTCP\uff0c-u\u53c2\u6570\u8c03\u6574\u4e3audp.\n<p>z \u53c2\u6570\u544a\u8bc9netcat\u4f7f\u75280 IO,\u8fde\u63a5\u6210\u529f\u540e\u7acb\u5373\u5173\u95ed\u8fde\u63a5\uff0c \u4e0d\u8fdb\u884c\u6570\u636e\u4ea4\u6362(\u8c22\u8c22@jxing \u6307\u70b9)<\/p>\n<p>v \u53c2\u6570\u6307\u4f7f\u7528\u5197\u4f59\u9009\u9879\uff08\u8bd1\u8005\u6ce8\uff1a\u5373\u8be6\u7ec6\u8f93\u51fa\uff09<\/p>\n<p>n \u53c2\u6570\u544a\u8bc9netcat \u4e0d\u8981\u4f7f\u7528DNS\u53cd\u5411\u67e5\u8be2IP\u5730\u5740\u7684\u57df\u540d<\/p>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u6253\u537021\u523025 \u6240\u6709\u5f00\u653e\u7684\u7aef\u53e3\u3002Banner\u662f\u4e00\u4e2a\u6587\u672c\uff0cBanner\u662f\u4e00\u4e2a\u4f60\u8fde\u63a5\u7684\u670d\u52a1\u53d1\u9001\u7ed9\u4f60\u7684\u6587\u672c\u4fe1\u606f\u3002\u5f53\u4f60\u8bd5\u56fe\u9274\u522b\u6f0f\u6d1e\u6216\u8005\u670d\u52a1\u7684\u7c7b\u578b\u548c\u7248\u672c\u7684\u65f6\u5019\uff0cBanner\u4fe1\u606f\u662f\u975e\u5e38\u6709\u7528\u7684\u3002\u4f46\u662f\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u670d\u52a1\u90fd\u4f1a\u53d1\u9001banner\u3002<\/p>\n<p>\u4e00\u65e6\u4f60\u53d1\u73b0\u5f00\u653e\u7684\u7aef\u53e3\uff0c\u4f60\u53ef\u4ee5\u5bb9\u6613\u7684\u4f7f\u7528netcat \u8fde\u63a5\u670d\u52a1\u6293\u53d6\u4ed6\u4eec\u7684banner\u3002<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\"> nc -v 172.31.100.7 21<\/span><\/pre>\nnetcat \u547d\u4ee4\u4f1a\u8fde\u63a5\u5f00\u653e\u7aef\u53e321\u5e76\u4e14\u6253\u5370\u8fd0\u884c\u5728\u8fd9\u4e2a\u7aef\u53e3\u4e0a\u670d\u52a1\u7684banner\u4fe1\u606f\u3002<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\u00a0<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12878\" data-translated-paragraph-id=\"12999\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>Chat Server<\/h3>\n<p>\u5047\u5982\u4f60\u60f3\u548c\u4f60\u7684\u670b\u53cb\u804a\u804a\uff0c\u6709\u5f88\u591a\u7684\u8f6f\u4ef6\u548c\u4fe1\u606f\u670d\u52a1\u53ef\u4ee5\u4f9b\u4f60\u4f7f\u7528\u3002\u4f46\u662f\uff0c\u5982\u679c\u4f60\u6ca1\u6709\u8fd9\u4e48\u5962\u4f88\u7684\u914d\u7f6e\uff0c\u6bd4\u5982\u4f60\u5728\u8ba1\u7b97\u673a\u5b9e\u9a8c\u5ba4\uff0c\u6240\u6709\u7684\u5bf9\u5916\u7684\u8fde\u63a5\u90fd\u662f\u88ab\u9650\u5236\u7684\uff0c\u4f60\u600e\u6837\u548c\u6574\u5929\u5750\u5728\u9694\u58c1\u623f\u95f4\u7684\u670b\u53cb\u6c9f\u901a\u90a3\uff1f\u4e0d\u8981\u90c1\u95f7\u4e86\uff0cnetcat\u63d0\u4f9b\u4e86\u8fd9\u6837\u4e00\u79cd\u65b9\u6cd5\uff0c\u4f60\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2aChat\u670d\u52a1\u5668\uff0c\u4e00\u4e2a\u9884\u5148\u786e\u5b9a\u597d\u7684\u7aef\u53e3\uff0c\u8fd9\u6837\u5b50\u4ed6\u5c31\u53ef\u4ee5\u8054\u7cfb\u5230\u4f60\u4e86\u3002<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -l 1567<\/span><\/pre>\n<p>netcat \u547d\u4ee4\u57281567\u7aef\u53e3\u542f\u52a8\u4e86\u4e00\u4e2atcp \u670d\u52a1\u5668\uff0c\u6240\u6709\u7684\u6807\u51c6\u8f93\u51fa\u548c\u8f93\u5165\u4f1a\u8f93\u51fa\u5230\u8be5\u7aef\u53e3\u3002\u8f93\u51fa\u548c\u8f93\u5165\u90fd\u5728\u6b64shell\u4e2d\u5c55\u793a\u3002<\/p>\n<p>Client<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc 172.31.100.7 1567<\/span><\/pre>\n\u4e0d\u7ba1\u4f60\u5728\u673a\u5668B\u4e0a\u952e\u5165\u4ec0\u4e48\u90fd\u4f1a\u51fa\u73b0\u5728\u673a\u5668A\u4e0a\u3002<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\u00a0<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12879\" data-translated-paragraph-id=\"13004\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>3\uff0c\u6587\u4ef6\u4f20\u8f93<\/h3>\n<p>\u5927\u90e8\u5206\u65f6\u95f4\u4e2d\uff0c\u6211\u4eec\u90fd\u5728\u8bd5\u56fe\u901a\u8fc7\u7f51\u7edc\u6216\u8005\u5176\u4ed6\u5de5\u5177\u4f20\u8f93\u6587\u4ef6\u3002\u6709\u5f88\u591a\u79cd\u65b9\u6cd5\uff0c\u6bd4\u5982FTP,SCP,SMB\u7b49\u7b49\uff0c\u4f46\u662f\u5f53\u4f60\u53ea\u662f\u9700\u8981\u4e34\u65f6\u6216\u8005\u4e00\u6b21\u4f20\u8f93\u6587\u4ef6\uff0c\u771f\u7684\u503c\u5f97\u6d6a\u8d39\u65f6\u95f4\u6765\u5b89\u88c5\u914d\u7f6e\u4e00\u4e2a\u8f6f\u4ef6\u5230\u4f60\u7684\u673a\u5668\u4e0a\u561b\u3002\u5047\u8bbe\uff0c\u4f60\u60f3\u8981\u4f20\u4e00\u4e2a\u6587\u4ef6file.txt \u4eceA \u5230B\u3002A\u6216\u8005B\u90fd\u53ef\u4ee5\u4f5c\u4e3a\u670d\u52a1\u5668\u6216\u8005\u5ba2\u6237\u7aef\uff0c\u4ee5\u4e0b\uff0c\u8ba9A\u4f5c\u4e3a\u670d\u52a1\u5668\uff0cB\u4e3a\u5ba2\u6237\u7aef\u3002<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -l 1567 &lt; file.txt<\/span><\/pre>\nClient\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -n 172.31.100.7 1567 &gt; file.txt<\/span><\/pre>\n\u8fd9\u91cc\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u670d\u52a1\u5668\u5728A\u4e0a\u5e76\u4e14\u91cd\u5b9a\u5411netcat\u7684\u8f93\u5165\u4e3a\u6587\u4ef6file.txt\uff0c\u90a3\u4e48\u5f53\u4efb\u4f55\u6210\u529f\u8fde\u63a5\u5230\u8be5\u7aef\u53e3\uff0cnetcat\u4f1a\u53d1\u9001file\u7684\u6587\u4ef6\u5185\u5bb9\u3002\n<p>\u5728\u5ba2\u6237\u7aef\u6211\u4eec\u91cd\u5b9a\u5411\u8f93\u51fa\u5230file.txt\uff0c\u5f53B\u8fde\u63a5\u5230A\uff0cA\u53d1\u9001\u6587\u4ef6\u5185\u5bb9\uff0cB\u4fdd\u5b58\u6587\u4ef6\u5185\u5bb9\u5230file.txt.<\/p>\n<p>\u6ca1\u6709\u5fc5\u8981\u521b\u5efa\u6587\u4ef6\u6e90\u4f5c\u4e3aServer\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u76f8\u53cd\u7684\u65b9\u6cd5\u4f7f\u7528\u3002\u50cf\u4e0b\u9762\u7684\u6211\u4eec\u53d1\u9001\u6587\u4ef6\u4eceB\u5230A\uff0c\u4f46\u662f\u670d\u52a1\u5668\u521b\u5efa\u5728A\u4e0a\uff0c\u8fd9\u6b21\u6211\u4eec\u4ec5\u9700\u8981\u91cd\u5b9a\u5411netcat\u7684\u8f93\u51fa\u5e76\u4e14\u91cd\u5b9a\u5411B\u7684\u8f93\u5165\u6587\u4ef6\u3002<\/p>\n<p>B\u4f5c\u4e3aServer<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -l 1567 &gt; file.txt<\/span><\/pre>\n<p>Client<\/p>\n<pre class=\"hljs css\"><span class=\"hljs-selector-tag\">nc<\/span> 172<span class=\"hljs-selector-class\">.31<\/span><span class=\"hljs-selector-class\">.100<\/span><span class=\"hljs-selector-class\">.23<\/span> 1567 &lt; <span class=\"hljs-selector-tag\">file<\/span><span class=\"hljs-selector-class\">.txt<\/span><\/pre>\n<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\n<div class=\"content\">\n<div class=\"extra\">\n<div class=\"ui small horizontal list actions\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12880\" data-translated-paragraph-id=\"13008\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>4\uff0c\u76ee\u5f55\u4f20\u8f93<\/h3>\n<p>\u53d1\u9001\u4e00\u4e2a\u6587\u4ef6\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u5982\u679c\u6211\u4eec\u60f3\u8981\u53d1\u9001\u591a\u4e2a\u6587\u4ef6\uff0c\u6216\u8005\u6574\u4e2a\u76ee\u5f55\uff0c\u4e00\u6837\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4f7f\u7528\u538b\u7f29\u5de5\u5177tar\uff0c\u538b\u7f29\u540e\u53d1\u9001\u538b\u7f29\u5305\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u901a\u8fc7\u7f51\u7edc\u4f20\u8f93\u4e00\u4e2a\u76ee\u5f55\u4eceA\u5230B\u3002<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">tar -cvf \u2013 dir_name | nc -l 1567<\/span><\/pre>\n<p>Client<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -n 172.31.100.7 1567 | tar -xvf -<\/span><\/pre>\n\u8fd9\u91cc\u5728A\u670d\u52a1\u5668\u4e0a\uff0c\u6211\u4eec\u521b\u5efa\u4e00\u4e2atar\u5f52\u6863\u5305\u5e76\u4e14\u901a\u8fc7-\u5728\u63a7\u5236\u53f0\u91cd\u5b9a\u5411\u5b83\uff0c\u7136\u540e\u4f7f\u7528\u7ba1\u9053\uff0c\u91cd\u5b9a\u5411\u7ed9netcat\uff0cnetcat\u53ef\u4ee5\u901a\u8fc7\u7f51\u7edc\u53d1\u9001\u5b83\u3002\n<p>\u5728\u5ba2\u6237\u7aef\u6211\u4eec\u4e0b\u8f7d\u8be5\u538b\u7f29\u5305\u901a\u8fc7netcat \u7ba1\u9053\u7136\u540e\u6253\u5f00\u6587\u4ef6\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u8282\u7701\u5e26\u5bbd\u4f20\u8f93\u538b\u7f29\u5305\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528bzip2\u6216\u8005\u5176\u4ed6\u5de5\u5177\u538b\u7f29\u3002<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">tar -cvf \u2013 dir_name| bzip2 -z | nc -l 1567<\/span><\/pre>\n<p>\u901a\u8fc7bzip2\u538b\u7f29<\/p>\n<p>Client<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -n 172.31.100.7 1567 | bzip2 -d |tar -xvf -<\/span><\/pre>\n\u4f7f\u7528bzip2\u89e3\u538b<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\n<div class=\"content\">\n<div class=\"extra\">\n<div class=\"ui small horizontal list actions\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12881\" data-translated-paragraph-id=\"13047\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>5. \u52a0\u5bc6\u4f60\u901a\u8fc7\u7f51\u7edc\u53d1\u9001\u7684\u6570\u636e<\/h3>\n<p>\u5982\u679c\u4f60\u62c5\u5fc3\u4f60\u5728\u7f51\u7edc\u4e0a\u53d1\u9001\u6570\u636e\u7684\u5b89\u5168\uff0c\u4f60\u53ef\u4ee5\u5728\u53d1\u9001\u4f60\u7684\u6570\u636e\u4e4b\u524d\u7528\u5982mcrypt\u7684\u5de5\u5177\u52a0\u5bc6\u3002<\/p>\n<p>\u670d\u52a1\u7aef<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc localhost 1567 | mcrypt \u2013flush \u2013bare -F -q -d -m ecb &gt; file.txt<\/span><\/pre>\n\u4f7f\u7528mcrypt\u5de5\u5177\u52a0\u5bc6\u6570\u636e\u3002\n<p>\u5ba2\u6237\u7aef<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">mcrypt \u2013flush \u2013bare -F -q -m ecb &lt; file.txt | nc -l 1567<\/span><\/pre>\n\u4f7f\u7528mcrypt\u5de5\u5177\u89e3\u5bc6\u6570\u636e\u3002\n<p>\u4ee5\u4e0a\u4e24\u4e2a\u547d\u4ee4\u4f1a\u63d0\u793a\u9700\u8981\u5bc6\u7801\uff0c\u786e\u4fdd\u4e24\u7aef\u4f7f\u7528\u76f8\u540c\u7684\u5bc6\u7801\u3002<\/p>\n<p>\u8fd9\u91cc\u6211\u4eec\u662f\u4f7f\u7528mcrypt\u7528\u6765\u52a0\u5bc6\uff0c\u4f7f\u7528\u5176\u5b83\u4efb\u610f\u52a0\u5bc6\u5de5\u5177\u90fd\u53ef\u4ee5\u3002<\/p>\n<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\n<div class=\"content\">\n<div class=\"extra\">\n<div class=\"ui small horizontal list actions\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12882\" data-translated-paragraph-id=\"13002\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>6. \u6d41\u89c6\u9891<\/h3>\n<p>\u867d\u7136\u4e0d\u662f\u751f\u6210\u6d41\u89c6\u9891\u7684\u6700\u597d\u65b9\u6cd5\uff0c\u4f46\u5982\u679c\u670d\u52a1\u5668\u4e0a\u6ca1\u6709\u7279\u5b9a\u7684\u5de5\u5177\uff0c\u4f7f\u7528netcat\uff0c\u6211\u4eec\u4ecd\u7136\u6709\u5e0c\u671b\u505a\u6210\u8fd9\u4ef6\u4e8b\u3002<\/p>\n<p>\u670d\u52a1\u7aef<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">cat video.avi | nc -l 1567<\/span><\/pre>\n\u8fd9\u91cc\u6211\u4eec\u53ea\u662f\u4ece\u4e00\u4e2a\u89c6\u9891\u6587\u4ef6\u4e2d\u8bfb\u5165\u5e76\u91cd\u5b9a\u5411\u8f93\u51fa\u5230netcat\u5ba2\u6237\u7aef\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc 172.31.100.7 1567 | mplayer -vo x11 -cache 3000 -<\/span><\/pre>\n<p>\u8fd9\u91cc\u6211\u4eec\u4ecesocket\u4e2d\u8bfb\u5165\u6570\u636e\u5e76\u91cd\u5b9a\u5411\u5230mplayer\u3002<\/p>\n<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\n<div class=\"content\">\n<div class=\"extra\">\n<div class=\"ui small horizontal list actions\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12883\" data-translated-paragraph-id=\"13049\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>7\uff0c\u514b\u9686\u4e00\u4e2a\u8bbe\u5907<\/h3>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u5b89\u88c5\u914d\u7f6e\u4e00\u53f0Linux\u673a\u5668\u5e76\u4e14\u9700\u8981\u91cd\u590d\u540c\u6837\u7684\u64cd\u4f5c\u5bf9\u5176\u4ed6\u7684\u673a\u5668\uff0c\u800c\u4f60\u4e0d\u60f3\u5728\u91cd\u590d\u914d\u7f6e\u4e00\u904d\u3002\u4e0d\u5728\u9700\u8981\u91cd\u590d\u914d\u7f6e\u5b89\u88c5\u7684\u8fc7\u7a0b\uff0c\u53ea\u542f\u52a8\u53e6\u4e00\u53f0\u673a\u5668\u7684\u4e00\u4e9b\u5f15\u5bfc\u53ef\u4ee5\u968f\u8eab\u789f\u548c\u514b\u9686\u4f60\u7684\u673a\u5668\u3002<\/p>\n<p>\u514b\u9686Linux PC\u5f88\u7b80\u5355\uff0c\u5047\u5982\u4f60\u7684\u7cfb\u7edf\u5728\u78c1\u76d8\/dev\/sda\u4e0a<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">dd <span class=\"hljs-keyword\">if<\/span>=\/dev\/sda | nc -l 1567<\/span><\/pre>\nClient\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -n 172.31.100.7 1567 | dd of=\/dev\/sda<\/span><\/pre>\ndd\u662f\u4e00\u4e2a\u4ece\u78c1\u76d8\u8bfb\u53d6\u539f\u59cb\u6570\u636e\u7684\u5de5\u5177\uff0c\u6211\u901a\u8fc7netcat\u670d\u52a1\u5668\u91cd\u5b9a\u5411\u5b83\u7684\u8f93\u51fa\u6d41\u5230\u5176\u4ed6\u673a\u5668\u5e76\u4e14\u5199\u5165\u5230\u78c1\u76d8\u4e2d\uff0c\u5b83\u4f1a\u968f\u7740\u5206\u533a\u8868\u62f7\u8d1d\u6240\u6709\u7684\u4fe1\u606f\u3002\u4f46\u662f\u5982\u679c\u6211\u4eec\u5df2\u7ecf\u505a\u8fc7\u5206\u533a\u5e76\u4e14\u53ea\u9700\u8981\u514b\u9686root\u5206\u533a\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u6211\u4eec\u7cfb\u7edfroot\u5206\u533a\u7684\u4f4d\u7f6e\uff0c\u66f4\u6539sda \u4e3asda1\uff0csda2.\u7b49\u7b49\u3002<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\u00a0<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12884\" data-translated-paragraph-id=\"13052\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>8\uff0c\u6253\u5f00\u4e00\u4e2ashell<\/h3>\n<p>\u6211\u4eec\u5df2\u7ecf\u7528\u8fc7\u8fdc\u7a0bshell-\u4f7f\u7528telnet\u548cssh\uff0c\u4f46\u662f\u5982\u679c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u6ca1\u6709\u5b89\u88c5\u5e76\u4e14\u6211\u4eec\u6ca1\u6709\u6743\u9650\u5b89\u88c5\u4ed6\u4eec\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u4f7f\u7528netcat\u521b\u5efa\u8fdc\u7a0bshell\u3002<\/p>\n<p>\u5047\u8bbe\u4f60\u7684netcat\u652f\u6301 -c -e \u53c2\u6570(\u9ed8\u8ba4 netcat)<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -l 1567 -e \/bin\/bash -i<\/span><\/pre>\nClient\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc 172.31.100.7 1567<\/span><\/pre>\n\u8fd9\u91cc\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2anetcat\u670d\u52a1\u5668\u5e76\u4e14\u8868\u793a\u5f53\u5b83\u8fde\u63a5\u6210\u529f\u65f6\u6267\u884c\/bin\/bash\n<p>\u5047\u5982netcat \u4e0d\u652f\u6301-c \u6216\u8005 -e \u53c2\u6570\uff08openbsd netcat\uff09,\u6211\u4eec\u4ecd\u7136\u80fd\u591f\u521b\u5efa\u8fdc\u7a0bshell<\/p>\n<p>Server<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">mkfifo \/tmp\/tmp_fifo<\/span>\n<span class=\"hljs-meta\">$<\/span><span class=\"bash\">cat \/tmp\/tmp_fifo | \/bin\/sh -i 2&gt;&amp;1 | nc -l 1567 &gt; \/tmp\/tmp_fifo<\/span><\/pre>\n\u8fd9\u91cc\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2afifo\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528\u7ba1\u9053\u547d\u4ee4\u628a\u8fd9\u4e2afifo\u6587\u4ef6\u5185\u5bb9\u5b9a\u5411\u5230shell 2&gt;&amp;1\u4e2d\u3002\u662f\u7528\u6765\u91cd\u5b9a\u5411\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u548c\u6807\u51c6\u8f93\u51fa\uff0c\u7136\u540e\u7ba1\u9053\u5230netcat \u8fd0\u884c\u7684\u7aef\u53e31567\u4e0a\u3002\u81f3\u6b64\uff0c\u6211\u4eec\u5df2\u7ecf\u628anetcat\u7684\u8f93\u51fa\u91cd\u5b9a\u5411\u5230fifo\u6587\u4ef6\u4e2d\u3002\n<p>\u8bf4\u660e\uff1a<\/p>\n<p>\u4ece\u7f51\u7edc\u6536\u5230\u7684\u8f93\u5165\u5199\u5230fifo\u6587\u4ef6\u4e2d<\/p>\n<p>cat \u547d\u4ee4\u8bfb\u53d6fifo\u6587\u4ef6\u5e76\u4e14\u5176\u5185\u5bb9\u53d1\u9001\u7ed9sh\u547d\u4ee4<\/p>\n<p>sh\u547d\u4ee4\u8fdb\u7a0b\u53d7\u5230\u8f93\u5165\u5e76\u628a\u5b83\u5199\u56de\u5230netcat\u3002<\/p>\n<p>netcat \u901a\u8fc7\u7f51\u7edc\u53d1\u9001\u8f93\u51fa\u5230client<\/p>\n<p>\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u4f1a\u6210\u529f\u662f\u56e0\u4e3a\u7ba1\u9053\u4f7f\u547d\u4ee4\u5e73\u884c\u6267\u884c\uff0cfifo\u6587\u4ef6\u7528\u6765\u66ff\u4ee3\u6b63\u5e38\u6587\u4ef6\uff0c\u56e0\u4e3afifo\u4f7f\u8bfb\u53d6\u7b49\u5f85\u800c\u5982\u679c\u662f\u4e00\u4e2a\u666e\u901a\u6587\u4ef6\uff0ccat\u547d\u4ee4\u4f1a\u5c3d\u5feb\u7ed3\u675f\u5e76\u5f00\u59cb\u8bfb\u53d6\u7a7a\u6587\u4ef6\u3002<\/p>\n<p>\u5728\u5ba2\u6237\u7aef\u4ec5\u4ec5\u7b80\u5355\u8fde\u63a5\u5230\u670d\u52a1\u5668<\/p>\n<p>Client<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -n 172.31.100.7 1567<\/span><\/pre>\n\u4f60\u4f1a\u5f97\u5230\u4e00\u4e2ashell\u63d0\u793a\u7b26\u5728\u5ba2\u6237\u7aef<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\u00a0<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12885\" data-translated-paragraph-id=\"13046\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3>\u53cd\u5411shell<\/h3>\n<p>\u53cd\u5411shell\u662f\u6307\u5728\u5ba2\u6237\u7aef\u6253\u5f00\u7684shell\u3002\u53cd\u5411shell\u8fd9\u6837\u547d\u540d\u662f\u56e0\u4e3a\u4e0d\u540c\u4e8e\u5176\u4ed6\u914d\u7f6e\uff0c\u8fd9\u91cc\u670d\u52a1\u5668\u4f7f\u7528\u7684\u662f\u7531\u5ba2\u6237\u63d0\u4f9b\u7684\u670d\u52a1\u3002<\/p>\n<p>\u670d\u52a1\u7aef<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc -l 1567<\/span><\/pre>\n\u5728\u5ba2\u6237\u7aef\uff0c\u7b80\u5355\u5730\u544a\u8bc9netcat\u5728\u8fde\u63a5\u5b8c\u6210\u540e\uff0c\u6267\u884cshell\u3002\n<p>\u5ba2\u6237\u7aef<\/p>\n<pre class=\"hljs shell\"><span class=\"hljs-meta\">$<\/span><span class=\"bash\">nc 172.31.100.7 1567 -e \/bin\/bash<\/span><\/pre>\n\u73b0\u5728\uff0c\u4ec0\u4e48\u662f\u53cd\u5411shell\u7684\u7279\u522b\u4e4b\u5904\u5462\u00a0<br \/>\u53cd\u5411shell\u7ecf\u5e38\u88ab\u7528\u6765\u7ed5\u8fc7\u9632\u706b\u5899\u7684\u9650\u5236\uff0c\u5982\u963b\u6b62\u5165\u7ad9\u8fde\u63a5\u3002\u4f8b\u5982\uff0c\u6211\u6709\u4e00\u4e2a\u4e13\u7528IP\u5730\u5740\u4e3a172.31.100.7\uff0c\u6211\u4f7f\u7528\u4ee3\u7406\u670d\u52a1\u5668\u8fde\u63a5\u5230\u5916\u90e8\u7f51\u7edc\u3002\u5982\u679c\u6211\u60f3\u4ece\u7f51\u7edc\u5916\u90e8\u8bbf\u95ee\u00a0\u8fd9\u53f0\u673a\u5668\u59821.2.3.4\u7684shell\uff0c\u90a3\u4e48\u6211\u4f1a\u7528\u53cd\u5411\u5916\u58f3\u7528\u4e8e\u8fd9\u4e00\u76ee\u7684\u3002\u00a0<\/div>\n<\/div>\n<div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12886\" data-translated-paragraph-id=\"13026\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3><strong>10. \u6307\u5b9a\u6e90\u7aef\u53e3<\/strong><\/h3>\n<p>\u5047\u8bbe\u4f60\u7684\u9632\u706b\u5899\u8fc7\u6ee4\u966425\u7aef\u53e3\u5916\u5176\u5b83\u6240\u6709\u7aef\u53e3\uff0c\u4f60\u9700\u8981\u4f7f\u7528-p\u9009\u9879\u6307\u5b9a\u6e90\u7aef\u53e3\u3002<\/p>\n<p>\u670d\u52a1\u5668\u7aef<\/p>\n<pre>$nc -l 1567<\/pre>\n<p>\u5ba2\u6237\u7aef<\/p>\n<pre>$nc 172.31.100.7 1567 -p 25<\/pre>\n<p>\u4f7f\u75281024\u4ee5\u5185\u7684\u7aef\u53e3\u9700\u8981root\u6743\u9650\u3002<\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u5728\u5ba2\u6237\u7aef\u5f00\u542f25\u7aef\u53e3\u7528\u4e8e\u901a\u8baf\uff0c\u5426\u5219\u5c06\u4f7f\u7528\u968f\u673a\u7aef\u53e3\u3002<\/p>\n<\/div>\n<div class=\"four wide computer tablet only column translate-user\">\n<div class=\"ui items\">\n<div class=\"item\">\n<div class=\"osc-avatar small-portrait _35x35 avatar\" title=\"Lax\" data-user-id=\"926404\">\u00a0<\/div>\n<\/div>\n<div class=\"item footer-info\">\u00a0<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"ui internally grid translate-paragraph\" data-paragraph-id=\"12887\" data-translated-paragraph-id=\"13031\">\n<div class=\"row\">\n<div class=\"twelve wide computer twelve wide tablet sixteen wide mobile column content translate-content\">\n<h3><strong>11. \u6307\u5b9a\u6e90\u5730\u5740<\/strong><\/h3>\n<p>\u5047\u8bbe\u4f60\u7684\u673a\u5668\u6709\u591a\u4e2a\u5730\u5740\uff0c\u5e0c\u671b\u660e\u786e\u6307\u5b9a\u4f7f\u7528\u54ea\u4e2a\u5730\u5740\u7528\u4e8e\u5916\u90e8\u6570\u636e\u901a\u8baf\u3002\u6211\u4eec\u53ef\u4ee5\u5728netcat\u4e2d\u4f7f\u7528-s\u9009\u9879\u6307\u5b9aip\u5730\u5740\u3002<\/p>\n<p>\u670d\u52a1\u5668\u7aef<\/p>\n<pre>$nc -u -l 1567 &lt; file.txt<\/pre>\n<p>\u5ba2\u6237\u7aef<\/p>\n<pre>$nc -u 172.31.100.7 1567 -s 172.31.100.5 &gt; file.txt<\/pre>\n<p>\u8be5\u547d\u4ee4\u5c06\u7ed1\u5b9a\u5730\u5740172.31.100.5\u3002<\/p>\n<p>\u8fd9\u4ec5\u4ec5\u662f\u4f7f\u7528netcat\u7684\u4e00\u4e9b\u793a\u4f8b\u3002<\/p>\n<p>\u5176\u5b83\u7528\u9014\u6709\uff1a<\/p>\n<ul>\n<li>\u00a0 \u00a0 \u4f7f\u7528-t\u9009\u9879\u6a21\u62dfTelnet\u5ba2\u6237\u7aef\uff0c<\/li>\n<li>\u00a0\u00a0\u00a0 HTTP\u5ba2\u6237\u7aef\u7528\u4e8e\u4e0b\u8f7d\u6587\u4ef6\uff0c<\/li>\n<li>\u00a0 \u00a0 \u8fde\u63a5\u5230\u90ae\u4ef6\u670d\u52a1\u5668\uff0c\u4f7f\u7528SMTP\u534f\u8bae\u68c0\u67e5\u90ae\u4ef6\uff0c<\/li>\n<li>\u00a0 \u00a0 \u4f7f\u7528ffmpeg\u622a\u53d6\u5c4f\u5e55\u5e76\u901a\u8fc7\u6d41\u5f0f\u4f20\u8f93\u5206\u4eab\uff0c\u7b49\u7b49\u3002\u5176\u5b83\u66f4\u591a\u7528\u9014\u3002<\/li>\n<\/ul>\n<p>\u7b80\u5355\u6765\u8bf4\uff0c\u53ea\u8981\u4f60\u4e86\u89e3\u534f\u8bae\u5c31\u53ef\u4ee5\u4f7f\u7528netcat\u4f5c\u4e3a\u7f51\u7edc\u901a\u8baf\u5a92\u4ecb\uff0c\u5b9e\u73b0\u5404\u79cd\u5ba2\u6237\u7aef\u3002<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u8f6c\u8f7d\u81ea\uff1ahttps:\/\/www.oschina.net\/translate\/linux-netcat &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"series":[],"class_list":["post-582","post","type-post","status-publish","format-standard","hentry","category-programmers"],"_links":{"self":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/582"}],"collection":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=582"}],"version-history":[{"count":1,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/582\/revisions"}],"predecessor-version":[{"id":583,"href":"https:\/\/fick707.com\/index.php?rest_route=\/wp\/v2\/posts\/582\/revisions\/583"}],"wp:attachment":[{"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=582"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/fick707.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}