Foiling the cheaters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • systomx
    New Member
    • Nov 2011
    • 9

    Foiling the cheaters

    I teach electrical engineering, and I have a series of 20 or so html/javascript tutorials for my students. Each page of each tutorial asks a question, which the student must answer. The answers are in the javascript, like this:
    Code:
    //Define variables:
     //Correct answer (use quotes for alpha-numeric, no quotes for numeric):
     var corAns = 5;
    Some of the students right click and select "view frame source" to extract the answers from my code.

    Now, I realize that I can't totally protect my answers from being extracted, but I'm hoping to make it more difficult for them to cheat than to just honestly answer the questions.

    So I'm asking for your suggestions as to how to throw up a few walls of protection. Please keep in mind that I've got about 300 HTML pages of tutorials, so I'd prefer some (perhaps search and replace) solution that doesn't involve my personally editing each individual page.

    For those interested, you can see the tutorials at:
    http://raise.spd.louis ville.edu/systom/ECE252/252home.htm

    Thanks for your help.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Since it's a school web server, it should have some sort of server side scripting set up right? You could do the validation on the server side.

    If that is not an option, for security reasons or whatever, you can encode the javascript using base64. It's reversible without a password but not everyone knows how to do that and it offers a modicum of security.

    Comment

    • zorgi
      Recognized Expert Contributor
      • Mar 2008
      • 431

      #3
      You can try HTML scrambler. Here is one:



      Tools like firebug will still unscramble the code.

      Server side scripting is probably best option.

      Comment

      • systomx
        New Member
        • Nov 2011
        • 9

        #4
        Thanks for your responses, Rabbit and Zorgi. I'm hoping for something a bit simpler than you have suggested. I've experimented with modifying the body tag as shown below:
        Code:
        <body "oncontextmenu = return false;">
        This is nice and simple, and it seems to prevent most browsers from using right click or the drop-down menus to view my code, but I've been told that this technique is insulting to users.

        Tom Cleaver

        Comment

        • zorgi
          Recognized Expert Contributor
          • Mar 2008
          • 431

          #5
          Firebug still shows the code. They also can use browser main menu. Really, once they are viewing it through the browser you can not physically protect the code. Your best bet in that case is some form of encoding.

          Comment

          • drhowarddrfine
            Recognized Expert Expert
            • Sep 2006
            • 7434

            #6
            This is really a javascript question and not for html/css. What you could use is ROT-13 encoding which should be relatively simple to do if you know js.

            Comment

            • systomx
              New Member
              • Nov 2011
              • 9

              #7
              Once again, thanks to all who have responded. Aside from server-side maneuvers, many of you have been suggesting encrypting. I don't need to encode an entire page, I just have to encode the answer. Is there an easy way to do that?

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                An easy way is to find existing hashing code, and use that to hash your answers, store the hash, and then hash the student's answer and compare it to the stored hash. Just be aware that with a hash, you can't reverse it to get the original input.

                Comment

                • intermension
                  New Member
                  • Nov 2011
                  • 2

                  #9
                  Hi systomx,

                  If you can wait until Monday 5th December I will write you a small program that will traverse the folder directory you point it at, including sub directories if neccessary, pull the current answer out and create a record associating the filename, plaintext answer and cipher.

                  Then upon operator request, i.e. click a button, it will replace all the plaintext answers in your tutorials with the base64 encoded (tho you could use a stronger encryption / hashing / etc) answer.

                  From there you'd just need to link to a base64 decode plugin (jquery / javascript) /(heaps around i'll send you one) to decode the answer when checking your students work.

                  You can have access to the source code, and if you know how to compile a C# progam, you can compile it yourself to confirm there is nothing nefarious going on.

                  It's not much work to write something like that but I wont have any time till Sunday evening.

                  Richard

                  Comment

                  • systomx
                    New Member
                    • Nov 2011
                    • 9

                    #10
                    Thanks, Richard. That would be great. It could save me a lot of work in hand-encoding the answers.

                    Systomx

                    Comment

                    • drhowarddrfine
                      Recognized Expert Expert
                      • Sep 2006
                      • 7434

                      #11
                      So you ignored the ROT-13 source I gave? We encode email addresses that way with simple javascript, no server side anything, to do exactly what you want. It's easy to do and can be done in a few minutes but....whatever .

                      Comment

                      • intermension
                        New Member
                        • Nov 2011
                        • 2

                        #12
                        Originally posted by systomx
                        Thanks, Richard. That would be great. It could save me a lot of work in hand-encoding the answers.

                        Systomx
                        No worries. I wouldn't want to open, copy, encode, paste, save 300+ times either. I'll come back to you around midday NZST.

                        Richard

                        Comment

                        • systomx
                          New Member
                          • Nov 2011
                          • 9

                          #13
                          drhowarddrfine

                          I looked up the reference you suggested. It didn't quite meet my needs. One issue is that many of my answers are numeric, with students allowed to submit answers that are within a percentage of the correct answer. For example, if the answer is 100, and there is a 3% window, answers between 97 and 103 are accepted as correct.

                          Comment

                          Working...