Updated PortalAuth to 1.6 & CursedScreech to 1.4 (#6)

pull/7/head
Nick 2018-01-13 04:02:26 -05:00 committed by Sebastian Kinne
parent a72ce33eed
commit dac3bffe6b
10 changed files with 57 additions and 22 deletions

View File

@ -37,24 +37,27 @@ if (!empty($_FILES)) {
$response = [];
foreach ($_FILES as $file) {
$tempPath = $file[ 'tmp_name' ];
$name = $file['name'];
$name = pathinfo($file['name'], PATHINFO_FILENAME);
$type = pathinfo($file['name'], PATHINFO_EXTENSION);
// Ensure the upload directory exists
if (!file_exists(__PAYLOADS__)) {
if (!mkdir(__PAYLOADS__, 0755, true)) {
$response[$name] = "Failed";
$response[$name]['success'] = "Failed";
$response[$name]['message'] = "Failed to create payloads directory";
echo json_encode($response);
die();
}
}
$uploadPath = __PAYLOADS__ . $name;
$uploadPath = __PAYLOADS__ . $name . "." . $type;
$res = move_uploaded_file($tempPath, $uploadPath);
if ($res) {
$response[$name] = "Success";
$response[$name]['success'] = "Success";
} else {
$response[$name] = "Failed";
$response[$name]['success'] = "Failed";
$response[$name]['message'] = "Failed to upload payload '" . $name . "." . $type . "'";
}
}
echo json_encode($response);

View File

@ -0,0 +1,4 @@
January 12, 2018
<br /><br />
- Updated upload functionality to include better responses if uploads fail<br />

View File

@ -684,13 +684,18 @@ registerController('CursedScreechController', ['$api', '$scope', '$sce', '$inter
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).then(function(response) {
for (var key in response) {
if (response.hasOwnProperty(key)) {
if (response.key == "Failed") {
alert("Failed to upload " + key);
var errors = {};
for (var key in response.data) {
if (response.data[key].success == "Failed") {
var msg = response.data[key].message + '\n';
if (!errors.hasOwnProperty(msg)) {
errors[msg] = true;
}
}
}
if (Object.keys(errors).length > 0) {
alert(Object.keys(errors).join(''));
}
$scope.selectedFiles = [];
$scope.getPayloads();
$scope.uploading = false;

View File

@ -6,5 +6,5 @@
"tetra"
],
"title": "CursedScreech",
"version": "1.3"
"version": "1.4"
}

View File

@ -43,13 +43,16 @@ if (!empty($_FILES)) {
$response = [];
foreach ($_FILES as $file) {
$tempPath = $file[ 'tmp_name' ];
$name = $file['name'];
$name = pathinfo($file['name'], PATHINFO_FILENAME);
$type = pathinfo($file['name'], PATHINFO_EXTENSION);
switch ($type) {
case 'exe':
$dest = __WINDL__;
break;
case 'bat':
$dest = __WINDL__;
break;
case 'zip':
$dest = __OSXDL__;
break;
@ -63,26 +66,29 @@ if (!empty($_FILES)) {
$dest = __INJECTS__;
break;
default:
break;
$response[$name]['success'] = "Failed";
$response[$name]['message'] = "File type '" . $type . "' is not supported";
continue 2;
}
// Ensure the upload directory exists
if (!file_exists($dest)) {
if (!mkdir($dest, 0755, true)) {
PortalAuth::logError("Failed Upload", "Failed to upload " . $file['name'] . " because the directory structure could not be created");
PortalAuth::logError("Failed Upload", "Failed to upload " . $name . "." . $type . " because the directory structure could not be created");
}
}
$uploadPath = $dest . $name;
$uploadPath = $dest . $name . "." . $type;
$res = move_uploaded_file( $tempPath, $uploadPath );
if ($res) {
if ($type == "gz") {
exec(__SCRIPTS__ . "unpackInjectionSet.sh " . $name);
exec(__SCRIPTS__ . "unpackInjectionSet.sh " . $name . "." . $type);
}
$response[$name] = "Success";
$response[$name]['success'] = "Success";
} else {
$response[$name] = "Failed";
$response[$name]['success'] = "Failed";
$response[$name]['message'] = "Failed to upload " . $name . "." . $type;
}
}
echo json_encode($response);

View File

@ -0,0 +1,5 @@
January 5, 2018
<br /><br />
- The module now creates expected directories automatically<br />
- Fixed a bug that was introduced with latest version of AngularJS<br />

View File

@ -0,0 +1,6 @@
January 12, 2018
<br /><br />
- Added changelog for version 1.5<br />
- Added support for .bat files in the payload section<br />
- Added a response when unsupported file types are uploaded<br />

View File

@ -9,6 +9,7 @@ uploaded they are automatically stored in the proper location based on their fil
<br /><br />
<ul>
<li>.exe => /www/download/windows/</li>
<li>.bat => /www/download/windows/</li>
<li>.zip => /www/download/osx/</li>
<li>.ipk => /www/download/android/</li>
<li>.ipa => /www/download/ios/</li>

View File

@ -641,13 +641,18 @@ registerController('PortalAuthController', ['$api', '$scope', '$sce', '$interval
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).then(function(response) {
for (var key in response) {
if (response.hasOwnProperty(key)) {
if (response.key == "Failed") {
alert("Failed to upload " + key);
var errors = {};
for (var key in response.data) {
if (response.data[key].success == "Failed") {
var msg = response.data[key].message + '\n';
if (!errors.hasOwnProperty(msg)) {
errors[msg] = true;
}
}
}
if (Object.keys(errors).length > 0) {
alert(Object.keys(errors).join(''));
}
$scope.pa_selectedFiles = [];
$scope.getInjectionSets();
$scope.getPayloads();

View File

@ -6,5 +6,5 @@
"tetra"
],
"title": "Portal Auth",
"version": "1.5"
"version": "1.6"
}