We have moved to a new Sailfish OS Forum. Please start new discussions there.
8

Netcat on Sailfish

asked 2015-09-01 10:47:22 +0300

vadd98 gravatar image

updated 2015-09-01 15:47:29 +0300

M.Bln. gravatar image

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??

edit retag flag offensive close delete

Comments

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 +0300 )edit

I 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 +0300 )edit

For 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 +0300 )edit

3 Answers

Sort by » oldest newest most voted
4

answered 2015-10-11 12:26:20 +0300

Mced gravatar image

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
edit flag offensive delete publish link more

Comments

it works, thanks a lot!!

vadd98 ( 2015-10-11 13:31:16 +0300 )edit
1

answered 2015-10-11 16:34:29 +0300

Nieldk gravatar image

No need to compile. You can download rpm here

http://t.co/duVmjgwEr9

edit flag offensive delete publish link more

Comments

@Nieldk is today a void link, Error 404. Who has a good address instead?

prometheos de+it ( 2017-03-12 01:31:37 +0300 )edit

The 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 +0300 )edit
5

answered 2018-04-25 18:11:16 +0300

DrYak gravatar image

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)

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
6 followers

Stats

Asked: 2015-09-01 10:47:22 +0300

Seen: 1,632 times

Last updated: Apr 25 '18