From 324b0e73d99f2a46e43d26f2bac286de4c9e9792 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 11:43:20 +0300 Subject: [PATCH 01/20] My solution --- SOLUTION | 32 ++++++++++++++++++++++++++++---- yourSolution.sh | 7 +++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/SOLUTION b/SOLUTION index 6c2aaec..086c64f 100644 --- a/SOLUTION +++ b/SOLUTION @@ -1,17 +1,41 @@ - << Change this line. The secret must be placed in the first line +814c5723c21e7e90a3eae36c8df3c513 Kernel System Calls ------------------- - +Strace command output shows all the system calls which has been made when we executed the file whatIdo. +It Checks if a file exists and is readable. +In the output we can see that the file executed and asked to replace the current program which is running on the CPU. +It asked to check where is the heap memory end in order to locate a place to the current program there. +It performs various operations such as opening files, writing to files, and closing them. +In the end, whatIdo exits with a status code of 0 which indicates on successful completion. Broken Symlink ------------------- - +The fix is to create a symlink (soft link) with an absolute path +The fix is to add the following line: +ABSOLUTE_PATH="$(pwd)/$FILENAME" Binary Numbers -------------- - \ No newline at end of file +A. 111 --> (2^0)*1 + (2^1)*1 + (2^2)*1 = 7 + 100 --> = 4 + 10110 --> = 22 + +B. Available decimal range represented by 8 bits binary numbers: 2^8 = 256 + +C. Given a 9 bits binary number, suggest a method to represent negative numbers between -255 to 255. + 1. The last bit represent the bit sign: `0` - will represent positive number, `1` - will represent negative number. + 2. There is a scale of numbers 128, 64, 32, 16, 8, 4, 2, 1 + 3. Check num fits to 128, if it does decrease 128 from num and continue to check the rest of the numbers on scale + if its not - go to the next number on the scale, to 64 and check if it fits. + +D. Suggest a method to represent a floating point numbers, using 8 bits binary numbers: + 1. Check if the last bit represent the bit sign - if yes: `0` - will represent positive number, `1` - will represent negative number. + 2. Take the num and separate the num with its Fraction. + 3. The num check if it fits to 128, if it does decrease 128 from num and continue to check the rest of the numbers on scale + if its not - go to the next number on the scale, to 64 and check if it fits. + 4. The fraction you take and multiplied by 2 diff --git a/yourSolution.sh b/yourSolution.sh index e69de29..1cf3ae4 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -0,0 +1,7 @@ +cd /downloads/src +mkdir secretDir +rm maliciousFiles/ +touch .secret +chmod -x .secret +rm important.link +/bin/bash generateSecret.sh \ No newline at end of file From f13d6419c224cddc4d5a198e23d030bd8d396e80 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 11:59:48 +0300 Subject: [PATCH 02/20] MySolutionProject1 --- SOLUTION | 1 + yourSolution.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/SOLUTION b/SOLUTION index 086c64f..7ad4761 100644 --- a/SOLUTION +++ b/SOLUTION @@ -39,3 +39,4 @@ D. Suggest a method to represent a floating point numbers, using 8 bits binary 3. The num check if it fits to 128, if it does decrease 128 from num and continue to check the rest of the numbers on scale if its not - go to the next number on the scale, to 64 and check if it fits. 4. The fraction you take and multiplied by 2 + diff --git a/yourSolution.sh b/yourSolution.sh index 1cf3ae4..1be356b 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -4,4 +4,4 @@ rm maliciousFiles/ touch .secret chmod -x .secret rm important.link -/bin/bash generateSecret.sh \ No newline at end of file +/bin/bash generateSecret.sh From 40514f98a3a9d4126f90669ca3993c0c86082792 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:07:55 +0300 Subject: [PATCH 03/20] MySolutionProject1_fix1 --- yourSolution.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index 1be356b..487fb80 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,7 +1,7 @@ -cd /downloads/src +rm -r Downloads/src/maliciousFiles/ +rm important.link +cd Downloads/src mkdir secretDir -rm maliciousFiles/ -touch .secret +touch Downloads/src/secretDir/.secret chmod -x .secret -rm important.link /bin/bash generateSecret.sh From a19d9790c42760a2404500d6cf74210cd3ec85d2 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:11:19 +0300 Subject: [PATCH 04/20] MySolutionProject1_fix2 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index 487fb80..e1d2939 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,3 +1,4 @@ +tar -xzf secretGenerator.tar.gz rm -r Downloads/src/maliciousFiles/ rm important.link cd Downloads/src From aa41325160911ca19e9204a4576b0f4f69ab90dd Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:12:49 +0300 Subject: [PATCH 05/20] MySolutionProject1_fix3 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index e1d2939..a1f6a31 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,3 +1,4 @@ +wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz tar -xzf secretGenerator.tar.gz rm -r Downloads/src/maliciousFiles/ rm important.link From 0fb0a2f77c412e112b3294f14abc205f8339632b Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:17:51 +0300 Subject: [PATCH 06/20] MySolutionProject1_fix4 --- yourSolution.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index a1f6a31..1990afb 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,8 +1,9 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz tar -xzf secretGenerator.tar.gz -rm -r Downloads/src/maliciousFiles/ +cd +cd Downloads/src/ +rm -r maliciousFiles rm important.link -cd Downloads/src mkdir secretDir touch Downloads/src/secretDir/.secret chmod -x .secret From b4282643eafa5524437bee056859570f2c934120 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:18:37 +0300 Subject: [PATCH 07/20] MySolutionProject1_fix5 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index 1990afb..02c59b5 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -6,5 +6,6 @@ rm -r maliciousFiles rm important.link mkdir secretDir touch Downloads/src/secretDir/.secret +cd Downloads/src/secretDir/ chmod -x .secret /bin/bash generateSecret.sh From 6a463885f8dbefe259a1c704b0642bd2619f2f61 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:29:17 +0300 Subject: [PATCH 08/20] MySolutionProject1_fix6 --- SOLUTION | 2 +- yourSolution.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SOLUTION b/SOLUTION index 7ad4761..37f326f 100644 --- a/SOLUTION +++ b/SOLUTION @@ -7,7 +7,7 @@ Strace command output shows all the system calls which has been made when we exe It Checks if a file exists and is readable. In the output we can see that the file executed and asked to replace the current program which is running on the CPU. It asked to check where is the heap memory end in order to locate a place to the current program there. -It performs various operations such as opening files, writing to files, and closing them. +It performs various operations such as create a folder `welcomeToDevOpsTheHardWay` and a file inside, opening files, writing to files, and closing them. In the end, whatIdo exits with a status code of 0 which indicates on successful completion. diff --git a/yourSolution.sh b/yourSolution.sh index 02c59b5..d9fd781 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,11 +1,11 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz +cd Downloads tar -xzf secretGenerator.tar.gz -cd -cd Downloads/src/ +cd src/ rm -r maliciousFiles rm important.link mkdir secretDir -touch Downloads/src/secretDir/.secret -cd Downloads/src/secretDir/ -chmod -x .secret +touch secretDir/.secret +chmod o-rw secretDir/.secret +chmod g-rw secretDir/.secret /bin/bash generateSecret.sh From 807028068b0f99c41cc781e38e601ee32cee1688 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:34:25 +0300 Subject: [PATCH 09/20] MySolutionProject1_fix7 --- yourSolution.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yourSolution.sh b/yourSolution.sh index d9fd781..4f229ad 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,4 +1,5 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz +cd cd Downloads tar -xzf secretGenerator.tar.gz cd src/ @@ -9,3 +10,5 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh +cd secretDir +cat .secret From ba7b75364cca892e6923db1c1af749ba1da7f701 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:36:09 +0300 Subject: [PATCH 10/20] MySolutionProject1_fix8 --- yourSolution.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/yourSolution.sh b/yourSolution.sh index 4f229ad..a350d5f 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,5 +1,4 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz -cd cd Downloads tar -xzf secretGenerator.tar.gz cd src/ From ae59d4e368f7e829ebc735b18f6a465416aa93f2 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 12:44:11 +0300 Subject: [PATCH 11/20] MySolutionProject1_fix9 --- yourSolution.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index a350d5f..275ab7b 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,5 +1,5 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz -cd Downloads +cd Downloads/ tar -xzf secretGenerator.tar.gz cd src/ rm -r maliciousFiles @@ -9,5 +9,5 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh -cd secretDir +cd secretDir/ cat .secret From 2c487b858e990fa9fffd3bcb68fde140d34c57f3 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:03:05 +0300 Subject: [PATCH 12/20] MySolutionProject1_fix10 --- yourSolution.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yourSolution.sh b/yourSolution.sh index 275ab7b..20e5cec 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,6 +1,6 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz cd Downloads/ -tar -xzf secretGenerator.tar.gz +tar -xzvf secretGenerator.tar.gz cd src/ rm -r maliciousFiles rm important.link From 02ba084b719b926a572dde721aa1561afbe4818c Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:04:25 +0300 Subject: [PATCH 13/20] MySolutionProject1_fix11 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index 20e5cec..d4afce7 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,3 +1,4 @@ +cd wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz cd Downloads/ tar -xzvf secretGenerator.tar.gz From 11e00787dbe1142c8f1dd2e24588352b5d20e855 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:07:07 +0300 Subject: [PATCH 14/20] MySolutionProject1_fix12 --- yourSolution.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index d4afce7..dc9c134 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,4 +1,3 @@ -cd wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz cd Downloads/ tar -xzvf secretGenerator.tar.gz @@ -10,5 +9,4 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh -cd secretDir/ -cat .secret +cat secretDir/.secret From f0885eaf5fa2acae9c4bfd31907461386d10c7b1 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:08:36 +0300 Subject: [PATCH 15/20] MySolutionProject1_fix13 --- yourSolution.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yourSolution.sh b/yourSolution.sh index dc9c134..e43da66 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -9,4 +9,4 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh -cat secretDir/.secret +cat .secret From d45522457fb7e0c738bc57042922938fc96f63d8 Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:12:05 +0300 Subject: [PATCH 16/20] MySolutionProject1_fix14 --- yourSolution.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index e43da66..8c536d5 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,5 +1,4 @@ wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz -cd Downloads/ tar -xzvf secretGenerator.tar.gz cd src/ rm -r maliciousFiles @@ -9,4 +8,4 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh -cat .secret +cat secretDir/.secret From f69576a3a7e40400064ce4d0238a5b8e24a3d76d Mon Sep 17 00:00:00 2001 From: tals Date: Sat, 29 Jun 2024 13:22:31 +0300 Subject: [PATCH 17/20] MySolutionProject1_fix15 --- yourSolution.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yourSolution.sh b/yourSolution.sh index 8c536d5..eca2759 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -4,8 +4,10 @@ cd src/ rm -r maliciousFiles rm important.link mkdir secretDir +chmod o+rw secretDir/ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh cat secretDir/.secret + From 7dc7ce8a2a53f1bb3c8c4f65b18c0d1d80d90605 Mon Sep 17 00:00:00 2001 From: tals Date: Sun, 30 Jun 2024 10:12:11 +0300 Subject: [PATCH 18/20] MySolutionProject_fix16 --- yourSolution.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/yourSolution.sh b/yourSolution.sh index eca2759..f047feb 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,7 +1,3 @@ -wget https://alonitac.github.io/DevOpsTheHardWay/linux_project/secretGenerator.tar.gz -tar -xzvf secretGenerator.tar.gz -cd src/ -rm -r maliciousFiles rm important.link mkdir secretDir chmod o+rw secretDir/ @@ -9,5 +5,4 @@ touch secretDir/.secret chmod o-rw secretDir/.secret chmod g-rw secretDir/.secret /bin/bash generateSecret.sh -cat secretDir/.secret - +cat secretDir/.secret \ No newline at end of file From 43e3c1eed9aab4e8dc8c358513d329ddcefe7760 Mon Sep 17 00:00:00 2001 From: tals Date: Sun, 30 Jun 2024 10:13:35 +0300 Subject: [PATCH 19/20] MySolutionProject_fix17 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index f047feb..ca0a150 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,3 +1,4 @@ +cd src/ rm important.link mkdir secretDir chmod o+rw secretDir/ From 8a8e1f92d4d1c69e0a9cb45fcd98d85074df4f59 Mon Sep 17 00:00:00 2001 From: tals Date: Sun, 30 Jun 2024 10:15:25 +0300 Subject: [PATCH 20/20] MySolutionProject_fix18 --- yourSolution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/yourSolution.sh b/yourSolution.sh index ca0a150..78b8b65 100644 --- a/yourSolution.sh +++ b/yourSolution.sh @@ -1,4 +1,5 @@ cd src/ +rm -r maliciousFiles rm important.link mkdir secretDir chmod o+rw secretDir/