Commit 154c0f8f authored by RAJAT KAPOOR's avatar RAJAT KAPOOR

Add existing file

parents
Group :- 17
Fenil : I pledge on my honour that I have not received or given any unauthorized assistance on this assignment or any previous task.
Mohit : I pledge on my honour that I have not received or given any unauthorized assistance on this assignment or any previous task.
Rajat : I pledge on my honour that I have not received or given any unauthorized assistance on this assignment or any previous task.
Fenil(150050003) : 100%
Mohit(150050017) : 100%
Rajat(150050037) : 100%
In this assignment, we learnt a lot about bash. We learnt about modifying the terminal, transfering files from one computer to another using terminal, unzipping password protected zip file, writing bash scripts, finding mime types of extensionless files and renaming them,removing files from the terminal,appending two files.
We faced some problems in transfering the pokemon which was an error of IP address. Soon it got fixed. We were unable to find a command for printing the correct password in Task I.
We faced some difficulties searching for different commands required for different questions.Over the whole it was the longest interaction we have had with linux and its functions.
Citations : 1) stackoverflow.com
2) bash.cyberciti.biz
3) askubuntu.com
4) code.runnable.com
5) adoceo.com
6) youtube.com
7) unix.com
8) linuxquestions.org
9) web.mit.edu
10) osxdaily.com
11) linoxide.com
12) rapidtables.com
13) unix.stockexchange.com
14) thegeekstuff.com
15) geeksforgeeks.com
16) shellcheck.net
17) linuxacademy.com
18) linuxcommando.blogspot.in
19) whatismyipaddress.com
20) nmap.org
21) man7.org
22) tldp.org
23) mywiki.wooledge.org
24) linux.die.net
25) ubuntuforums.org
26) computerhope.com
27) manpages.ubuntu.com
Part 1: The name of the city is Komatsu.
Part 2: The path from which commands were executed were "/home/username/Downloads/Earth/Asia/Japan"
Part 3:The command used were:
(a) "find . -iname '*t*' -size +50k -size -100k -type f -readable" //shows the location of the files with size between 50kb and 100kb
(a) showed the exact location of the hiding place of pikachu as there was only one file with size between 50kb and 100kb.
Part(1):The name of the pokemon is "GRASS Sceptile".
Part(2):The path is"/home/username/Downloads/Earth/Asia/China".
Part(3):The command used is "grep -i -E '((^GRASS|^WATER) (*[^bm]*$))' Shanghai|grep -i -E '((^GRASS|^WATER) \w{6,10}\b)'"
Part(1):The name of the pokemon is Magikarp.
Part(2):The command is " rm -r */ ".
Part(3):The command IS " rm [A]* ".
Part(4):The command is " rm {1..20} ".
Part(5):The command is "find . -name '*.jpg' -delete
Part(6):The command is " cat $(ls -t) > ultraball.html "
Part(1): The Pokemon is Squirtle.
Part(2): Username-'alpha' Password-'omega'
Part(3):The Command used is " curl -d "username=alpha&password=omega" https://www.cse.iitb.ac.in/~sharat/current/cs251/Assign/Lab03/support/verify.php ".
Part(1):The line is "cf3c122f1dabdc0fc4e1c37a25556bc8".
Part(2):The line is "f24109a62a0422577119abeb0db4f801".
Part(3):The IP address is:"10.3.96.99".
Part(4):The IP address is:"10.3.96.106"
Part(5):The command run is "ncat --send-only 10.3.96.106 < ./home/username/Downloads/Earth/Europe/Netherlands/Amsterdam/Bulbasaur".
"ncat -v -l > ./home/rajat/Downloads/Slowpoke
Part(6):The command run is "ncat -v -l > ./home/username/Downloads/Bulbasaur".
"ncat --send-only 10.3.96.99 < ./home/username/Downloads/Earth/Asia/Russian Federation/Moscow/Slowpoke".
#!/bin/bash
var="/home/rajat/Downloads/Earth/Europe/Ukraine/Kiev/*"
for entry in $var;
do
var1=$(file --mime-type -b $entry)
if [ "$var1" = "text/html" ]
then
mv $entry $entry.html
elif [ "$var1" = "application/gzip" ]
then
mv $entry $entry.gz
elif [ "$var1" = "image/jpeg" ]
then
mv $entry $entry.jpg
elif [ "$var1" = "text/x-c" ]
then
mv $entry $entry.c
fi
done
Part(1):The pokemon is "Rotom".
Part(2):The different mime types are : a).html b).jpg c).c d).gz
Part(1):The name of the pokemon is "Magikarp".
Part(2):The command used is "ls -l -tr|cut -c25-28 | awk '{ printf("%c",$0); }'c".
Part(1):The name of the pokemon is "Hawlucha".
Part(2): For H.1-"sed -i 's/flying/255 0 0/g' corruptedPokémon.ppm " and then "sed -i 's/fighting/255 0 0/g' corruptedPokémon.ppm".
For H.2-"sed -i 's/Atk:1[0-9][0-9]/255 8 153/g' corruptedPokémon.ppm" then "sed -i 's/Def:1[0-9][0-9]/255 8 153/g' corruptedPokémon.ppm"
then "sed -i 's/Sp.A:1[0-9][0-9]/255 8 153/g' corruptedPokémon.ppm" and finally "sed -i 's/Sp.D:1[0-9][0-9]/255 8 153/g' corruptedPokémon.ppm".
For H.3-"sed -i 's/HP-\([0-9]\{1,3\}\)\/[0-9]\{1,3\}/\1/g' corruptedPokémon.ppm".
all these steps uncorrupted the folder and the image became visible.
#!/bin/bash
while read line
do
echo "$line"
unzip -o -P $line legendaryPokemon.zip
done <dictionary.txt
Part(1):The pokemon is Mewtwo.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment