0% found this document useful (0 votes)
373 views

d00 en

This document provides instructions for 12 exercises that are part of the Day 00 C Piscine curriculum at 42. Students are instructed to complete the exercises in order, submitting specific files and following directions for file permissions and names. Commands like tar, ls, and LDAP queries are used to complete the exercises which increase in difficulty and cover topics like permissions, directories, and Kerberos authentication.

Uploaded by

Peter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
373 views

d00 en

This document provides instructions for 12 exercises that are part of the Day 00 C Piscine curriculum at 42. Students are instructed to complete the exercises in order, submitting specific files and following directions for file permissions and names. Commands like tar, ls, and LDAP queries are used to complete the exercises which increase in difficulty and cover topics like permissions, directories, and Kerberos authentication.

Uploaded by

Peter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

C Piscine

Day 00

Staff 42 pedago@42.fr

Summary: This document is the subject for Day00 of the C Piscine @ 42.
Contents
I Instructions 2

II Foreword 4

III Exercise 00 : Pre-requisites 6

IV Exercise 01 : testDay00 7

V Exercise 02 : Oh yeah, mooore... 8

VI Exercise 03 : Connect me! 10

VII Exercise 04 : Who am I ? 11

VIII Exercise 05 : Who’s with me ? 12

IX Exercise 06 : Hello! 13

X Exercise 07 : midLS 15

XI Exercise 08 : Z 16

XII Exercise 09 : diff 17

XIII Exercise 10 : clean 18

XIV Exercise 11 : Illusions, not tricks, Michael... 19

1
Chapter I

Instructions

• Only this page will serve as reference; do not trust rumors.

• Watch out! This document could potentially change up to an hour before submis-
sion.

• These exercises are carefully laid out by order of difficulty - from easiest to hardest.
We will not take into account a successfully completed harder exercise if an easier
one is not perfectly functional.

• Make sure you have the appropriate permissions on your files and directories.

• You have to follow the submission procedures for every exercise.

• Your exercises will be checked and graded by your fellow classmates.

• On top of that, your exercises will be checked and graded by a program called
Moulinette.

• Moulinette is very meticulous and strict in its evaluation of your work. It is entirely
automated and there is no way to negotiate with it. So if you want to avoid bad
surprises, be as thorough as possible.

• Exercises in Shell must be executable with /bin/sh.

• You cannot leave any additional file in your directory than those specified in the
subject.

• Got a question? Ask your peer on the right. Otherwise, try your peer on the left.

• Your reference guide is called Google / man / the Internet / ....

• Check out the "C Piscine" part of the forum on the intranet.

• Examine the examples thoroughly. They could very well call for details that are
not explicitly mentioned in the subject...

2
C Piscine Day 00

• By Odin, by Thor! Use your brain!!!

The time and date displayed on the intra indicate the deadline for
your submission. Past that deadline, you won’t be able to hand in
anything more. These time and date also indicate the start of the
peer-evaluation period for the corresponding C Piscine date. This
peer-evaluation period lasts exactly 24hrs. Once those 24hrs are
up, your missing peer-grading will become 0s and you’ll receive
Moulinette’s grade.

3
Chapter II

Foreword

Here are the lyrics for City Hunter’s theme song "Moonlight Shadow":

The last time ever she saw him


Carried away by a moonlight shadow
He passed on worried and warning
Carried away by a moonlight shadow.
Lost in a riddle that Saturday night
Far away on the other side.
He was caught in the middle of a desperate fight
And she couldn’t find how to push through

The trees that whisper in the evening


Carried away by a moonlight shadow
Sing a song of sorrow and grieving
Carried away by a moonlight shadow
All she saw was a silhouette of a gun
Far away on the other side.
He was shot six times by a man on the run
And she couldn’t find how to push through

[Chorus]
I stay, I pray
See you in Heaven far away...
I stay, I pray
See you in Heaven one day.

Four A.M. in the morning


