CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

Version 1.0...


[Replies] [Reply] [View by Thread] [Help]
[Back To SNEAK Development Forum]

Posted by Mar Tacheon On 2005-02-26 17:38:41
In Reply to Smart Solver Posted by CinC snarkles On 2005-02-15 17:18:56

Mar
Mar Tacheon


Ok,

This has two options:

1) verify with a given word (basically it searches the text for the word given, and gives a verified message if it's found)

2) verify from a file (it checks each word entered against each word in the file, and reports any matches as verification)

This is only a simple 'proof of concept' page. It just shows that it is possible. It still needs a better seareching method (this is effectively brute force) as well as changes to allow it to be called as a function.

A test version is here: http://www.crypto-net.com/smartSolver.php

Code (very messy at the moment, sorry) here:
<?php

/*******************************************
 * smartSolver.php.			   *
 *   					   *
 * Version: 1.0 			   *
 *					   *
 * Date: 15th Feb 2005		           *
 *                                         *
 * Author: Tacheon                         *
 *					   *
 * Purpose: To validate text that has been *
 *          decrypted or decoded           *
 *					   *
 *******************************************/

?>

<html>
 <head>
  <title>smartSolver 1.0</title>
  <link rel="StyleSheet" href="./smartSolver.css" type="text/css">
 </head>
 <body bgcolor="#dddddd" text="#000000">
  <br /><center><h2><b>SmartSolver 1.0</b></h2></center>

<?php

if (isset($submit)) 
{
  echo "<table width=\"450\" border=\"1\" align=\"center\" cellspacing=\"0\" cellpadding=\"10\">\n";
  echo " <tr valign=\"top\">\n";
  echo "  <td>\n";

  if ($text == '') 
  { 
    echo "<br /><font color=\"#ff0000\"><b>Error:</b> You must enter text into the Text Entry box!</font><br /><br />\n"; 
  } 
  else if ($verifyMode != 'word' && $verifyMode != 'file')
  { 
    echo "<br /><font color=\"#ff0000\"><b>Error:</b> You must Select a smartSolver option!</font><br /><br />\n"; 
  }
  else 
  { 
    if ($verifyMode == 'word') 
    {
      $mode = "Verify using a word";
    }
    else if ($verifyMode == 'file')
    {
      $mode = "Verify from a dictionary file";
    }
    else 
    {
      $mode = "No options selected!";
    }

    echo "<b>Text Entered:</b> $text<br /><br />\n"; 
    echo "<b>Option Selected:</b> $mode<br /><br />\n"; 
    $showResults = 'yes';
  }

  echo "  </td>";
  echo " </tr>";
  echo "</table>";
  echo "<br />";

  if ($showResults == 'yes')
  {
    echo "<table width=\"450\" border=\"1\" align=\"center\" cellspacing=\"0\" cellpadding=\"10\">\n";
    echo " <tr valign=\"top\">\n";
    echo "  <td>\n";
    echo "   <b>Results:</b><br /><br />\n"; 

    if ($verifyMode == 'word') 
    {
      // Check for word...
      
      if ($stringToVerify == '') 
      {
        echo "<br /><font color=\"#ff0000\"><b>Error:</b> No word has been entered!</font><br /><br />\n"; 
      } 
      else
      {
        // Validate with given word...

        $success = 'no';
        $words = explode(' ', $text);
        for($i=0;$i<count($words);$i++)
        { 
          if ($words[$i] == $stringToVerify)
          { 
            echo "<b>VERIFIED</b> - Text contines the word '$stringToVerify'.<br /><br />\n";
            $success = 'yes';
            break;
          } 
        }
        if ($success == 'no')
        {
          echo "<b>Word Not Found!!</b><br /><br />\n";
        }
      } // End word check.
    }
    else if ($verifyMode == 'file')
    {
      // Validate with File...

      $filename = "sSdictionary.txt";
      $fp = fopen($filename, "r");
      if(!$fp) 
      {
        echo "<br /><font color=\"#ff0000\"><b>Error:</b> Cannot Open File!</font><br /><br />\n";
      }
      else
      {
        $success = 'no';
        $enteredText = explode(' ', $text);
        $words = explode(':', fread($fp, filesize($filename)));

        for($j=0;$j<count($enteredText);$j++)
        {
          for($i=0;$i<count($words);$i++)
          {
            if ($enteredText[$j] == $words[$i])
            { 
              echo "<b>VERIFIED</b> - Text contines the word '$words[$i]'.<br /><br />\n";
              $success = 'yes';
              break;
            } 
          }
        }

        if ($success == 'no')
        {
          echo "<b>Word Not Found!!</b><br /><br />\n";
        }

        if ($showWords == 'yes') 
        {
          echo "<b>Words from file:</b><br /><br />";
          for($i=0;$i<count($words);$i++)
          { 
            echo "$i : $words[$i] <br />";
          }
        } // End show words

        fclose($fp);

      } // End file check.
    }
    
    echo "  </td>\n";
    echo " </tr>\n";
    echo "</table>\n";
    echo "<br />\n";
  }
} 
else 
{
  // Input Form...

?>

 <center>
  <form action="<?php echo($_SERVER['PHP_SELF']); ?>" method="post">
   <table width="450" border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <b>Text Entry:</b><br /><br />
      <input type="text" name="text" size="64"><br /><br />
     </td>
    </tr>
   </table>
   <br />
   <table width="450" border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <b>smartSolver Options:</b><br /><br />
      <input type="radio" name="verifyMode" value="word" /> Verify With Word: &nbsp; &nbsp; <input type="text" name="stringToVerify" size="42"><br /><br />
      <input type="radio" name="verifyMode" value="file" /> Verify With File. &nbsp; &nbsp; <input type="checkbox" name="showWords" value="yes" /> Show Words in File?<br /><br />
     </td>
    </tr>
   </table>
   <br />
   <table border="1" align="center" cellspacing = "0" cellpadding="10">
    <tr valign="top">
     <td>
      <input type="submit" name="submit" value=" Submit " /> &nbsp; &nbsp;
      <input type="reset" value=" Clear " />
     </td>
    </tr>
   </table>
  </form>
 </center>

<?php 

}  // End Submit Check. 

echo " </body>\n";
echo "</html>\n";

?>
Mar. Tacheon
Brigade Coordinator

Projects: ChalDev, IT News, CA-History, SNEAK

Crypto-Net




Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02070 seconds


About Us | Privacy Policy | Mission Statement | Help