Netcat on Sailfish
hi there, I found that nc is available in recovery mode but it isn't available in normal mode. Is there a way to use nc in normal mode??
We have moved to a new Sailfish OS Forum. Please start new discussions there.
hi there, I found that nc is available in recovery mode but it isn't available in normal mode. Is there a way to use nc in normal mode??
Alternative bash-based solution :
Remember that bash not only supports regular expressions but even features a working network stack.
This comes very handy in situations like this (debugging on a small embed device that might not have netcat installed on it, but has a not too out-dated version of bash on it).
If the netcat on you desktop/laptop is the one in listen mode in your pipe, than you can simply send data to it using :
echo "test" > /dev/tcp/${IP_DESKTOP}/${LISTEN_PORT}
and fetch data from it with
cat < /dev/tcp/${IP_DESKTOP}/${LISTEN_PORT}
where IP_DESKTOP
is the ip address of you laptop/desktop (e.g.: 192.168.2.13)
and LISTEN_PORT
is the port on which you instructed netcat to listen for connections.
It also works with UDP connection (using /dev/udp/
in bash, and nc -u -l
in netcat).
This way you don't need to install any RPM from an external repository (openSUSE repositories for armv7hl seem to work for me usually)
Netcat is a small program, so it's far easy to compile and install:
-- Go netcat.sourceforge.net and download the source file (netcat-0.7.1.tar.gz)
-- Open Terminal or log into Sailfish through SSH. No need to devel-su, just proceed using the standard 'nemo' account.
-- Uncompress:
tar zxf ./Downloads/netcat-0.7.1.tar.gz
-- Enter directory:
cd ./Downloads/netcat-0.7.1
-- If you didn't previously, you must install a bunch of packages needed for compiling:
pkcon install gcc #(say Y when asked "Proceed with changes?")
pkcon install make
-- Configure:
./configure
-- Compile:
make
-- Install:
Option A: next step should be logging as root (devel-su) and type:
make install
Option B: but if you don't have Developer Mode enabled or you don't want to install stuff as 'root', just create a 'bin' directory at home:
mkdir ~/bin
Copy the Netcat executable (I'm renaming it to 'nc'):
cp -a src/netcat ~/bin/nc
and you're done.
-- The uncompressed directory is useless now. You can erase it (check the route carefully, 'rm -rf' is a very dangerous command; or just delete it with your favorite file browser)
cd ~/Downloads
rm -rf netcat-0.7.1
@Nieldk is today a void link, Error 404. Who has a good address instead?
prometheos de+it ( 2017-03-12 01:31:37 +0200 )editThe link got outdated as a new version of the netcat rpm got uploaded. Simply browse this page to get the latest link: https://download.opensuse.org/repositories/home:/assmannst/openSUSE_Factory_ARM/armv7hl/.
tfischer ( 2018-04-17 22:07:27 +0200 )editThis thread is public, all members of Together.Jolla.Com can read this page.
Asked: 2015-09-01 10:47:22 +0200
Seen: 1,664 times
Last updated: Apr 25 '18
What is the best maps/navigation application to use on Jolla? [answered]
HowTo: Connecting to Jolla via SSH over USB [answered]
Clarification of open-source policy [answered]
Settings -> Sync -> How to sync?
What does "Reset device" actually do? [answered]
Where does Media look for content? [not relevant]
Bumping this as I'm also looking for netcat. I'm sure I saw it somewhere on openrepo's but I can't seem to find it anymore.
Niju ( 2015-09-26 18:24:16 +0200 )editI want to send an UDP message to my server, so netcat would be the easiest way. nc is absolutely basic functionality and is a must have!
Edit: Solved it with python script! This works out of the box ;)
SaimenSays ( 2015-10-08 00:17:44 +0200 )editFor out of the box with TCP and UDP, remember that bash can do it too (see answer below)
DrYak ( 2018-04-25 20:13:59 +0200 )edit