forked from root/public
![39002518+OGordoo@users.noreply.github.com](/git/assets/img/avatar_default.png)
![GitHub](/git/assets/img/avatar_default.png)
41 changed files with 531 additions and 241 deletions
@ -0,0 +1,62 @@ |
|||||||
|
#### Functional |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with no arguments. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `<file name>`. |
||||||
|
###### Does it displays the same file? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `<directory name>`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-l`. |
||||||
|
###### Does it displays the same files and/or folders with the same display? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `-l <file name>`. |
||||||
|
###### Does it displays the same file with the same display? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `-l <directory name>`. |
||||||
|
###### Does it displays the same files and/or folders with the same display? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-l /usr/bin`. |
||||||
|
###### Does it displays the same files and/or folders with the same display? Be aware of symbolic links. |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-R`, in a directory with folders in it. |
||||||
|
###### Does it displays the same files and/or folders? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-a`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-r`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-t`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the flag: `-la`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `-l -t <directory name>`. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
##### Run both my-ls-1 and the system command `ls` with the arguments: `-lRr <directory name>`, in which the directory chosen contains folders. |
||||||
|
###### Does it displays the same files and/or folders in the same order? |
||||||
|
|
||||||
|
#### General |
||||||
|
|
||||||
|
###### +Does the program runs with colors as in the ls command? |
||||||
|
###### +Does the program has other flags except for the mandatory ones? |
||||||
|
|
||||||
|
##### Try running the program with `-R ~` and with the command time before the program name (ex: "time ./my-ls-1 -R ~"). |
||||||
|
###### +Is the real time less than 1,5 seconds? |
||||||
|
|
||||||
|
#### Basic |
||||||
|
|
||||||
|
###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? |
||||||
|
###### +Is there a test file for this code? |
||||||
|
###### +Are the tests checking each possible case? |
||||||
|
|
||||||
|
#### Social |
||||||
|
|
||||||
|
###### +Did you learn anything from this project? |
||||||
|
###### +Would you recommend/nominate this program as an example for the rest of the school? |
@ -0,0 +1,44 @@ |
|||||||
|
## my-ls-1 |
||||||
|
|
||||||
|
### Objectives |
||||||
|
|
||||||
|
- my-ls-1 consists on creating your own `ls` command. |
||||||
|
|
||||||
|
- The `ls` command shows you the files and folders of the directory specified after the command. By exclusion of this directory, it shows the files and folders of the present directory. |
||||||
|
|
||||||
|
- The behavior of your `ls` must be identical to the original `ls` command with the following variations : |
||||||
|
- You must incorporate in your project at least the following flags of the `ls` command : |
||||||
|
- `-l` |
||||||
|
- `-R` |
||||||
|
- `-a` |
||||||
|
- `-r` |
||||||
|
- `-t` |
||||||
|
- Note that you can use various flags, in various ways, just like in `ls`. |
||||||
|
- When it comes to the `ls -l` display, it must be identical to the system command. |
||||||
|
- Other flags displays are up to you. |
||||||
|
|
||||||
|
This project will help you learn about : |
||||||
|
|
||||||
|
- Unix system |
||||||
|
- Ways to receive data. |
||||||
|
- Ways to output data. |
||||||
|
- Manipulation of strings. |
||||||
|
- Manipulation of structures. |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
- Your project must be written in **Go**. |
||||||
|
- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). |
||||||
|
- It is recommended that the code should present a **test file**. |
||||||
|
|
||||||
|
### Hint |
||||||
|
|
||||||
|
- We strongly recommend that you account for the implications of the option `-R` from the very beginning of your code. |
||||||
|
|
||||||
|
- The order that files and folders appear must be taken in consideration. |
||||||
|
|
||||||
|
- We suggest that you consult the `ls` command manual. |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
You can see how the `ls` command works, by using it on your terminal. |
@ -0,0 +1,55 @@ |
|||||||
|
#### Functional |
||||||
|
|
||||||
|
##### Try running `"./net-cat -p 8080"`. |
||||||
|
###### Is the server listening for connections? |
||||||
|
|
||||||
|
##### Try opening 3 terminals, run on the first terminal the command `"./net-cat -p <port>"` and on the second and third terminal run the command `"./net-cat <host ip> <port>"`. |
||||||
|
###### Does both clients connect to the server with success? |
||||||
|
|
||||||
|
##### Try opening 4 terminals, run on the first terminal the command `"./net-cat -u -p <port>"` and on the second, third and fourth terminal run the command `"./net-cat -u <host ip> <port>"`. |
||||||
|
###### Does all clients connect to the server with [UDP](https://www.privateinternetaccess.com/blog/2018/12/tcp-vs-udp-understanding-the-difference/) connection? |
||||||
|
|
||||||
|
##### Try creating a server and 2 Clients. |
||||||
|
###### Do all Clients receive a message informing that the Client joined the chat? |
||||||
|
|
||||||
|
##### Try creating a server and 2 Clients and send a message using the first Client. |
||||||
|
###### Does the second Client receive the message? |
||||||
|
|
||||||
|
##### Try creating a server and 1 Client and send some messages using this Client. Then create a new Client. |
||||||
|
###### Can the new Client see all the messages? |
||||||
|
|
||||||
|
##### Try creating a server and 3 Clients and send a message using the second Client. |
||||||
|
###### Does all the Clients(first, second and third) received the same message? |
||||||
|
|
||||||
|
##### Try creating a server and use 2 or 3 different computers and create for each computer one Client. |
||||||
|
###### Did the server/Clients connected with success? |
||||||
|
|
||||||
|
##### Try creating a server and 4 Clients and disconnect one of the Clients. |
||||||
|
###### Does the rest of the Clients stay connected? |
||||||
|
|
||||||
|
##### Try creating a server and 3 Clients and disconnect one of the Clients. |
||||||
|
###### Does the rest of the Clients receive a message notifying that the Client left? |
||||||
|
|
||||||
|
##### Try creating a server and 3 Clients. Then send messages between the Clients. |
||||||
|
###### Are the messages identified by the name of each Client and the time that the messages was sent? |
||||||
|
|
||||||
|
###### Is the connections between server and Clients well established? |
||||||
|
|
||||||
|
#### General |
||||||
|
|
||||||
|
###### +Can the Clients change their names? |
||||||
|
###### +Is the chat group informed if a Client changes his name? |
||||||
|
###### +Does the server produce logs about Clients activities? |
||||||
|
###### +Is there more NetCat flags implemented? |
||||||
|
|
||||||
|
#### Basic |
||||||
|
|
||||||
|
###### +Does the project runs quickly and effectively? (Favoring recursive, no unnecessary data requests, etc) |
||||||
|
###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? |
||||||
|
###### +Is there a test file for this code? |
||||||
|
|
||||||
|
#### Social |
||||||
|
|
||||||
|
###### +Did you learn anything from this project? |
||||||
|
###### +Can it be open-sourced / be used for other sources? |
||||||
|
###### +Would you recommend/nominate this program as an example for the rest of the school? |
@ -0,0 +1,121 @@ |
|||||||
|
## net-cat |
||||||
|
|
||||||
|
### Objectives |
||||||
|
|
||||||
|
This project consists on recreating the **NetCat in a Server-Client Architecture** that can run in a server mode on a specified port listening for incoming connections, and it can be used in client mode, trying to connect on a specified port and transmitting information to the server. |
||||||
|
|
||||||
|
- NetCat, `nc` the system command, is a computer network utility for reading from and writing to network connections using TCP or UDP. It is used for anything involving TCP, UDP, or UNIX-domain sockets, it is able to open TCP connections, send UDP packages, listen on arbitrary TCP and UDP ports... |
||||||
|
|
||||||
|
- To see more information about NetCat inspect the manual `man nc`. |
||||||
|
|
||||||
|
Here is a simple example of connection and transmission between Server-Client by creating a TCP socket between server and client. |
||||||
|
|
||||||
|
- Open two terminals, one for the server and the other for Client. |
||||||
|
- Use the following commands for the server side : |
||||||
|
|
||||||
|
```console |
||||||
|
stuednt$ mawk -W interactive '$0="\033[1;32mServer: \033[0m"$0' | nc -l -p <port> |
||||||
|
Client: Hello it's the CLIENT talking |
||||||
|
hello there |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
- Use the following commands for the client side : |
||||||
|
|
||||||
|
```console |
||||||
|
stuednt$ mawk -W interactive '$0="\033[1;32mClient: \033[0m"$0' | nc <host ip> <port> |
||||||
|
Hello it's the CLIENT talking |
||||||
|
Server: Hello there |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
- To see the host IP use the command `ifconfig` on the host machine. |
||||||
|
|
||||||
|
Your project must work in a similar way that NetCat works, in other words you must create a group chat. The project must present : |
||||||
|
|
||||||
|
- TCP or UDP connection between server and multiple clients (relation of 1 to many), the type of connection must be established by using a flag, just like `nc`, by default it uses TCP connection, if you want to use UDP connection present the flag `-u`. |
||||||
|
- Each Client must have an user name. |
||||||
|
- Clients must be able to send messages to the chat. |
||||||
|
- Messages sent, must be identified by the time that was sent and the user name of who sent the message. |
||||||
|
- If a Client joins the chat, all the messages sent to the chat must be uploaded to the new Client. |
||||||
|
- If a Client connects to the server, the rest of the Clients must be informed by the server that the Client joined the group. |
||||||
|
- If a Client exits the chat, the rest of the Clients must be informed by the server that the Client left. |
||||||
|
- All Clients must receive the messages sent by other Clients. |
||||||
|
- If a Client leaves the chat, the rest of the Clients must not disconnect. |
||||||
|
|
||||||
|
This project will help you learn about : |
||||||
|
|
||||||
|
- Manipulation of structures. |
||||||
|
- [Net-Cat](https://linuxize.com/post/netcat-nc-command-with-examples/) |
||||||
|
- [TCP/UDP](https://www.privateinternetaccess.com/blog/2018/12/tcp-vs-udp-understanding-the-difference/) |
||||||
|
- TCP/UDP connection |
||||||
|
- TCP/UDP socket |
||||||
|
- [Channels](https://tour.golang.org/concurrency/2) |
||||||
|
- [Goroutines](https://tour.golang.org/concurrency/1) |
||||||
|
- IP and [ports](https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers) |
||||||
|
|
||||||
|
### Hints |
||||||
|
|
||||||
|
- Try to find out more about the flags `-u`, `-p` and `-l`. |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
- Your project must be written in **Go**. |
||||||
|
- Your project must use TCP or UDP. |
||||||
|
- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). |
||||||
|
- It is recommended that the code should present a **test file** for the server connection and the client connection. |
||||||
|
- You have to be able to handle the errors from server side and client side. |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a simple example of a group chat : |
||||||
|
|
||||||
|
- Server side : |
||||||
|
|
||||||
|
```console |
||||||
|
student$ ./net-cat -p 8080 |
||||||
|
listening on port 8080.... |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
- Two Clients running at the same time |
||||||
|
|
||||||
|
- Client 2 : |
||||||
|
|
||||||
|
```console |
||||||
|
stuednt$ ./net-cat 192.168.1.123 8080 |
||||||
|
wellcome, you are connected |
||||||
|
|
||||||
|
enter user name : client2 |
||||||
|
your name is client2 |
||||||
|
|
||||||
|
client2 joined the chat... |
||||||
|
client1 joined the chat... |
||||||
|
|
||||||
|
hello |
||||||
|
client2 at 18:12- hello |
||||||
|
client1 at 18:13- hello man |
||||||
|
how are you? |
||||||
|
client2 at 18:15- how are you? |
||||||
|
client1 left the chat... |
||||||
|
|
||||||
|
``` |
||||||
|
|
||||||
|
- Client 1 : |
||||||
|
|
||||||
|
```console |
||||||
|
stuednt$ ./net-cat 192.168.1.123 8080 |
||||||
|
wellcome, you are connected |
||||||
|
|
||||||
|
enter user name : client1 |
||||||
|
your name is client1 |
||||||
|
|
||||||
|
client2 joined the chat... |
||||||
|
client1 joined the chat... |
||||||
|
|
||||||
|
client2 at 18:12- hello |
||||||
|
hello man |
||||||
|
client1 at 18:13- hello man |
||||||
|
client2 at 18:15- how are you? |
||||||
|
^C |
||||||
|
``` |
Loading…
Reference in new issue