We help IT Professionals succeed at work.
Get Started

netcat

228 Views
Last Modified: 2015-10-13
my question pertains to the use of the netcat utility ( i believe the developer is Hobbit) in windows.
i am using this utility (this is for a project and i must use netcat (no other solution))

i am using this utility in a batch file to put a file onto a remote computer

i am using it as such:
on the local computer
type f:\diagsfile.txt | nc %ip_add1% 1234
where diagsfile.txt is the text file i'd like to port to the nc (netcat command) at ip address %ip_add1% on port 1234

on the remote computer i use:
nc -l -p 1234 >diagsfile.txt

so on the remote computer netcat (nc) opens a listening port which will accept input and put it into the diagsfile.txt file locally


what my question is .... is there a way to eliminate the second step, either by logging into the remote computer using credentials(probably via netcat), or by stealth putting it on the remote computer ...

i'd like to eliminate the second step of opening the port and have to do the execution only on the initiating computer

all this is ( of course ) taking for granted that the firewall is turned off

thanks in advance

solution must be scriptable(batch file)
Comment
Watch Question
The More I know, the more I don't know
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE