diff --git a/CursedScreech/api/module.php b/CursedScreech/api/module.php index 4defeff..17c711b 100755 --- a/CursedScreech/api/module.php +++ b/CursedScreech/api/module.php @@ -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); diff --git a/CursedScreech/includes/changelog/Version 1.4 b/CursedScreech/includes/changelog/Version 1.4 new file mode 100644 index 0000000..9fd6887 --- /dev/null +++ b/CursedScreech/includes/changelog/Version 1.4 @@ -0,0 +1,4 @@ +January 12, 2018 +

+ - Updated upload functionality to include better responses if uploads fail
+ \ No newline at end of file diff --git a/CursedScreech/js/module.js b/CursedScreech/js/module.js index 8f20077..1c3c94a 100755 --- a/CursedScreech/js/module.js +++ b/CursedScreech/js/module.js @@ -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; diff --git a/CursedScreech/module.info b/CursedScreech/module.info index 54cdc2a..8dcf583 100755 --- a/CursedScreech/module.info +++ b/CursedScreech/module.info @@ -6,5 +6,5 @@ "tetra" ], "title": "CursedScreech", - "version": "1.3" + "version": "1.4" } diff --git a/PortalAuth/api/module.php b/PortalAuth/api/module.php index f1d04a6..440f5d6 100755 --- a/PortalAuth/api/module.php +++ b/PortalAuth/api/module.php @@ -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); diff --git a/PortalAuth/includes/changelog/Version 1.5 b/PortalAuth/includes/changelog/Version 1.5 new file mode 100644 index 0000000..d1954cd --- /dev/null +++ b/PortalAuth/includes/changelog/Version 1.5 @@ -0,0 +1,5 @@ +January 5, 2018 +

+ - The module now creates expected directories automatically
+ - Fixed a bug that was introduced with latest version of AngularJS
+ \ No newline at end of file diff --git a/PortalAuth/includes/changelog/Version 1.6 b/PortalAuth/includes/changelog/Version 1.6 new file mode 100644 index 0000000..15c8c12 --- /dev/null +++ b/PortalAuth/includes/changelog/Version 1.6 @@ -0,0 +1,6 @@ +January 12, 2018 +

+ - Added changelog for version 1.5
+ - Added support for .bat files in the payload section
+ - Added a response when unsupported file types are uploaded
+ \ No newline at end of file diff --git a/PortalAuth/includes/help/payloads.help b/PortalAuth/includes/help/payloads.help index 20d1981..6539126 100755 --- a/PortalAuth/includes/help/payloads.help +++ b/PortalAuth/includes/help/payloads.help @@ -9,6 +9,7 @@ uploaded they are automatically stored in the proper location based on their fil