Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emulating netcat -e

How can I emulate netcat -e with a version of netcat that does not have the -e option ?

I need to trigger a command remotely. I can do it with netcat - without -e:

#!/bin/bash

netcat -l 8080 ; myCommand.sh

That would do the trick, but I would like to reply to the client depending on the success or failure of the command (to have a kind of REST - like interface).

How could I do that ?

Thanks!

like image 344
user787935 Avatar asked Jun 07 '11 17:06

user787935


People also ask

Do hackers use Netcat?

Probably the most malicious use of netcat-- and the most effective for the hacker --is the ability to use netcat for remote administration. We can use netcat's ability to execute commands to give the remote connection a shell on the listening system.

Can I use Netcat in Windows?

By configuring jobs, you can effectively monitor your Windows-based infrastructure using Netdata, despite our lack of native Windows support. Use real-time visualizations to troubleshoot anomalies, or claim the node(s) you use to monitor Windows to your Space in Netdata Cloud for Windows infrastructure monitoring.

Is nmap a Netcat?

What are nmap and netcat? Nmap is a free and open-source network scanner used to discover hosts and services on a computer network by sending packets and analyzing the responses. Netcat is a general-purpose command-line tool often referred to as the Swiss Army knife for networking.

Does Windows 10 have Netcat?

In this tutorial, you will learn how to download and install Netcat on Windows 11/10 /Server. Netcat is a network security tool that administrators can use for a variety of network operations, such as checking open ports, transferring data over a network connection, and security assessments.


1 Answers

mkfifo foo
nc -lk 2600 0<foo | /bin/bash 1>foo

Then just nc servername 2600 and ./script.sh

kill the client with ctrl+c

like image 173
Jocko Avatar answered Oct 07 '22 21:10

Jocko