Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benami171/my_netcat
Basic implementation of Netcat, using TCP, UDP, UNIX Domain Socket Stream, Unix Domain Socket Datagram.
https://github.com/benami171/my_netcat
netcat tcp-socket udp-socket unix-socket
Last synced: 17 days ago
JSON representation
Basic implementation of Netcat, using TCP, UDP, UNIX Domain Socket Stream, Unix Domain Socket Datagram.
- Host: GitHub
- URL: https://github.com/benami171/my_netcat
- Owner: benami171
- Created: 2024-07-06T10:10:37.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-07-08T12:03:31.000Z (6 months ago)
- Last Synced: 2024-07-09T12:40:58.866Z (6 months ago)
- Topics: netcat, tcp-socket, udp-socket, unix-socket
- Language: C
- Homepage:
- Size: 123 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# MyNetcat program
## Introduction
In this project, we developed our own netcat program. This program supports open communications across various protocols, enabling routing of standard input (stdin) and standard output (stdout) through socket file descriptors based on the specified flags. This allows us to facilitate communication between users by opening clients and servers.
## Authors
This project was developed collaboratively by:
- [Gal Ben Ami](https://github.com/benami171)
- [Chanan Helman](https://github.com/chanan-hash)## Flags
1. -e: Executes a shell command
2. -i: Gets input from a socket.
3. -o: Directs the output to a socket.
4. -b: Sends input and output to the same socket.
5. -t: Sets a timeout for the execution of the program when using the **UDP** protocol.## Protocols
This program supports four types of protocols:1. **TCP**
2. **UDP**
3. **UNIX Domain Socket Stream**
4. **UNIX Domain Socket Datagram**You can also mix protocols, for example, by opening a **UDP** server and connecting with a **TCP** client.
> Note: All datagram sockets (UDP and UDS datagram) will wait for dummy input from the client to accept the connection before starting the execution of the program.
## How to use
First, clone the repository using the following command:```bash
git clone https://github.com/chanan-hash/OS-Ex2.git
```
Each folder has its own `Makefile` for each step. The final version is in the `Q6` folder, which includes all the protocols. A recursive `Makefile` is also available if needed.### sketch for the commands
To use the sockets, follow this format after the flag:1. TCP server: `TCPS`
2. TCP client: `TCPC,`
3. UDP server: `UDPS`
4. UDP client: `UDPC,`
5. UDS stream server: `UDSSS`
6. UDS stream client: `UDSCS`
7. UDS datagram server: `UDSSD`
8. UDS datagram client: `UDSCD`## Testing
To test and communicate with our program, we used Linux netcat to avoid writing separate clients and servers for each protocol. The list of commands and usage instructions are in the ```Q6``` folder under ***work_list.txt***.### -e flag
In the examples below, the `-e` flag is used to execute a command for a tic-tac-toe game implemented in the ```ttt.c``` file in each folder. Executing the command without the `-e` flag will simply facilitate commuincation between two ends, like a chat.## Command exmpales:
Opening a TCP server and waiting for input from a client. Output goes to stdout:```bash
# server
./mync -e "./ttt 123456789" -i TCPS9876
# client
nc localhost 9876
```Oppening a TCP client and wait for a input from a server. output go to the client
```bash
#server
nc -l -p 9876
#client
/mync -e "./ttt 123456789" -o TCPC127.0.0.1,9876
```
For the whole command list you can check in
[Q6-worklist](./Q6/works_list.txt)