Final Project

Project # 1 Webserver

The team for this project consisted of Lely Estevez, Steven Paredes, Dharam Deoraj, and Jose Rodriguez. The original design for this project was an IP camera via the Raspberry pi, however this did not work. The team eventually decided on using the raspberry pi to create a web server. The web server would also use apache run time and the website itself is constructed using HTML. To get this project started the team needed a USB keyboard and a USB mouse to allow us to navigate within the terminal in the raspberry pi. After connecting the pi to a monitor the command line loads and the user is asked to log in. The next step was to use the command $sudo apt-get update to update the repository of the pi. After the update was complete the program putty was used which allows users access to SSH servers if the IP address is known. SSH stands for Secure Shell, which is a network protocol for, secure data communication, and, remote command execution between two networked computers. This allowed the team to access the pi from a laptop. Next the command apt-get install apache was used to install apache into the pi. Apache is a freely available web server and one of the most popular in the world. Next, A basic webpage using java and HTML was created. To be able to edit the website the team decided that the easiest way to edit the files on the webserver would be to create an ftp (file transfer protocol). To do this sudo update was used again to install vsftpd, which could allow the user to edit their ftp options. Furthermore, the team had to go into the vsftpd.conf to change certain lines one line that was changed was the anonymous FTP that was turned off. Anonymous FTP allows anyone to log in to an ftp with a general username and no password the team decided this could be detrimental so it was turned off. Furthermore other lines like local_enable instruction were uncommented to allow local users to log in. After the ftp was setup the team was able to set up an ftp client with the program winscp, which allows access to our WWW server files, which allows us to edit the site. The webserver and website where a success unfortunately the team was only able to get the website to show via a local network and not to anyone with access to the Internet. Upon entering the site you are greeted by a picture of Santa Claus the website also has some basic java script such as displaying a welcome message when the user enters a name and a Celsius to Fahrenheit converter. Links to each team members Facebook and other information are also included on the site.

