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