netcat

Send a binary file (line by line) to a socket server with Netcat

好久不见. 提交于 2019-12-01 09:54:29
问题 As a spin off to this Stack Overflow question I want to archieve the same except for a couple of tweaks. I want to connect to a host, send a binary file, line by line, and have a couple of seconds of delay between each line... and it must be in the same connection. The strings I want to send are mostly textbased but there are a couple of non-printable chars in the line. This is an example of a string/line I want to send (thousands of lines per file): <null>e<null><null>00326513,6598,no,8,,2z

Flume 概述/企业案例

≡放荡痞女 提交于 2019-12-01 07:21:14
第1章 概述 1.1 Flume定义 Flume是Cloudera提供的一个高可用的,高可靠的,分布式的海量日志采集、聚合和传输的系统。Flume基于流式架构,灵活简单。 下面我们来详细介绍一下Flume架构中的组件。 1.2.1 Agent Agent是一个JVM进程,它以事件的形式将数据从源头送至目的,是Flume数据传输的基本单元。 Agent主要有3个部分组成,Source、Channel、Sink。 1.2.2 Source Source是负责接收数据到Flume Agent的组件。Source组件可以处理各种类型、各种格式的日志数据,包括avro、thrift、exec、jms、spooling directory、netcat、sequence generator、syslog、http、legacy。 1.2.3 Channel Channel是位于Source和Sink之间的缓冲区。因此,Channel允许Source和Sink运作在不同的速率上。Channel是线程安全的,可以同时处理几个Source的写入操作和几个Sink的读取操作。 Flume自带两种Channel:Memory Channel和File Channel。 Memory Channel是内存中的队列。Memory Channel在不需要关心数据丢失的情景下适用。如果需要关心数据丢失

Netcat: using nc -l port_number instead of nc -l -p port_number

南楼画角 提交于 2019-12-01 06:41:00
This question is following this one: Sockets working in openSUSE do not work in Debian? When working with sockets on my Debian system, I have to use nc -l -p port_number to simulate the server I want to talk with. If I'm using nc -l port_number, it will fail when using the socket connect function and strerror(errno) will say "Connection refused". Netcat without -p option is working great on other Linux distributions, what should I change on my configuration? I agree with duskwuff that it is better to just use the -p option everywhere, but to answer your question: The one thing you have to do

Netcat: using nc -l port_number instead of nc -l -p port_number

▼魔方 西西 提交于 2019-12-01 05:26:14
问题 This question is following this one: Sockets working in openSUSE do not work in Debian? When working with sockets on my Debian system, I have to use nc -l -p port_number to simulate the server I want to talk with. If I'm using nc -l port_number, it will fail when using the socket connect function and strerror(errno) will say "Connection refused". Netcat without -p option is working great on other Linux distributions, what should I change on my configuration? 回答1: I agree with duskwuff that it

nc (netcat) on Mac OS X 10.8.4 gets stuck

人盡茶涼 提交于 2019-12-01 00:01:00
I encountered a little issue while using the nc utility on Mac OS X, a utility i often use as a quick and dirty solution to check if a port is open and what version the daemon is running. We deployed a new set of computers the other day and i wanted to verify what version of sshd they were running, without having to leave my chair. This is the command i ran and the resulting output: $ for i in {183..200}; do echo "hello" | nc -n -w 2 -v 10.120.113.$i 22; done Connection to 10.120.113.183 22 port [tcp/*] succeeded! SSH-2.0-OpenSSH_5.9 Protocol mismatch. nc: connect to 10.120.113.184 port 22

getting “530 5.7.0 Must issue a STARTTLS command first.” error when sending mail via netcat

只谈情不闲聊 提交于 2019-11-30 23:53:40
问题 I'm trying to send an email with netcat, this is what i get: ****-MacBook-Pro:~ ***$ nc smtp.gmail.com 25 220 mx.google.com ESMTP h8sm66301168eew.16 - gsmtp Helo gmail.com 250 mx.google.com at your service MAIL FROM: <******@gmail.com> 530 5.7.0 Must issue a STARTTLS command first. h8sm66301168eew.16 - gsmtp what is STARTTLS command and what do i need to do with it? 回答1: STARTTLS is an extension to plain text communication protocols, which offers a way to upgrade a plain text connection to an

Send text file, line by line, with netcat

牧云@^-^@ 提交于 2019-11-30 21:01:01
I'm trying to send a file, line by line, with the following commands: nc host port < textfile cat textfile | nc host port I've tried with tail and head , but with the same result: the entire file is sent as a unique line. The server is listening with a specific daemon to receive data log information. I'd like to send and receive the lines one by one, not the whole file in a single shot. How can I do that? Do you HAVE TO use netcat? cat textfile > /dev/tcp/HOST/PORT can also serve your purpose, at least with bash. I'de like to send, and receive, one by one the lines, not all the file in a

How to respond conditionally based on the request when using netcat

我与影子孤独终老i 提交于 2019-11-30 19:41:35
I am trying to set up a web server using only windows batch scripting. I have already come up with the following script: @echo off @setlocal enabledelayedexpansion for /l %%a in (1,0,2) do ( type tempfile.txt | nc -w 1 -l -p 80 | findstr mystring if !ERRORLEVEL! == 0 ( echo found > tempfile.txt ) else ( echo not-found > tempfile.txt ) ) However, the response is always one request behind, I mean, if I type something like this into the browser: REQUEST: localhost/mystring I will get the following response: RESPONSE: not-found Only in the next request I will receive the correct answer for the

Send text file, line by line, with netcat

本秂侑毒 提交于 2019-11-30 17:13:12
问题 I'm trying to send a file, line by line, with the following commands: nc host port < textfile cat textfile | nc host port I've tried with tail and head , but with the same result: the entire file is sent as a unique line. The server is listening with a specific daemon to receive data log information. I'd like to send and receive the lines one by one, not the whole file in a single shot. How can I do that? 回答1: Do you HAVE TO use netcat? cat textfile > /dev/tcp/HOST/PORT can also serve your

How to wait for an open port with netcat?

让人想犯罪 __ 提交于 2019-11-30 06:18:56
问题 I'm trying to do a custom dockerfile with jenkins on it. I would to wait until port 8080 is open instead of doing an ugly 'sleep 60' with netcat but in not very confident with bash scripts and netcat. Here is an example of what i'm trying to do: #!/bin/bash opened=0 while [ "$opened" == "0" ]; do echo "Waiting jenkins to launch on 8080..." nc -vz localhost 8080 done echo "Jenkins launched" 回答1: You can't set netcat to wait until some port is open, so you have to add part for waiting before