This project allowed me to learn a lot about how the raspberry pi works and how it can be used for multiple applications. I was able to learn bout the basic functions and setup of a webserver and how to setup an ftp. The project taught me that when it comes to webservers the easiest and most efficient way is the best way.

 

  • Steven Paredes
    • Steven lead the webserver project, Steven did most of the initial configuration of the Raspberry Pi, such as configuring the initial system settings of the device when it boots up. He also worked on the design of the website once the web server was completed. Steven also provided the USB Hub and VGA to HDMI adapter used on the Raspberry Pi.
  • Jose Rodriquez
    • During the setup of the web server on the Raspberry Pi, Jose provided our group with the use of his laptop.
  • Lely Estevez
    • I helped Steven setup the raspberry pi and helped make suggestions that eventually allowed the team to connect the raspberry pi correctly. I mostly assisted with the setup of the raspberry pi and figuring out which updates the pi needed for our project.
  • Dharam Deoraj
    • While I helped Steven set up the hardware and the pi Dharam assisted with the programing and the finishing steps of the website. He assisted Steven with the HTML, CSS and JavaScript used in order to give the site its design. He also came up with the idea for the Celsius to Fahrenheit converter.
  • Code For The Webpage:
  • <html>
  • <head>
    <title> EMT2390L &mdash; Final Project </title>
    <link rel=”stylesheet” type=”text/css” href=”style.css” />
  • <script>
    function clicked() {
    var x;
    x = document.getElementById(‘nameCheck’).value;
    if (x != “”) {
    getElementById(‘greeting’).innerHTML = ‘Hi, ‘ + x + ‘! Welcome to my site!’;
    } else {
    document.getElementById(‘errorMsg’).innerHTML = ‘<font color=”red”>(required) Name:</font>’;
    }
    }
  • function convert(degree) {
    if (degree == “C”) {
    F = document.getElementById(“c”).value * 9 / 5 + 32;
    getElementById(“f”).value = Math.round(F);
    } else {
    C = (document.getElementById(“f”).value – 32) * 5 / 9;
    document.getElementById(“c”).value = Math.round(C);
    }
    }
    </script>
    </head>
  • <body>
    <div class=”main”>
    <table border=”0″ cellspacing=”25″ cellpadding=”10″ width=”100%” bgcolor=”251111″ <!–Used to adjust the length of the tables–>
    <div class=”row1″>
    <img src=”http://upload.wikimedia.org/wikipedia/commons/f/f3/Santa_Claus_icon.png” />
  • </div>
    <div class=”row2″>
    <div class=”row2col1″>
    <p>Search Engine’s</p>
    <ul>
    <li><a style=text-decoration:none href=”http://www.bing.com/”>BING</a>
  • </li>
    <li><a style=text-decoration:none href=”https://www.google.com/”>GOOGLE</a>
  • </li>
    </ul>
  • <div>
    <div class=”row2col2″>
    <p class=”welcome” id=”greeting”>
    Hi! Welcome to the best site
    <form>
    <b id=”errorMsg”>Name:</b>
    <input type=”text” id=”nameCheck” />
    <input type=”button” value=”Click Me” onClick=”clicked()” />
    </form>
    </p>
    <p class=”content”>
    Welcome to my page! This page created for my operating system class using a Raspberry pi. This semester was fun and but it time to go on vacation merry christmas.
    </p>
    </div>
    </div>
    <hr align=”left” width=75%>
    <div>
    <div class=”row2col2″>
    <p class=”welcome” id=”greeting”>
    Convert Celcuis to Fahrenheit
    <form>
    <input id=”c” onkeyup=”convert(‘C’)”>Degrees Celsius</input>
    <br />
    <input id=”f” onkeyup=”convert(‘F’)”>Degrees Fahrenheit</input>
    </form>
    </p>
    </div>
    <h1>Time and Date</h1>
  • <button type=”button” onclick=”document.getElementById(‘time’).innerHTML = Date()”>
    Click me to display Date and Time.</button>
  • <p id=”time”></p>
    </div>
    </table>
    <hr align=”left” width=75%>
    <h4><p>For more information about the people who created this page please go to the links below </p></h4>
    <li>
    <p> Steven Paredes </p>
    </li>
    <p> <a href=”https://www.facebook.com/steven.paredes.9″>Follow me on Facebook</a>
  • </p>
    <p><a href=”http://instagram.com/lokoto5000/”>Instagram</a> </p>
    <li>
    <p> Jose Rodriguez </p>
    </li>
    <p> <a href=”https://www.facebook.com/profile.php?id=100001105402470&fref=ts”>Follow me on Facebook</a>
    <p><a href=”http://instagram.com/joselitofrod”>Instagram</a> </p>
  • </p>
  • <li>
    <p> Lely Estevez </p>
    </li>
    <p> <a href=”https://www.facebook.com/wilson.estevez.37?fref=ts”>Follow me on Facebook</a>
  • </p>
  • <li>
    <p> Dharam Deoraj </p>
    </li>
    <p> <a href=”https://www.facebook.com/jdeooo?fref=ts”>Follow me on Facebook</a>
  • <p><a href=”http://instagram.com/cxke.s”>Instagram</a>
    </p>
  • </p>
  • </ul>
    </h4>
    </body>
  • </html>

2014-12-13_18-42-05

 

Project #2: Hangbash, Scripted Terminal Hangman Game

The sub-project that the team decided to create was a simple script based game that can run via the terminal. The game is based of hangman and runs in a very similar fashion to the classic game. The player is given 10 chances to guess the correct letters within the word. No hints are given the player only knows the amount of letters I the word. When the user guesses a letter it has to be lower case and cannot be a previously used letter (numbers symbols and other characters are rejected). When a correct letter is guessed another conditional will be checked to see if the word contains the letter. If the word does contain the letter the loop will restart and the player can guess the next letter. If the player wants to quit they simply type in quit. The programing for the game was lead by Dharam and Lely. The game uses many commands and techniques that were discussed within the operating systems class. For example, the main script uses a giant if loop with elif to decide when the user is right or wrong it also tells the player there score and the amount of guesses remaining. Additionally the if loop checks if the user enters any wrong characters and makes sure only a single letter is entered. The if/while loop in the beginning of the script is used as a check to make sure the text file with the random words is found and is usable. Some new commands not previously mentioned in class such as sed and wc where used. Additionally, the terminal will not allow the script to run like any other script to fix this the user must change the permissions of the script and its related files. To fix this we used the following command of chmod u+rwx hangbash.sh. The same command can be applied to the randomquote.sh this file stores our random words and changing its mode allows the user to make the two files public.

When creating the hangbash script the team encountered one main issue. The main script would not load the two external files needed for the game to run. The two external files where the randomquote.sh a script that chooses a random word from the second file wordLib.txt which stores the words used in the game. The solution to the problem was the pwd command, which prints the working directory. By using PWD=$(pwd) in the script, we assigned the variable PWD to be the working directory. Later in the script, the location of the two external files were specified as wordLibrary=”$PWD/hangbash/wordLib.txt” and randomWord=”$PWD/hangbash/randomquote.sh”

This definition allows the script to run from any directory as long as the user changes directory into the desired directory before running the game.

Team Contributions:

  • Dharam Deoraj
    • During the creation of this game, Dharam was responsible for writing majority of the script that was used in order to run the game he also commented and fixed errors in the script.
  • Lely Estevez
    • On the hangbash project I was responsible for helping with the initial coding of the script error checking and making sure each part of the game worked correctly. I also created the word list used in the game and was the one who suggested hangman as the base for our script.
  • Steven Paredes & Jose Rodriguez
    • Steven and Jose played an important part in the creation of our game. Once Dharam and me finished finding any initial errors in the script, Steven and Jose were the ones who needed to play the game and use all of the options in order to make sure everything worked correctly.

Hangbash Script:

#!/bin/bash

#BASH adaptation for ‘Hangman’. There will not be a image displayed for
#the hanging man. A variable will be keeping track of how many incorrect
#guesses are made whilst playing.

PWD=$(pwd) #Get the working directory so we can load our files.
wordLibrary=”$PWD/hangbash/wordLib.txt” #Our list of words.
randomWord=”$PWD/hangbash/randomquote.sh” #Randomization script used from ‘Wicked Cool Shell Scripts’.
null_str=”\.” #Used for the sed [set] when $guessedLetter is emtpy.
gamesPlayed=0 #Total amount of games that the user has played.
gamesWon=0 #Total amount of games that the user has won.
gamesLost=0 #Total amount of games that the user has lost.
userGuess=”” #Variable for storing the guessed letter the user entered.
guessed=”” #Variable for comparison of the guessed letter.

echo ” _____ _____ _____ _____ _____ _____ _____ _____ ”
echo “| | | _ | | | __| __ | _ | __| | |”
echo “| | | | | | | | __ -| |__ | |”
echo “|__|__|__|__|_|___|_____|_____|__|__|_____|__|__|”
echo “————————————————-”
echo “————EMT 2390L – FINAL PROJECT————”

if [ ! -r $wordLibrary ] ; then #Check if the wordLib.txt is readable (exists)
echo “$0: Unable to find wordLib.txt. ”
echo “You can create your own wordLib.txt and place it inside of the ”
echo “/hangbash/ folder. Once a wordLib.txt is placed there, you can play.”
exit 1
fi

while [ “$userGuess” != “quit” ] ; do #Runs the game as long as they don’t type “quit”
match=”$($randomWord $wordLibrary)” #Choose a random word from the wordLibrary
if [ $gamesPlayed -gt 0 ] ; then #Print the new game alert
echo “~~~ New Game Started ~~~”
guessed=””
userGuess=””
fi

gamesPlayed=”$(($gamesPlayed + 1))” #Incriment gamesPlayed by 1 each time
badGuessCount=${1:-10}
partialWord=”$(echo $match | sed “s/[^$null_str${guessed}]/-/g”)”
echo
while [ “$userGuess” != “$match” -a “$userGuess” != “quit” ] ; do #Runs the game as long as the user doesn’t enter quit.
if [ ! -z “$guessed” ] ; then
echo -n “Guessed: $guessed, ”
fi

echo “Remaining tries: $badGuessCount, Current word: $partialWord” #Displays your current remaining guesses and how
echo -n “Guess A Letter: ” #much of the word you have guessed.
read userGuess

if [ “$userGuess” = “$match” ] ; then
echo “Congrats! You got it!”
elif [ “$userGuess” = “quit” ] ; then
sleep 0 #NOP; Prevent the program from erroring during the quit.
elif [ $(echo $userGuess | wc -c | sed ‘s/[^:digit:]]//g’) -ne 2 ] ; then #Make sure that they only entered one letter as a guess.
echo “You can only guess one leter at a time! :(”
elif [ ! -z “$(echo $userGuess | sed ‘s/[[:lower:]]//g’)” ] ; then #Make sure that only lowercase letters are entered.
echo “All guesses must be lowercase letters. :(”
elif [ -z “$(echo $userGuess | sed “s/$userGuess$guessed]//g”)” ] ; then #Make sure no duplicates have been entered.
echo “You’ve already tried this letter as a guess! :(”
elif [ “$(echo $match | sed “s/$userGuess/-/g”)” != “$match” ] ; then #If the above conditions are met, it’ll check if
guessed=”$guessed$userGuess” #the letter is part of the word.
partialWord=”$(echo $match | sed “s/[^$null_str${guessed}]/-/g”)”
if [ “$partialWord” = “$match” ] ; then
echo “Congratulations! The word was: \”$match\”.” #The letter is part of the word.
userGuess=”$match” #The enter word has been guessed, so you win.
gamesWon=$(($gamesWon + 1)) #Report back how many times you’ve won the game.
echo “You’ve won $gamesWon games!”
echo “You’ve lost $gamesLost games!”
else
echo “~~~ The letter you guessed, \”$userGuess\” is in the word! ~~~” #The letter is in the word, but you are not finished.
fi
elif [ $badGuessCount -eq 1 ] ; then
echo “~~~ DUN, DUN, DUN! You’ve run out of guesses! :’-( ~~~” #End the game if you run out of guesses, then reset the count.
echo “~~~ The word you were trying to guess was \”$match\” ~~~”
userGuess=”$match”
gamesLost=$(($gamesLost + 1)) #Report back how many times you’ve lost the game.
echo “You’ve lost $gamesLost games!”
echo “You’ve won $gamesWon games!”
else
echo “~~~ Too bad, \”$userGuess\” is not part of the word. ~~~” #If none of the above conditions are met, and your letter is not
guessed=”$guessed$userGuess” #part of the word, you lose one guess, and the loop repeats.
badGuessCount=$(($badGuessCount – 1))
fi
done
done
exit 0

Start of Hangbash

Screen Shot 2014-12-16 at 6.52.05 PM

When the palyer gusses the right letters the screen below is shown

Screen Shot 2014-12-16 at 6.53.24 PM

 

When the player gusses incorrectly the screen below is displayed

 

Screen Shot 2014-12-16 at 6.54.18 PM

 

 

 

 

 

 

 

 

 

 

One thought on “Final Project

  1. Mariozed

    brand or generic Rumalaya in USA in internet drugs overnight ; buy at low price Rumalaya in UK overnight without dr approval

    http://trustedmeds.store/shop/go.php?sid=5&search=Rumalaya – >>> Want to buy with Discount? CLICK HERE! <<>> http://totalworldstore.com/shop/go.php?sid=1

    Ordering Online Rumalaya with no rx )) http://crosstrek.org/index.php/forum/welcome-mat/1090-tadadel-20mg-delgra-100?start=2676#83308
    Buying in USA Rumalaya shipped overnight without a prescription = http://www.fanshopsparta.cz/posts/dresy-s-potiskem/
    Cheap Prices Rumalaya in without prescription )) http://amnch.org/forum/welcome-mat/35106-order-at-low-price-tadalafil-with-dapoxetine-no-prescriptions-needed-tadalafil-with-dapoxetine-cash-on-delivery
    Purchase At Low Cost in Australia Rumalaya c.o.d overnight no rx \\ http://www.bpfitness.cn/messages_list/&FrontColumns_navigation01-1366341552987FirstColumnId=a90842ba-b993-4e33-b1a9-b7af3b41c667.html
    Cheapest Prices in Australia for Rumalaya pharmacy without prescription )) http://www.tonybrooksarchitects.net/index.php/forum/welcome-mat/73035-purchase-amaryl-no-prescription-amaryl-overnight-delivery-no-r-x#99706
    Order Cheapest Rumalaya no prescription quick delivery / http://unhcr.ml/index.php/forum/welcome-mat/26066-buy-discount-risperidone-with-no-rx-risperidone-no-rx-required
    Ordering in Australia Online Rumalaya no prescription > http://www.bloggen.be/belgiumkayakvisser/forum.php?cID=3588&pID=4097169
    Fda Approved Rumalaya pharmacy no prescription * http://www.ab-com.it/index.php/forum/welcome-mat/59204-buy-at-low-cost-clozapine-non-prescription-needed-clozapine-with-no-prescription#59506
    Pharmacies That Sell Rumalaya shipped overnight without a prescription >> http://www.tucsonjamz.com/phpbb3/viewtopic.php?f=4&t=1140179%22/
    Buy in USA At Low Price Rumalaya without a prescription shipped overnight = http://www.yahont.ru/index.php/forum/razdel-predlozhenij/84107-ordering-safety-penegra-how-to-use-side-effects-information-penegra-without-dr-prescription#104677
    Order Cheap Generic Rumalaya free prescription drug # http://dist.by/forum/razdel-predlozhenij/2071-mp4-audio-konverter?start=738#16588
    Order in Australia cheapest Rumalaya pharmacy without a prescription >> http://www.autofed.ru/forum/viewtopic.php?pid=721411#p721411
    Ordering in Australia Rumalaya without dr prescription * http://www.tucsonjamz.com/phpbb3/viewtopic.php?f=4&t=1137969%22/
    Discount Price in USA Rumalaya without prescription overnight @ http://www.stolavvel.no/?page=gjestebok
    Order Cheapest Rumalaya c.o.d. no script \ http://johnleonardandpartners.com/index.php/forum/welcome-mat/65444-order-online-at-low-cost-levonorgestrel-ethinyl-estradiol-cash-on-delivery-levonorgestrel-ethinyl-estradiol-no-prescription-fedex-ups
    GB / UK Online Pharmacy Rumalaya without rx // http://kursyjezykoweonline.pl/forum/welcome-mat/168289-lowest-price-vibramycin-next-day-delivery-vibramycin-no-prescription-c-o-d#269140
    How Much in GB / UK Rumalaya free delivery on sale @ http://web.aeath.gr/labornodiscr/index.php/en/forum/welcome-mat/291861-where-can-i-order-adalat-shipped-by-cash-on-delivery-adalat-next-day-no-prescription-needed#294886
    How To Purchase in USA Rumalaya no script required > http://www.rafaelorozco.org/forum/welcome-mat/620-nfl-replica-jerseys-way-of-showing-support?start=828#25361
    Ordering in Australia Online Rumalaya c.o.d. no prescription < http://crosstrek.org/index.php/forum/welcome-mat/74955-order-online-at-low-cost-chlorambucil-overnight-delivery-no-r-x-chlorambucil-pharmacy-without-a-prescription
    Where Can I Order in Australia Rumalaya no script required >> http://web.aeath.gr/labornodiscr/index.php/en/forum/welcome-mat/288168-ordering-at-lowest-price-desogestrel-ethinyl-estradiol-free-prescription-drug-desogestrel-ethinyl-estradiol-without-script-pharmacy#291043
    Buy Discount Rumalaya pharmacy without a prescription )) http://www.yahont.ru/index.php/forum/razdel-predlozhenij/84230-how-can-i-buy-bupropion-no-prescription-no-fees-bupropion-in-internet-next-day-delivery#104799
    Buying Rumalaya overnight without dr approval ! https://crypher.com/index.php?topic=177263.new#new
    Order in USA Cheap Generic Rumalaya from a pharmacy without a prescription ! https://crypher.com/index.php?topic=183171.new#new
    Purchase At Low Cost in Canada Diamox no rx, fast worldwide shipping > http://bbs.infinixmobility.com/home.php?mod=space&uid=2381717
    How Much in Canada Rumalaya next day no prescription / http://lodzeh.de/kunena/muzika/240-backen-mit-christina-android-iphone-epub-mobi-und-pdf-format?start=920#20116
    Purchase in USA At Lowest Price Mebeverine next day no prescription \\ http://www.centraldecomercio.org/index.php/forum/welcome-mat/336241-discount-price-calan-sr-in-internet-next-day-delivery-calan-sr-in-internet-next-day-delivery#336106
    Where Can I Purchase Rumalaya without script pharmacy / http://arcticwolflodge.com/index.php/forum/welcome-mat/752-purchase-cheapest-azathioprine-no-dr-approval-cash-on-delivery-azathioprine-no-prior-prescription
    Cheap Price Rumalaya c.o.d overnight no rx >> http://zusluze.cz/kniha-navstev/?from=30&select=4
    Buying in Canada Rumalaya c.o.d. no script << http://dayzforum.net/index.php?app=forums&module=post&section=post&do=new_post&f=53
    Lowest Price Of Rumalaya overseas with no prescriptions # http://www.haciendaspaloverde.com/en/component/kunena/2-welcome-mat/64864-lowest-price-of-dostinex-no-rx-fast-worldwide-shipping-dostinex-c-o-d-overnight-no-rx#64864
    Cheap Rumalaya without dr prescription # http://www.ultrathletic-ardeche.fr/index.php/forum/welcome-mat/2145-where-can-i-purchase-reminyl-with-no-prescriptions-reminyl-next-day-delivery
    How Much in Canada Rumalaya with overnight delivery // http://www.cappellomotorsport.com/cms14/kunena/benvenuto/28668-order-online-cheap-nortriptyline-hydrochloride-no-prescription-nortriptyline-hydrochloride-no-prescription-c-o-d#30388
    Where To Order in Canada Rumalaya overnight without a prescription \\ http://www.accuhealth.info/index.php/forum/welcome-mat/116-cheapest-prices-aceon-fast-shipping-aceon-aceon-without-a-prescription?start=2202#38726
    Where Can I Order in USA Rumalaya without script ! http://fdp-wilnsdorf.de/forum.php?newt=1&topic_id=1058064
    Buying in Australia At Lowest Price Rumalaya with no prescriptions / http://xclub.pre.transsion.net/forum.php?mod=viewthread&tid=346061&extra=
    Order Online Cheap Rumalaya no prescription * http://vladtcmk.vtc.ru/index.php/forum2/3-nezavisimaya-otsenka/198719-ordering-safety-diflucanwith-overnight-delivery-diflucan-same-day-delivery-no-prescription#198719
    Order in Canada At Low Price Rumalaya without rx )) http://genetic-service.ru/node/11
    Best Place To Buy Rumalaya cash on delivery overnight << http://shaivitetemple.org/Forum/topic/wholesale-cheapest-claritinbuy-at-low-price-claritin-overnight-without-a-prescription/#post-321833
    Pharmacies in Canada That Sell Rumalaya free prescription drug / http://www.videsprojekti.lv/vnews/22941.html
    Buying in GB / UK Generic Rumalaya without script pharmacy << http://www.trainingtrust.org/forum/welcome-mat/27016-buy-at-low-cost-casodex-no-prescription-quick-delivery-casodex-next-day-delivery#27015
    Safe Order Rumalaya prescriptions online = http://zhsi-servis.ru/forum/
    Cost in Australia Of Finpecia with no rx \ http://mbnlimited.com/index.php/forum/welcome-mat/12730-cheap-generic-ipratropium-bromide-albuterol-sulfate-no-prescription-quick-delivery-ipratropium-bromide-albuterol-sulfate-next-day-delivery#12707
    Safe Order Rumalaya pay cod no prescription ??? http://www.flab3d.com/forum-tag-view-id-10288-time-1525805624.html
    Buying Rumalaya fast shipping no prescription * http://3comltd.com/index.php/component/kunena/2-welcome-mat/307903-price-of-rumalaya-fort-no-prescription-needed-rumalaya-fort-online?Itemid=0#307903
    Buy in Canada Cheap Online Rumalaya without dr prescription @ http://www.terrycunha.com/forum/welcome-mat/64180-brand-or-generic-sulfasalazine-pharmacy-no-prescription-sulfasalazine-no-prescription-overnight#64051

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *