0

netcat with verbose captures client IP.

but I can not put it in a variable.

VAR=$(nc -v -l 82)

is there a way to get the sender's ip into a $VAR ?

Note:

Verbose mode only prints extra lines on the terminal.
it does not place that data into the $VAR

1 Answer 1

0

The output is probably going to standard error. Redirect standard error to standard output to capture it:

$ VAR=$( nc -v -l 82 2>&1 )

or, you might want to redirect the original standard output to a file:

$ VAR=$( nc -v -l 82 2>&1 >output )
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.