netcat

nc 命令

泪湿孤枕 提交于 2020-01-05 00:17:55
CentOS6.9下netcat工具安装 1.下载 下载地址: http://sourceforge.net/projects/netcat/files/netcat/0.7.1/ 下载的是netcat-0.7.1.tar.gz版本 2.解压 tar -zxvf netcat-0.7.1.tar.gz -C /usr/local 3.安装 # ./configure --prefix=/usr/local/netcat # make # make install 4.配置环境变量 vim /etc/profile export NETCAT_HOME=/usr/local/netcat export PATH=$PATH:$NETCAT_HOME/bin 5.测试 # nc -help nc 命令扫描服务存活的使用方式: # nc -v -w 1 192.168.200.200 -z 1-100 node1 [192.168.200.200] 22 (ssh) open node1 [192.168.200.200] 80 (http) open nc 命令做为web客户端的使用方式: nc WEBSERVER PORT GET /index.html HTTP/1.1 Host: 192.168.200.201 Referer: http://www.ccxx/index.php

Netcat TCP Programming with Bash

╄→尐↘猪︶ㄣ 提交于 2019-12-30 18:32:09
问题 I'm attempting to do some basic TCP client communication by using strictly bash scripting. I have netcat at my disposal and so I've written this loop so far: nc 10.0.0.104 4646 | while read line do if [ "$line" == '{"cmd": 1}' ] then # Send text back to the TCP server echo '{"error": 0}' fi done The script can successfully connect to the server application I'm using but I'm having difficulties figuring out how to send text back to the netcat process. 回答1: With Bash≥4 you can use coproc : #!

How to encode parameter as gbk instead of utf-8 with cURL or python requests?

无人久伴 提交于 2019-12-25 11:49:10
问题 I have a strange API, it just accept gbk parameters, I capture the data in Windows IE browser , show data with this command: $ cat 12_Request.txt| iconv -f GBK -t UTF-8 GET http://10.202.15.197:20176/?user_id=1&query_type=GEOSPLIT&address=广东省深圳市宝安&ret_splitinfo=1 HTTP/1.1 Accept: text/html, application/xhtml+xml, */* Accept-Language: zh-CN User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko Accept-Encoding: gzip, deflate Host: 10.202.15.197:20176 DNT: 1 Connection

Netcat running sending binary data to php script

谁说胖子不能爱 提交于 2019-12-25 02:56:27
问题 I'm trying to send request to php script with netcat. cat "/var/www/9292/123456bytes" | nc "xx.xx.xx.xxx." xxxx This gives me such mistake: <!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>server info port</address> </body></html> Here is output of cat "

netcat工具

核能气质少年 提交于 2019-12-25 00:17:31
netcat工具有什么用? 可以使用它:打开 TCP 连接、侦听任意 TCP 和 UDP 端口、发送 UDP 数据包、在 IPv4 和 IPv6 进行端口扫描。 如何安装netcat? sudo yum install -y nc 如何使用netcat监听端口? 监听端口(listen):netcat -l 8888 如何使用netcat发送数据? 发送信息:netcat localhost 8888 确定远程主机上的端口是否可访问/打开? $ nc -zv 192.168.1.15 22 -z – 设置 nc 只是扫描侦听守护进程,实际上不向它们发送任何数据。 -v – 启用详细模式 下面的命令会检查远程主机 192.168.5.10 上是否打开了端口 80、22 和 21(也可以使用主机名): nc -zv 192.168.56.10 80 22 21 也可以指定端口扫描的范围: $ nc -zv 192.168.56.10 20-80 来源: CSDN 作者: 国强-开发 链接: https://blog.csdn.net/t1g2q3/article/details/90380749

netcat power tool

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 18:40:49
1,安装NC:wget http://osdn.dl.sourceforge.net/sourceforge/netcat/netcat-0.7.1.tar.gz tar –xzf netcat-0.7.1.tar.gz cd netcat-0.7.1 ./configure make make install 2,2种操作模式的命令格式:connect to somewhere: nc [-options] hostname port[s] [ports] … listen for inbound: nc –l –p port [options] [hostname] [port] 3,选择危险功能nc –l –p 123456 –e cmd.exe (Windows) nc –l –p 12345 –e /bin/bash (Linux) 4,-g and -G 配置nc使用源站路由 The –g and –G options allow you to configure Netcat to use source routing. In source routing 5,-L选择反复打开进程 nc –l –p 12345 –e cmd.exe -L 6,-p指定服务端口 nc –l –p 12345 7,端口扫描 nc –[options] hostname [ports] 8

combine netcat with chat on bash for automatic udp responses

前提是你 提交于 2019-12-24 03:08:26
问题 I want to combine "chat" and "nc" on linux, so I will create a tiny udp server that responds on a specific request and sends back an answer. In fact I want to redirect the stdout of "nc" to the stdin of "chat" and vice versa. My first attempt was: nc -w 3000 -u -n -l -p 30000 >&1111 <2222 & chat -V 'request' 'answer' >&2222 <1111 But it didn't work. 回答1: use socat instead of netcat. Something like this : socat UDP-LISTEN:5555 EXEC:"chat -sv ping pong",pty To test it, you can open another

Python subprocesses don't output properly?

不羁的心 提交于 2019-12-23 15:41:09
问题 I don't think I'm understanding python subprocess properly at all but here's a simple example to illustrate a point I'm confused about: #!/usr/bin/env python import subprocess lookup_server = subprocess.Popen("nc -l 5050", shell=True) lookup_client = subprocess.Popen("nc localhost 5050", shell=True, stdin=subprocess.PIPE) print lookup_client.poll() lookup_client.stdin.write("magic\n") print lookup_client.poll() lookup_client.send_signal(subprocess.signal.SIGINT) print lookup_client.poll()

Redirect process stdin and stdout to netcat

柔情痞子 提交于 2019-12-21 06:28:14
问题 I have an embedded linux application with a simple interactive command line interface. I'd like to access the command line from telnet (or network, in general). However, the process should be started when the board turns on, and in a unique instance. So, the following netcat command is not an option: nc -l -p 4000 -e myapp I can do nc -l -p 4000 | myapp to send remote commands to myapp, but this way I can't see myapp output. Is there any way to redirect both stdin and stdout to netcat ?

Using netcat to pipe unix socket to tcp socket

丶灬走出姿态 提交于 2019-12-21 05:00:59
问题 I am trying to expose a unix socket as a tcp socket using this command: nc -lkv 44444 | nc -Uv /var/run/docker.sock When I try to access localhost:44444/containers/json from a browser, it doesn't load anything but keeps the connection open (the loading thingy keeps spinning), but the console (because of the -v flag) shows proper http response. Any ideas on how to get this working? PS: I know I can use socat, or just tell docker to also listen on a tcp socket, but I am using the project atomic