How to make APPS in THC_HS 0.2+
SUMMARY:
Apps are the only tools you need to install first, this is very easy:
main configuration > add page path
Once you do this a record in extra.php(/Data) will be made and you will be able to use the application after you click the succeeded link.
THC_HS 0.2 APPS
Since THC_HS 0.2 a few things have changed in apps handling.
First of all you need to specify a variable called $_IDENTIFY, much of it's function will be probably be implemented later on(maybe update check on apps.php..?), but for now it allows you to install apps with less effort, also without this variable the app won't show up in apps.php as it includes all items in extra.php so without $_IDENTIFY the app won't be indentified as such.
This is pretty much the only difference, so let's get started and use thc_ad aka AdflyFuck for a demo and I will bring it down to a template you can use to convert your own apps to thc compatible apps that you can link into the suite.
<?php
/* Tools & Design 2008-2011
Author: Remco Kouw
Site: http://www.hacksuite.com
*/
// if the file is included(apps.php) just set the $_IDENTIFY array
$_IDENTIFY = array();
$_IDENTIFY['name'] = "thc_ad";
$_IDENTIFY['label'] = "AdflyFuck";
$_IDENTIFY['file'] = "adflyfuck.php";
$_IDENTIFY['version'] = "0.0.3";
$_IDENTIFY['author'] = "zomgwtfbbq";
if(!defined('IN_SCRIPT')){
include_once("header.php");
if(isset($_POST['sUrl'])){
// form submitted, let's fetch the page data
$sUrl = $_POST['sUrl'];
if(substr($sUrl,0,14)!="http://adf.ly/"){
die("Not a valid adfly link.");
}
// connect and get data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$sResponse = curl_exec($ch);
curl_close($ch);
$sSearch = "_.G(\"skip_button\").href = '";
$iStart = strpos($sResponse,$sSearch) + strlen($sSearch);
$sTarget = substr($sResponse,$iStart,(strpos($sResponse,"'",$iStart)-$iStart));
$aUrl = @parse_url($sTarget);
if(!isset($aUrl['host']) || !@strlen($aUrl['host'])){
die("Invalid host, target not found.");
}
header("Location: ".$sTarget);
exit;
}
else{
/* send adfly url */
$sCode = "<div class=\"applayout\">\n";
$sCode .= " <form method=\"post\" target=\"_blank\">\n";
$sCode .= " <h2 class=\"apps\">".$_IDENTIFY['label']."</h2>\n";
$sCode .= " <table border=\"0\">\n";
$sCode .= " <tr><td>ad page:</td><td><input type=\"text\" name=\"sUrl\" value=\"\"></td></tr>\n";
$sCode .= " <tr><td colspan=2><input type=\"submit\" name=\"submit\" value=\"Open\"></td></tr>\n";
$sCode .= " </table>\n";
$sCode .= " </form>\n";
$sCode .= "</div>\n";
}
include_once($_PATHS['style_root']."/index.php");
}
?>Ok now let's bring this down to our cute little hello world program.. ![]()
<?php
$_IDENTIFY = array();
$_IDENTIFY['name'] = "thc_ad";
$_IDENTIFY['label'] = "AdflyFuck";
$_IDENTIFY['file'] = "adflyfuck.php";
$_IDENTIFY['version'] = "0.0.3";
$_IDENTIFY['author'] = "zomgwtfbbq";
if(!defined('IN_SCRIPT')){
include_once("header.php");
// here goes your app and stores output in $sCode
$sCode = "hello world!";
include_once($_PATHS['style_root']."/index.php");
}
?>As you can see with a small amount of code you can create your own app and integrate it into the hacksuite, you just need to edit the $_IDENTIFY variable which is too straightforward to actually discuss it.
All your output should just always be available in variable $sCode and you're good to go, oh and don't forget to add the page path. ![]()
I'm a motherfucker..but still cute! ![]()