..going to create a new app for the hacksuite. We're not going to do anything fancy here, we will make a simple app to get familiar how to write compatible scripts for the suite. We..
Creates a blueprint/map of a server folder
<?php
/* Changes your test server settings for the HackSuite
Author: Remco Kouw
Site: http://www.hacksuite.com
Last Edit: 07-02-2015
*/
session_cache_limiter('nocache');
header('Expires: '.gmdate('r',0));
header('Content-type: application/json');
$_DYNAMIC_ROOT = "..";
$bWriteMe = false;
include_once("../header.php");
$sDest = "../vars.php";
$aDataR = array();
$aDataR['jresult'] = false;
$aDataR['jmessage'] = "an error occured";
// target files we need, so make sure they are present
$aFiles = array($_PATHS['functions_root']."/fwrite.php",$_PATHS['functions_root']."/get_file_data.php");
for($x=0;$x<count($aFiles);$x++){
if(!file_exists($aFiles[$x])){
$aDataR['jmessage'] = "Missing required file: ".$aFiles[$x];
die(json_encode($aDataR));
}
@include_once($aFiles[$x]);
}
if(!is_writable($sDest)){
$aDataR['jmessage'] = "Make sure the file vars.php in root is writable";
}
else{
$sData = GetFileData($sDest);
// update the settings
$sOld = "\$_CONTEXT['allow_testservers'] = ".($_CONTEXT['allow_testservers'] ? "true" : "false").";";
$sNew = "\$_CONTEXT['allow_testservers'] = ".($_CONTEXT['allow_testservers'] ? "false" : "true").";";
$sData = str_replace($sOld,$sNew,$sData);
$aDataR['jmessage'] = "Setting has been successfully changed";
WriteF($sDest,$sData,"w");
$aDataR['jresult'] = true;
$bWriteMe = true;
}
echo json_encode($aDataR);
?>