Carried away by a moonlight shadow
I watched your vision forming
Carried away by a moonlight shadow
A star was glowing in the silvery night
Far away on the other side
Will you come to talk to me this night
But she couldn’t find how to push through

[Chorus]

4
C Piscine Day 00

Far away on the other side.


Caught in the middle of a hundred and five
The night was heavy and the air was alive
But she couldn’t find how to push through
Carried away by a moonlight shadow
Carried away by a moonlight shadow
Far away on the other side.

Unfortunately, this topic has nothing to do with City Hunter.

5
Chapter III

Exercise 00 : Pre-requisites

Exercise : 00

Pre-requisites
Notes : n/a

• Write an e-mail to kwame@42.fr.

• The subject of that email should be:

[Sir general deputy director][login][let me flatter you]

• Write nice things in the e-mail, using at least the following words:

42; autograph; master of the Universe; handsome; strong; idol; huge;


crank handle

Evidently "login" will be YOUR login.

6
Chapter IV

Exercise 01 : testDay00

Exercise 01

What are attributes anyway ?


Turn-in directory : ex01/
Files to turn in : testDay00.tar
Allowed functions : None
Notes : n/a

• Create a file called testDay00 in your submission directory.

• Figure out a way for the output to look like this (except for the “total 1” line):
$> ls -l
total 1
-r--r-xr-x 1 login wheel 40 Jun 1 23:42 testDay00
$>

• Once you’ve achieved the previous steps, execute the following command to create
the file to be submitted: tar -cf testDay00.tar testDay00.

"login" and "wheel" will be respectively replaced by your login and


your group.

A year will be accepted instead of the time, on the timestamp of the


file.

7
Chapter V

Exercise 02 : Oh yeah, mooore...

Exercise 02

Oh yeah, mooore...
Turn-in directory : ex02/
Files to turn in : exo2.tar
Allowed functions : None
Notes : n/a

• Create the following files and directories. Do what’s necessary so that when you
use the ls -l command in your directory, the output will looks like this :
$> ls -l
total 42
drwx--xr-x 2 login wheel XX Jun 1 20:47 test0
-rwx--xr-- 1 login wheel 4 Jun 1 21:46 test1
dr-x---r-- 2 login wheel XX Jun 1 22:45 test2
-r-----r-- 2 login wheel 1 Jun 1 23:44 test3
-rw-r----x 1 login wheel 2 Jun 1 23:43 test4
-r-----r-- 2 login wheel 1 Jun 1 23:44 test5
lrwxr-xr-x 1 login wheel 5 Jun 1 22:20 test6 -> test0
$>

• Once you’ve done that, run tar -cf exo2.tar * to create the file to be submitted.

You don’t have to reproduce the permissions of the test file 6.

8
C Piscine Day 00

"login" & "wheel" will respectively be replaced by your login and


your group.

You won’t be able to have the same "total 42" line as shown in the
example.

Don’t worry about what you’ve got instead of "XX".

A year will be accepted instead of the time, on the timestamp of the


files.

9
Chapter VI

Exercise 03 : Connect me!

Exercise 03

Kerberos
Turn-in directory : ex03/
Files to turn in : klist.txt
Allowed functions : None
Notes : n/a

• Make sure you have a valid (non-expired) Kerberos ticket. If you don’t have one
yet, get one.

• Once you’ve got at least one Kerberos ticket, write a list of all your tickets into a
file named klist.txt

The file’s name was not chosen randomly.

Those commands will be of use later in the day, so try not to forget
them!

10
Chapter VII

Exercise 04 : Who am I ?

Exercise 04

Who am I ?
Turn-in directory : ex04/
Files to turn in : who_am_i.sh
Allowed functions : None
Notes : n/a

• Now that you have a Kerkebos ticket, it’s time to find out who you are!

• As you may already know, all users at the school are on LDAP: some sort of
rudimentary digital phonebook - for those who remember what a phonebook is...

• In a file called who_am_i.sh, type in the command that will return only the value
of the distinguished name.

• For example, with a "test" Kerberos ticket :


