winapps-org / winapps

The winapps main project, forked from https://github.com/Fmstrat/winapps/
842 stars 37 forks source link

Ambiguous netcat dependency with Debian/Ubuntu? #192

Open itiligent opened 1 month ago

itiligent commented 1 month ago

Hi, Just checking on this now as recently the Readme install intructions have changed...

For Debian/ Ubuntu, the readme says sudo apt install -y dialog freerdp3-x11 iproute2 libnotify-bin netcat

However, in both Debian & Ubuntu the netcat package is called other things such as netcat-traditional or netcat-openbsd and there is also ncat in there (the nmap implementation of netcat I assume)

Just wondering which is the correct (ncat?) and what this inclusion supports?

thankyou!

KernelGhost commented 1 month ago

netcat is required by WinApps to check if Windows has an open RDP port before attempting to establish an RDP connection. The command used is:

if ! timeout 5 nc -z "$RDP_IP" 3389 &>/dev/null; then
    echo "PORT NOT OPEN"
else
    echo "PORT OPEN"
fi

I do not use a Debian-based distribution, so I referred to the installation instructions from this source. Is this information outdated? Could you please check which package name corresponds to the required netcat utility?

itiligent commented 1 month ago

From what I can see going back to Debian 11 & and Ubuntu 22, the nc utility is already built in by default which I assume is why it has always worked for me without adding netcat specifically. See below apt-cache search (is common across Debian/Ubuntu):

david@ub24-dt:~$ apt-cache search netcat
netcat-openbsd - TCP/IP swiss army knife
socat - multipurpose relay for bidirectional data transfer
corkscrew - tunnel TCP connections through HTTP proxies
fling - Transfer data from stdin over network to destination quickly
gsocket - Allows two machines on different networks to communicate with each other
kafkacat - producer and consumer for Apache Kafka (transitional package)
kcat - producer and consumer for Apache Kafka
libexpect-perl - Perl Expect interface
multimon-ng - digital radio transmission decoder
ncat - NMAP netcat reimplementation
netcat-traditional - TCP/IP swiss army knife
netrw - netcat like tool with nice features to transport files over network
netsed - network packet-altering stream editor
piu-piu - Horizontal scroller game in bash for cli.
david@ub24-dt:~$
david@ub24-dt:~$ nc
usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
          [-m minttl] [-O length] [-P proxy_username] [-p source_port]
          [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit]
          [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]
          [destination] [port]
KernelGhost commented 1 month ago

Could you please provide the output of the following command?

dpkg --search $(which nc)
itiligent commented 1 month ago

debian 12 / LMDE6 / Ubuntu 22 & 24 all give same result

david@ub24-dt:~$ dpkg --search $(which nc)
dpkg-query: no path found matching pattern /usr/bin/nc
lynx-LuchS commented 1 day ago

sudo nano /etc/apt/sources.list

deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware

git clone --recurse-submodules --remote-submodules https://github.com/winapps-org/winapps.git && cd winapps

sudo apt update && sudo apt install -y dialog freerdp3-x11 iproute2 libnotify-bin netcat-traditional

sudo nano ~/.config/winapps/winapps.conf

KernelGhost commented 4 hours ago

It turns out that netcat is now a virtual package in Debian, as noted here.

To investigate, I used a Podman Debian container with the following commands:

podman pull debian:latest
podman run --rm -it debian:latest /bin/bash

Running which nc initially produced no output and an exit status of 1.

Running apt install netcat produced this output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package netcat is a virtual package provided by:
  netcat-openbsd 1.219-1
  netcat-traditional 1.10-47
You should explicitly select one to install.

E: Package 'netcat' has no installation candidate

Since the OpenBSD variant is more recent, I proceeded with apt-get install netcat-openbsd.

Following the installation, which nc produced /usr/bin/nc.

Given this, would it be acceptable to update the documentation to specify netcat-openbsd?

@itiligent Is there any way to figure out which version of netcat you seem to have installed by default?