Netcat Tool For Mac

Active9 months ago

Category: Adware and PUAs. Download our free Virus Removal Tool - Find and remove threats your antivirus missed. Download our free Anti-Virus for Mac OS X. Netcat is an old tool (dates back to 1995!) and is popularly called the “swiss army knife” utility of a network/security engineer. The main purpose of netcat is to “read and write data across network connections”; however, it also has an inbuilt port scanner.

I have very limited (almost no) knowledge of how netcat works other than I've managed to get one Mac mini to listen on port 13370 [using nc -l 13370] (for TCP commands?) and I have a MacBook that has connected to the Mac mini using [nc 192.168.1.xxx 13370], and whatever I type in Terminal on the MacBook shows up (echoes?) on the Mac mini's Terminal.

I want to be able to tell the Mac mini to open a file (also stored on the Mac mini), from another device on the same LAN. So currently I'm using the MacBook, but ultimately I want to send commands from a home automation app that I am making, to for example play a video on the Mac mini which is connected to a TV screen. Or any other command that you could usually do in Terminal. My app cannot connect to the Mac mini using SSH which is why I'm trying this way.

What command would I need to send to open the file? IS there some format that I should use etc? Grateful for any help.

manaman
manamanmanaman

3 Answers

The netcat tool is simply a network connection tool. It can listen on any port and can connect to any port. It can output that information or even have data piped to it. It is a very useful too. Unfortunately, it only listens and sends information; it does not execute any commands itself. Therefore, netcat is not the tool for what you are wanting to do. The same is true of telnet.

In order to run commands on a remote server, you would need some software that is running on that remote server which would accept those commands. The tool to use for executing commands on a remote server is SSH. The listening server would be running the SSHD daemon. You could go through the trouble of trying to find a way to hack into the server some other way, but since you have access to that device already, that would really be more trouble than it would be worth since SSH already exists.

You say that your application cannot connect to SSH, but if it has access to netcat, then I would recommend using whatever access that is to gain access to SSH, and execute your commands from there.

If the way that you are connecting to netcat is that you have it listening on a port and the only thing your application can do is to connect to that port, then what you are wanting is to make some sort of an API, or some software which can handle requests over a port and use them to execute commands on the terminal through SSH. I found this article with some suggestions for doing so in BASH:

Once you are able to get the request into a shell script, you can either make that script execute your commands directly, or you could write additional scripts which are triggered by the listening software. I would have this software listening on the client, rather than on the remote server, and you could access it over localhost (127.0.0.1). Also, remember to add an SSH key so that your connection to the remote server would not require any passwords to be used. This article may help with that:

DKingDKing
Netcat

You can create a reverse shell on MacOS (on computer 1) like this:

And then connect to it from another computer (computer 2) using one of these netcat commands (depends on the implementation):

or

Now you can type in bash commands on computer 2 and they will get executed on the computer on which the remote shell is running (computer 1).

rahuldottech

Adware Removal Tool For Mac

rahuldottech
4,0255 gold badges27 silver badges53 bronze badges

Thanks everyone for your help on this, your help contributed after much trial and error to me eventually finding a way to do what I wanted. I decided in the end not to try and connect with the Mac itself via telnet, but rather the VLC app directly which has its own telnet server on port 4212. I kept getting 'connection refused' when trying to telnet to the Mac, but VLC on port 4212 connects fine, as long as a password is set in VLC.

Controlling VLC was the main thing I wanted to do so I am happy with this. My app is also able to send commands the same way the Mac client does via Terminal, so all good. Thanks once again everyone!

manamanmanaman

Not the answer you're looking for? Browse other questions tagged macterminaltcpnetcat or ask your own question.

Active1 year, 11 months ago

I mean a package of tools like those in the Kali Linux distribution.

eccstartupeccstartup
2083 gold badges5 silver badges13 bronze badges

4 Answers

The closest thing I know of is HackPorts.

HackPorts was developed as a penetration testing framework with accompanying tools and exploits that run natively on Mac platforms. HackPorts is a ‘super-project’ that leverages existing code porting efforts, security professionals can now use hundreds of penetration tools on Mac systems without the need for Virtual Machines.

n1000n1000Netcat 1.11
3,8735 gold badges20 silver badges59 bronze badges

Run Kali in a VM and get a supported USB 802.11 dongle and a USB ethernet adapter and forward both to the Kali VM.

While stuff like aircrack-ng and Kismet might work on OS X, having a proper full Linux system makes pentesting a lot easier.

Try it with stuff like VirtualBox!

Netcat Source

John KeatesJohn Keates

While I am generally less-than satisfied with security testing on OS X, many Kali-inherited utilities run fine under OS X via HomeBrew, e.g., afl-fuzz, aircrack-ng, amap, argus, arp-scan, arping, binutils, binwalk, bro, capstone, cowpatty, crunch, ettercap, hachoir, hping, ideviceinstaller, ike-scan, ipv6toolkit, john, lft, libdnet, libimobiledevice, libnet, masscan, net-snmp, netcat, nikto, nmap, openssl, ophcrack, p0f, postgresql, pwnat, pwntools, radare2, reaver, ruby, sipsak, skipfish, sleuthkit, snort, socat, sqlmap, ssdeep, ssldump, stunnel, theharvester, usbmuxd, volatility, wireshark, zmap -- and many others.

Primary reason I mentioned postgresql and ruby above is because these can be time savers when installing metasploit-framework.

There are many missing utilities when compared to huge Debian repos such as Kali Linux or even larger community-driven repos like ArchAssault. However, some pen testers (and pen-test tool developers!) are using OS X as their primary platform, as seen in GitHub and other project repos such as Arachni, blacksheepwall, cookiescan, et al. Other key tools such as dirb, sslyze, and similar can be easily compiled under OS X. Ones that rely on interpreters such as Go, Lua, Python, and Ruby are often much easier than metasploit-framework to get working under OS X. Install Python modules through brew-pip for added benefits and tie-ins to HomeBrew and install Ruby modules via gem after installing it via HomeBrew and making /usr/local/bin a preferred path over /usr/bin.

In addition to what has been said so far, VMWare ESXi in VMWare Fusion Pro on OS X using a high-end, maxed-out-DRAM MacBook Pro makes a good virtualized environment for security testing and learning -- http://www.slideshare.net/c0ncealed/step-on-in-the-waters-fine-an-introduction-to-security-testing-within-a-virtualized-environment-39596149

In this way, I believe that OS X makes a good virtualization host for security testing, but one may want to rethink using it as a platform to target production-level attacks from. There are many reasons for this, but the primary being that critical security patches for client-aware tools are not quite as up-to date when compared to Arch Linux, Ubuntu, RedHat/CentOS, or even Debian. A secondary factor is that it has been historically easy to escalate privileges to root, with no way to add SELinux, GRSecurity, or DISA STIG hardening practices to OS X in the way one can with standardized Linux operating systems, such as RHEL or Debian. Some people do consider running OpenBSD or Ubuntu on Apple bare metal for these reasons and others. It is possible to run OS X under VMWare Workstation for Linux, but this is likely not an Apple-approved scenario.

There is also the Docker way, seen here -- https://www.youtube.com/watch?v=gC_vm1wc-AY -- which I am definitely going to test out

atdreatdre

Open http://sectools.org/ and find the tools you want. Some of the tools are available for Mac. Good luck...

Cuanq GigabyteCuanq Gigabyte

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged security .