and some other stuff…

How To Cook Dog

Archives Posts

Are You Serious? (Part 1)

February 29th, 2008 by Dee

This one is a long one, and hopefully I’ll be able to elaborate on it later. This is an example of what happens when you hire a boy to do a mans job. Here is the (edited) code for a test I was recently given for an online class. Now the university does not employ these people(to bad I would have a 100 in every class). The instructor (of a computer class) used their services for a test.

Here FSCreations, Inc uses client side programming(via. JavaScript) to parse the test results and send them to the instructor. I easily saved the website to my desktop so I could take a further look.

Point (1) of all this. JAVASCRIPT SHOULD ONLY BE USED FOR DISPLAY TRICKS, AND SIMPLE FORM VALIDATION! They could have easily used PHP to parse the results on their server and then email it, but they didn’t…

Point (2) of all this. I GOT A 100 ON THIS TEST! and here’s how:

###UPDATE### I have gone into a little bit more detail, and continued with a PART 2 to the Online Class Hack.

1. I saved the website to my desktop.
2. Strip out the submit information. Here you just have to remove
action='http://score.examview.com/cgi-bin/results.cgi' from the form tag.
3. In the HandleSubmit() function, immediately after the second loop I added alert(numCorrect);
4. Now when I open it up, and choose my answers and click submit, it will give me the total I have answered correct. I was to lazy to figure in a do not clear on postback or even bother taking a look unscrambling their ScoreAnswer() Function. Because I answered 24/25 on the first try and it was easy to go back and fix the one I thought was wrong.
5. After you have figured out the answers go back to the test and fill them in.


 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
  <meta name='generator' content='ExamView Pro 4.0.7 [WinNT 5.01 (2600)]'>
  <title>CH 9 ASSIGN</title>
  <STYLE TYPE="text/css">
    .spacer { line-height:.7em; }
    .title { font-size:13pt; font-weight:bold; font-family:"Times New Roman", "Times", serif;color:#000000; }
    .qnumber { font-size:12pt; font-family:"Times New Roman", "Times", serif;color:#000000; text-align:right; }
  </STYLE>
<script language='JavaScript1.1'>
<!--
  // Copyright (c) 2003 FSCreations, Inc.
  var listMap = '1111111111111111111111111';
  var qtypeMap = '2222222222222222222200000';
  var ansMap = new Array(25);
  ansMap[0] = '40';
  ansMap[1] = '40';
  ansMap[2] = '42';
  ansMap[3] = '46';
  ansMap[4] = '46';
  ansMap[5] = '42';
  ansMap[6] = '44';
  ansMap[7] = '49';
  ansMap[8] = '4d';
  ansMap[9] = '49';
  ansMap[10] = '49';
  ansMap[11] = '4f';
  ansMap[12] = '4e';
  ansMap[13] = '4c';
  ansMap[14] = '4b';
  ansMap[15] = '53';
  ansMap[16] = '53';
  ansMap[17] = '53';
  ansMap[18] = '51';
  ansMap[19] = '56';
  ansMap[20] = '53';
  ansMap[21] = '42';
  ansMap[22] = '43';
  ansMap[23] = '4c';
  ansMap[24] = '5f';
  function HandleSubmit(f, forceSubmit)
  {
    var  numCorrect = 0;
    var  numPossible = 0;
    var  numBlank = 0;
    var  index;
    var  msg;
    var  i;
 
    f.student_name.value = StripSpaces(f.student_name.value);
    f.student_id.value = StripSpaces(f.student_id.value);
    f.student_email.value = StripSpaces(f.student_email.value);
 
    FixMTF(f);
    index = 0;
    for (i=0; i < f.length; ++i) {
      if (f.elements[i].name.indexOf(":") > 0) {
        if (listMap.charAt(index) == "1") {
          listIndex = f.elements[i].selectedIndex;
          text = f.elements[i].options[listIndex].value;
        } else {
          f.elements[i].value = StripSpaces(f.elements[i].value);
          text = f.elements[i].value;
        }
 
        text = StripSpaces(text);
        if (text.length == 0)
          ++numBlank;
        ++index;
      }
    }
 
    if (f.student_name.value == "") {
      alert("Student name cannot be blank.");
      return(false);
    }
 
    if (numBlank > 0) {
      if (numBlank == 1)
        msg = "1 question";
      else
        msg = numBlank + " questions";
      if (!confirm("You have not answered " + msg +
        "  Are you sure you want to end the test?"))
        return(false);
    }
 
    index = 0;
    f.score_details.value = "";
    for (i=0; i < f.length; ++i) {
      if (f.elements[i].name.indexOf(":") > 0) {
        if (ansMap[index] == "")
          f.score_details.value += "?";
        else {
          isCorrect = ScoreAnswer(index, f.elements[i]);
          if (isCorrect) {
            ++numCorrect;
            f.score_details.value += " ";
          } else
            f.score_details.value += "X";
          ++numPossible;
        }
        ++index;
      }
    }
 
    f.score_correct.value = numCorrect;
    f.score_possible.value = numPossible;
    if (numPossible > 0)
      f.score_percent.value = Math.round(100.0 * numCorrect / numPossible);
    else
      f.score_percent.value = 0;
 
    if (forceSubmit) {
      f.submit();
      return(false);
    }
    return(true);
  }
 
  function ScoreAnswer(answerIndex, answer)
  {
    var  listIndex;
    var  responseText;
    var  answerText;
 
    if (listMap.charAt(answerIndex) == "1") {
      listIndex = answer.selectedIndex;
      responseText = answer.options[listIndex].value;
    } else
      responseText = answer.value;
 
    answerText = TranslateAnswer(ansMap[answerIndex], answerIndex);
    if (qtypeMap.charAt(answerIndex) == "5")
      return(NumericCompare(responseText, answerText));
    else if (qtypeMap.charAt(answerIndex) == "6")
      return(MultiCompare(responseText, answerText));
    else if (responseText.toUpperCase() == answerText.toUpperCase())
      return(true);
    else
      return(false);
  }
 
  function TranslateAnswer(s, answerIndex)
  {
    var  value;
    var  newString;
    var  code;
    var  i;
 
    value = (answerIndex % 31) + 1;
    newString = "";
    for (i=0; i < s.length; i += 2) {
      code = parseInt(s.substring(i, i + 2), 16);
      newString += String.fromCharCode(code ^ value);
    }
 
    return(newString);
  }
 
  function StripSpaces(s)
  {
    var  len;
    var  i;
 
    len = s.length;
    for (i=len - 1; i >= 0 && s.charAt(i) == " "; --i)
      len = i;
 
    if (len == 0)
      s = "";
    else if (len != s.length)
      s = s.substring(0, len);
 
    return(s);
  }
 
  function NumericCompare(s1, s2)
  {
    var  s1Sign;
    var  s2Sign;
    var  tempString;
    var  decimalCount;
    var  decimalPos;
    var  numToDelete;
    var  len;
    var  ch;
    var  i;
 
    s1.toUpperCase();
    s2.toUpperCase();
    if (s1 == s2)
      return(true);
    else {
      s1Sign = 1;
      s2Sign = 1;
 
      tempString = "";
      for (i=0; i < s1.length; ++i) {
        ch = s1.charAt(i);
        if (ch == "-" && tempString.length == 0)
          s1Sign = -1;
        else if ((ch >= "0" && ch <= "9") || ch == ".")
          tempString += ch;
      }
 
      s1 = tempString;
 
      decimalCount = 0;
      decimalPos = -1;
      for (i=0; i < s1.length; ++i) {
        if (s1.charAt(i) == '.') {
          ++decimalCount;
          if (decimalPos < 0)
            decimalPos = i;
        }
      }
 
      if (decimalCount == 1 && decimalPos >= 0) {
        len = s1.length;
        for (i=len - 1; i >= decimalPos; --i) {
          if (i == decimalPos || s1.charAt(i) == '0')
            len = i;
          else
            break;
        }
 
        if (len < s1.length)
          s1 = s1.substring(0, len);
        if (s1.length == 0)
          s1 = "0";
      }
 
      numToDelete = 0;
      for (i=0; i < s1.length; ++i) {
        if (s1.charAt(i) == "0")
          ++numToDelete;
        else
          break;
      }
 
      if (numToDelete > 0) {
        if (numToDelete == s1.length)
          --numToDelete;
        if (numToDelete > 0)
          s1 = s1.substring(numToDelete);
      }
 
      /////////////////////////////////////////////
      tempString = "";
      for (i=0; i < s2.length; ++i) {
        ch = s2.charAt(i);
        if (ch == "-" && tempString.length == 0)
          s2Sign = -1;
        else if ((ch >= "0" && ch <= "9") || ch == ".")
          tempString += ch;
      }
 
      s2 = tempString;
 
      decimalCount = 0;
      decimalPos = -1;
      for (i=0; i < s2.length; ++i) {
        if (s2.charAt(i) == '.') {
          ++decimalCount;
          if (decimalPos < 0)
            decimalPos = i;
        }
      }
 
      if (decimalCount == 1 && decimalPos >= 0) {
        len = s2.length;
        for (i=len - 1; i >= decimalPos; --i) {
          if (i == decimalPos || s2.charAt(i) == '0')
            len = i;
          else
            break;
        }
 
        if (len < s2.length)
          s2 = s2.substring(0, len);
        if (s2.length == 0)
          s2 = "0";
      }
 
      numToDelete = 0;
      for (i=0; i < s2.length; ++i) {
        if (s2.charAt(i) == "0")
          ++numToDelete;
        else
          break;
      }
 
      if (numToDelete > 0) {
        if (numToDelete == s2.length)
          --numToDelete;
        if (numToDelete > 0)
          s2 = s2.substring(numToDelete);
      }
 
      if (s1Sign == s2Sign && s1 == s2)
        return(true);
    }
 
    return(false);
  }
 
  function MultiCompare(responseText, answerText)
  {
    var  startIndex;
    var  endIndex;
    var  partialText;
 
    responseText = responseText.toUpperCase();
    answerText = answerText.toUpperCase();
 
    startIndex = 0;
    do {
      endIndex = answerText.indexOf("\r", startIndex);
      if (endIndex < 0)
        partialText = answerText.substring(startIndex);
      else
        partialText = answerText.substring(startIndex, endIndex);
 
      if (responseText == partialText)
        return(true);
 
      startIndex = endIndex + 1;
    } while (endIndex > 0);
 
    return(false);
  }
 
  function FixMTF(f)
  {
    var  text;
    var  letter;
    var  theList;
    var  listIndex;
    var  number;
    var  i;
 
    for (i=0; i < f.length; ++i) {
      if (f.elements[i].name.indexOf("MTF:") == 0) {
        number = parseInt(f.elements[i].name.substring(4), 10);
 
        theList = f["MTF-" + number + "-1"];
        if (theList) {
          listIndex = theList.selectedIndex;
          letter = theList.options[listIndex].value;
        } else
          letter = "";
 
        text = StripSpaces(f["MTF-" + number + "-2"].value);
        if (text == "")
          f.elements[i].value = letter;
        else
          f.elements[i].value = letter + "," + text;
      }
    }
  }
 
  function AllowReset()
  {
    return(window.confirm("Do you want to clear all of your answers?"));
  }
 
// -->
</script>
</head>
<body onResize='if(document.layers && navigator.appVersion.indexOf("Win") < 0){history.go(0);}'
bgcolor='#FFFFFF' style='background-image:url(ch9_assignment_files/header.gif); background-repeat:no-repeat'>
<noscript>
  <h3><font color='#FF0000'>Javascript not enabled</font></h3>
</noscript>
<script language='JavaScript'>
<!--
if (navigator.appName.indexOf("Netscape") >= 0) {
  if (parseInt(navigator.appVersion.charAt(0)) < 4)
    alert("This document requires Netscape Navigator version 4.0 or later.");
} else if (navigator.appName.indexOf("Explorer") >= 0) {
  if (parseInt(navigator.appVersion.charAt(0)) < 4)
    alert("This document requires Internet Explorer version 4.0 or later.");
}
// -->
</script>
<!-- BEGIN: FORM INFO -->
<form name='TestForm' action='http://score.examview.com/cgi-bin/results.cgi' method='POST'
  onSubmit='return(HandleSubmit(this, false))' onReset='return(AllowReset(this))'>
<!-- END: FORM INFO -->
<input type='hidden' name='product_version' value='4.0.7'>
<input type='hidden' name='instructor_formalname' value='Some Odd test'>
<input type='hidden' name='instructor_email' value='MarkieMark@thefunkybunch.fun'>
<input type='hidden' name='instructor_name' value='Markie Mark'>
<input type='hidden' name='instructor_org' value='DMAS'>
<input type='hidden' name='instructor_city' value='Greenville'>
<input type='hidden' name='instructor_state' value='NC'>
<input type='hidden' name='test_name' value='Some Odd Test'>
<input type='hidden' name='score_correct' value='0'>
<input type='hidden' name='score_possible' value='25'>
<input type='hidden' name='score_percent' value='0'>
<input type='hidden' name='score_subjective' value='0'>
<input type='hidden' name='score_details' value=''>
<!-- BEGIN: STUDENT INFO -->
<DIV CLASS='headerspacer'>&nbsp;</DIV>
&nbsp;&nbsp;&nbsp;&nbsp;<B>Name:</B>&nbsp;
<INPUT TYPE='TEXT' NAME='student_name' SIZE='30'> &nbsp;&nbsp;
<B>ID:</B>&nbsp;<INPUT TYPE='TEXT' NAME='student_id' SIZE='12'><BR>
<DIV CLASS='spacer'>&nbsp;</DIV>
&nbsp;&nbsp;&nbsp;&nbsp;<B>Email:</B>&nbsp;
<INPUT TYPE='TEXT' NAME='student_email' SIZE='45'>
<BR><BR>
<!-- END: STUDENT INFO -->
<DIV CLASS='title'>CH 9 ASSIGN</DIV>
 
<TABLE ALIGN='LEFT' WIDTH='100%' BORDER=0 CELLPADDING=0 CELLSPACING=0>
<!-- BEGIN: INSTRUCTION -->
<tr valign='top'>
  <td colspan='3'><br>
<div><span style='font-family:"Times New Roman", "Times", serif; font-size:12pt;
color:#000000'><b>Multiple Choice</b></span><span style='font-family:"Times New Roman", "Times",
serif; font-size:10pt; color:#000000'><br></span></div><div><span
style='font-family:"Times New Roman", "Times", serif; font-size:12pt; color:#000000'><i>Identify the
letter of the choice that best completes the statement or answers the question.</i></span></div>
<div class='spacer'>&nbsp;</div>
  </td>
</tr>
<!-- END: INSTRUCTION -->
<!-- BEGIN: QUESTION -406965:1 -->
<tr valign='baseline'>
  <td>
    <select name='MC:1' align='top'>
      <option value=' '>
      <option value='A'>A
      <option value='B'>B
      <option value='C'>C
      <option value='D'>D
    </select>
  </td>
  <td>
    <p class='qnumber'>&nbsp;1.&nbsp;</p>
  </td>
  <td width='100%'>
<div><span style='font-family:"Times New Roman", "Times", serif; font-size:12pt; color:#000000'>Who is the
smartist person in the world?</span></div><div
style='font-size:2pt'></div><table cellpadding='0' cellspacing='0' width='83%' border='0'><tr
valign='baseline'><td><div><span style='font-family:"Times New Roman", "Times", serif;
font-size:12pt; color:#000000'>a.</span></div></td><td><div><span
style='font-family:"Times New Roman", "Times", serif; font-size:12pt; color:#000000'>Me</span></div>
</td><td><div><span style='font-family:"Times New Roman", "Times",
serif; font-size:12pt; color:#000000'>c.</span></div></td><td><div><span
style='font-family:"Times New Roman", "Times", serif; font-size:12pt; color:#000000'>You</span></div>
</td></tr><tr valign='baseline'><td><div><span
style='font-family:"Times New Roman", "Times", serif; font-size:12pt;
color:#000000'>b.</span></div></td><td><div><span style='font-family:"Times New Roman", "Times",
serif; font-size:12pt; color:#000000'>That Guy</span></div></td><td><div>
<span style='font-family:"Times New Roman", "Times", serif;
font-size:12pt; color:#000000'>d.</span></div></td><td><div><span
style='font-family:"Times New Roman", "Times", serif; font-size:12pt; color:#000000'>This Guy</span>
</div></td></tr><tr height='0' style='border:none'><td width='5%'
style='width:18pt; padding:0'></td><td width='46%' style='width:193pt; padding:0'></td><td width='4%'
style='width:18pt; padding:0'></td><td width='45%' style='width:193pt; padding:0'></td></tr></table>
<div class='spacer'>&nbsp;</div>
  </td>
</tr>
<!-- END: QUESTION -406965:1 -->
</table>
<br clear='all'>
<br>
<br>
<table align='left' width='100%' cellpadding='0' cellspacing='0' border='0'>
<tr>
    <td colspan='2' bgcolor='#000000'>
    <div style='font-size:1pt'>&nbsp;</div>
    </td>
</tr>
<tr>
    <td><a href='javascript:alert("Use the mouse to submit.")'
     onMouseOver='window.status = "Grade and Submit"; return true'
     onMouseOut='window.status = ""; return true'
     onFocus='window.status = "Grade and Submit"; return true'
     onBlur='window.status = ""; return true'
     onClick="return(HandleSubmit(document.forms[0], true))">
       <img src=".../submit.gif" border='0' alt='Submit'></a>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <a href="javascript:document.forms[0].reset()">
       <img src=".../reset.gif" border='0' alt='Reset'></a>
    </td>
    <td align='right'>
  <a href="http://www.examview.com/studytip.html">
      <img src=".../help.gif" border='0' alt='Help'></a>
    </td>
</tr>
</table>

</form>
</body>
</html>
 

Filed under lifehacks having No Comments »