Your IP : 216.73.216.134


Current Path : /home/bijouxly/old/aesecure/tools/pentest/
Upload File :
Current File : /home/bijouxly/old/aesecure/tools/pentest/pentest.js

// @file : /tools/pentest/pentest.js
// @version : 2.0.2
// @author : AVONTURE Christophe - christophe@aesecure.com
// @copyright : (C) 2013-2015 - Christophe Avonture - all right reserved.
// @url : http://www.aesecure.com/
// @package : 2015-02-14 13:37:55
// @license : This program is a commercial software.  You CAN'T redistribute it and/or modify it.
// Source code is the property of Christophe Avonture and can't be reused, in whole or in part, in any programs.
$(document).ready(function (){
$('#toolbar').affix({offset:{top: $('header').height()-$('#toolbar').height()}});
$.ajax({
url: 'pentest.php',
data: 'task=json&'+aeSecure.token+'='+aeSecure.token_value,
method: 'POST',
dataType:'json'
}).done(function(data){
$site=Aes.Ctr.decrypt(data['url'],'dtHWqdjtlxHHRrz1k70M',256);
select(0);
$('.actionbtn').click(function(){
var $task=$(this).attr('data-task');var $restrict=$(this).attr('data-restrict');
if(typeof($restrict)==undefined) $restrict="";var $url='';var $id=$(this).attr('data-id');
if($id!==undefined){
var $url=$('#url'+$id).html();
if($url.indexOf("http")<0) $url=$site+$url;}
if(typeof($task)!==undefined){
switch($task){
case 'doit'         :doIt($restrict); break;
case 'select_all'   :select(0,$restrict); break;
case 'unselect_all' :select(1,$restrict); break;
case 'select_toggle':select(2,$restrict); break;
case 'open'         :window.open($url);break;}}});
function doIt($restrict){
$restrict=(typeof $restrict==="undefined")?'':$restrict;
$nbr=0;
$('#frmPenTest input:checkbox').each(function(){
var $name=this.id;var $id=$name.replace('chk','');var $code=$(this).attr('data-parent');
if(typeof($code)==undefined) $code="";
$bContinue=true;
if($restrict!=""){ $bContinue=($restrict==$code);}
if($bContinue){
if(this.checked==true){
var $code=$(this).attr('data-parent');
if(typeof($code)==undefined) $code="";
$nbr+=1;var $url=$('#url'+$id).html();
if($url.indexOf("http")==-1) $url=$site+$url;
console.log ('CHECK '+$url);var $method
var $postdata='';
$method=$url.match(/^(GET|POST|HEAD|PUT|TRACE|DELETE|TRACK) /);
if($method==null){
$method='GET';}else{
$url=$url.replace($method[0],'');
$method=$method[0].trim();
if($method=='POST'){
if($url.indexOf("?")>0){
$postdata=$url.slice($url.indexOf('?') + 1);
$url=$url=$url.split("?")[0];}}}
$.ajax({
type: $method,
url: $url,
async: true,
data: ($method==="POST"?$postdata:''),
beforeSend:function(request){
request.setRequestHeader("aeSecure-penTest","true");}})
.always(function (jqXHR, textStatus){
var $code=jqXHR.status;var $aeSecureCode='';
try {
$aeSecureCode=jqXHR.getResponseHeader('aeSecure-code');
if($aeSecureCode!==null){
$aeSecureCode='<br/><span class="blocked">aeSecure&nbsp;code&nbsp;'+$aeSecureCode+'</span>';}else{
$aeSecureCode='';}} catch(ex){
}
if(textStatus=='success'){
$code=200;
$class='danger';
$statusText='Page displayed';}else{
switch($code){
case 403: $class='success status403';break;
case 404: $class='warning status404';break;
case 405: $class='warning status404';break;
case 500: $class='warning status404';break;
default: $class='warning';}
$statusText=jqXHR.statusText;}
$('#result'+$id).addClass($class);
$('#result'+$id).html('HTTP status '+$code+'<br/>'+$statusText+$aeSecureCode);});}}});
return;}
function select($type,$restrict){
$restrict=(typeof $restrict==="undefined")?'':$restrict;
$('#frmPenTest input:checkbox').each(function(){
var $code=$(this).attr('data-parent');
if(typeof($code)==undefined) $code="";
$bContinue=true;
if($restrict!=""){ $bContinue=($restrict==$code);}
if($bContinue){
switch($type){
case 0:if(this.checked==false) this.checked=true;break;
case 1:if(this.checked==true) this.checked=false;break;
case 2:$(this).prop("checked", !$(this).prop("checked"));break;}}});
return;}});});