%>sh who_am_i.sh
uid=test,ou=2013,ou=people,dc=42,dc=fr
%>

All commands to communicate with LDAP start with ... ldap.

The first four lines (starting with SASL) will never be taken into
account for mysterious reasons you’ll understand later on.

11
Chapter VIII

Exercise 05 : Who’s with me ?

Exercise 05

Who’s with me ?
Turn-in directory : ex05/
Files to turn in : people.sh
Allowed functions : None
Notes : n/a

• Now that you understand the basics of LDAP (sort of), you can start looking for
people.

• In a file called people.sh, type in the command that will list the cn list for all
accounts that have a uid starting with ’z’. This list will only show the cn, in reverse
alphabetical order, and NOT case-sensitive. There shouldn’t be any unecessary
empty lines.

LDAP search-filters have a specific syntax.

12
Chapter IX

Exercise 06 : Hello!

Exercise 06

Phone number
Turn-in directory : ex06/
Files to turn in : mobile-phone.ldif
Allowed functions : None
Notes : n/a

• Now that you’re LDAP experts, you are going to be able to add your phone number
into the mobile field.

Add your real number: your future teammates will be happy to know
how to reach you!

• Here’s an LDIF file template :


dn: uid=pnom,ou=people,dc=42,dc=fr
changetype: modify
delete: pouette

• To check if your command has worked, try to look yourself up on LDAP!

Don’t hesitate to fill in other fields if you’re up for it. However,


you don’t have all the permissions, we’re not idiots ;)

13
C Piscine Day 00

You can change your email address any time, via the ’email-address’
field.

14
Chapter X

Exercise 07 : midLS

Exercise 07

midLS
Turn-in directory : ex07/
Files to turn in : midLS
Allowed functions : None
Notes : n/a

• In a midLS file, place the command line that will list all files and directories in your
current directory (except for hidden files or any file that starts by a dot - yes, that
includes double-dots), separated by a comma, by order of creation date. Make sure
directories’ names are followed by a slash character.

What has not been asked for should not be done!

RTFM!

15
Chapter XI

Exercise 08 : Z

Exercise 08

Only the best know how to display Z


Turn-in directory : ex08/
Files to turn in : z
Allowed functions : None
Notes : n/a

• Create a file called z that returns "Z", followed by a new line, whenever the command
cat is used on it.
?>cat z
Z
?>

16
Chapter XII

Exercise 09 : diff

Exercise 09

Turn-in directory : ex09/


Files to turn in : b
Allowed functions : None
Notes : n/a

• Create a file b, so that :


%>cat -e a
STARWARS$
Episode IV, A NEW HOPE It is a period of civil war.$
$
Rebel spaceships, striking from a hidden base, have won their first victory against the evil
Galactic Empire.$
During the battle, Rebel spies managed to steal secret plans to the Empire's ultimate weapon, the
DEATH STAR,$
an armored space station with enough power to destroy an entire planet.$
$
Pursued by the Empire's sinister agents, Princess Leia races home aboard her starship, custodian of
the stolen plans that can save her people and restore freedom to the galaxy...$
$

%>diff a b > sw.diff

man patch

17
Chapter XIII

Exercise 10 : clean

Exercise 10

Turn-in directory : ex10/


Files to turn in : clean
Allowed functions : None
Notes : n/a

• In a file called clean place the command line that will search for all files - in the
current directory as well as in its sub-directories - with a name ending by ~, or a
name that start and end by #

• The command line will show and erase all files found.

• Only one command is allowed: no ’;’ or ’&&’ or other shenanigans.

man find

18
Chapter XIV

Exercise 11 : Illusions, not tricks,


Michael...

Exercise 11

Illusions, not tricks, Michael...


Turn-in directory : ex11/
Files to turn in : ft_magic
Allowed functions : None
Notes : n/a

• Create a magic file called ft_magic that will be formatted appropriately to detect
files of 42 file type, built with a "42" string at the 42nd byte.

man file

19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy