sometime in 2008!
Basic UsageThe basic usage of NetKitty is really simple. The command syntax is as follows:
- -hub: Activates the hub mode (see below).
- -shell: Activates the shell mode (see below).
- -os: Terminates application when all the clients disconnect.
- -client: Configures nk to connect to a remote system.
- -server: Configures nk to accept connections from remote systems.
- Type of communication
- T : Uses TCP for connect/accept communications
- U : Uses UDP for connect/accept communications
- B : Uses Bluetooth rfcom for connect/accept communications
- Address. Will take the form of an IP address (x.x.x.x) or a Bluetooth address (XX:XX:XX:XX:XX:XX) if B was specified, where x represents decimal numbers and XX hexadecimal ones.
- Port. This is the TCP, UDP communication port or the Bluetooth channel is the B option was used.
Instant Messaging. The -hub flagThe -hub flag converts NetKitty in a simple Instant Messaging system. This flag makes nk to resend anything it gets from any link to any other link it is managing.
Let's see how to use it to set up a simple Instant Messaging System with nk.
Choose a machine as server and execute the following
nk -hub -server T,10000
Now, anyone how wants to chat on-line simply runs:
nk -client T,remote_ip,10000
Remember to substitute "remote_ip" for the IP address of the machine running the server side.
Poor's Man TelnetThe -shell flags instructs NetKitty to start an interactive shell (/bin/sh -i), whenever a connection is established. In order to use this feature almost one server port should be defined.
A simple example, providing shell access to a given device either using a normal TCP connection or a bluetooth link:
From this point on, any connection to TCP port 5000 or any Bluetooth connection through channel 5, will provide a rudimentary shell to any client.
Network DistributorYou can use NetKitty to distribute a data source to several remote clients in an easy way. We had used this features several times to make a simple one-way client connecting to different servers and sending the same data to each one... without modifying neither the client nor the server.
In order to illustrate our example, a real live example will be taken. Suppose that we have a visual tracking system that send positional information to a simulation engine trough a TCP/IP channel. The simulation engine TCP port will be 10000.
Now, we want to control two different simulation engines from the same optical tracking system, so we use nk for this task. In the machine running the optical tracking system we launch nk with this line:
Now we only need to configure our tracking system to send data to a "virtual" simulation engine running in localhost (127.0.0.1:10000).
Simple backupNetKitty allows to perform backups in the same way that netcat. As NetKitty allows the server to accept further connections, the -os flags should be used to instruct the server side to finish when the client disconnects.
So, in order to perform a backup, The following commands should be used.
In the machine where the backup will be stored run:
In the machine you want to backup run:
Bluetooth ConnectionsNetKitty supports rfcomm bluetooth connection, providing an additional mechanism to connect different devices. We can seamless mix network and bluetooth devices in our communications using nk.
This example show how to use nk to gather information from different sensor devices. Some of then are equipped with wifi devices, so they can be managed as normal TCP connections, but other uses bluetooth to transmit the date collected. So, this nk command-line will do the job.
With the line above, NetKitty will accept TCP connections to port 10000, and rfcomm bluetooth connection on channel 4.
If you don't want to code all the bluetooth socket stuff in your sensor systems applications, just let nk transmit your data out. Let's suppose that your data application dumps data to stdout and that our server is in Bluetooth address 30:F2:61:CE:B2:A3. Then this line will be useful:
And we are done.