function session_begin($sessname, $hash, $format, $options, $mode, $dictionnary, $rules) { if (preg_match('/^[a-zA-Z0-9\\-_]*$/', $sessname) === 0) { die('Session name must be [a-zA-Z0-9]*'); } $john = new johnSession('', $format, $sessname, $options); $hashfile = CONST_SESSIONDIR . $john->session_name . '.hash'; $john->updateJohnConf(array('hashfile' => $hashfile)); $dicts = johnSession::getDicts(); if ($mode == 'brute') { $john->updateJohnConf(array('mode' => $mode)); } elseif ($mode == 'dictionnary') { $john->updateJohnConf(array('mode' => $mode)); $john->updateJohnConf(array('dictionnary' => $dicts[$dictionnary])); $john->updateJohnConf(array('rules' => $rules)); } //~ var_dump($hashfile); $a = explode("\n", $hash); foreach ($a as $i => $line) { $a[$i] = rtrim($line, ':'); } $hash = implode("\n", $a); file_put_contents($hashfile, $hash); $john->start(); }
<div class="span1"> Nodes <input class="span1" type="text" placeholder="X(-Y)/Z" name="nodes" id="nodes"> </div> <div class="span2"> Mode <select class="span2" name="mode" id="mode"> <option value="brute">Brute</option> <option value="dictionnary">Dictionnary</option> </select> </div> <div class="span2"> Dictionnary <select class="span2" name="dictionnary" id="dictionnary"> <?php foreach (johnSession::getDicts() as $key => $file) { print '<option value=' . $key . '>' . $file . '</option>'; } ?> </select> </div> <div class="span2"> Rules <select class="span2" name="rules" id="rules"> <?php foreach (johnSession::getRules() as $rule) { print '<option value=' . $rule . '>' . $rule . '</option>'; } ?> </select> </div>