Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias <ilovemilk@wusa.io>2020-03-31 22:36:19 +0300
committerMatthias <ilovemilk@wusa.io>2020-03-31 22:36:19 +0300
commit19e40832019c7d072981e804450c2aa6e0c26090 (patch)
treec3bf9c5cb52e15d087ce7cb0477f693f005bcb74
parent38d4f122cf013a61f1c7c072ade58f17fef36797 (diff)
fix comments
-rw-r--r--lib/Events/FilesEvents.php51
-rw-r--r--lib/FilesHooks.php70
2 files changed, 60 insertions, 61 deletions
diff --git a/lib/Events/FilesEvents.php b/lib/Events/FilesEvents.php
index a996e61..abd514b 100644
--- a/lib/Events/FilesEvents.php
+++ b/lib/Events/FilesEvents.php
@@ -1,15 +1,8 @@
<?php
-declare(strict_types=1);
-
/**
- * Files_FullTextSearch - Index the content of your files
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @copyright 2018
+ * @copyright Copyright (c) 2020 Matthias Held <matthias.held@uni-konstanz.de>
+ * @author Matthias Held <matthias.held@uni-konstanz.de>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
@@ -23,36 +16,31 @@ declare(strict_types=1);
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
namespace OCA\RansomwareDetection\Events;
use OCA\RansomwareDetection\Monitor;
use OCA\RansomwareDetection\AppInfo\Application;
use OCP\ILogger;
-/**
- * Class FilesEvents
- *
- * @package OCA\Files_FullTextSearch\Events
- */
class FilesEvents {
/** @var string */
private $userId;
+ /** @var ILogger */
private $logger;
+ /** @var Monitor */
private $monitor;
/**
- * FilesEvents constructor.
- *
- * @param string $userId
+ * @param ILogger $logger
+ * @param Monitor $monitor
+ * @param string $userId
*/
public function __construct(
ILogger $logger,
@@ -67,9 +55,6 @@ class FilesEvents {
/**
* @param array $params
- *
- * @throws InvalidPathException
- * @throws NotFoundException
*/
public function onFileUpdate(array $params) {
$this->logger->error("Updating ".$params['path'], ['app' => Application::APP_ID]);
@@ -79,35 +64,47 @@ class FilesEvents {
/**
* @param array $params
- *
- * @throws NotFoundException
- * @throws InvalidPathException
*/
public function onFileRename(array $params) {
$this->logger->error("Renaming ".$params['oldpath']." to ".$params['newpath'], ['app' => Application::APP_ID]);
$this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME);
}
+ /**
+ * @param array $params
+ */
public function onFileCreate(array $params) {
$this->logger->error("Creating ".$params['path'], ['app' => Application::APP_ID]);
$this->analyze([$params['path']], Monitor::CREATE);
}
+ /**
+ * @param array $params
+ */
public function onFileWrite(array $params) {
- $this->logger->error("Writing ".$params['path'], ['app' => Application::APP_ID]);
+ $this->logger->error("Writing ".$params['path']." whole array ".implode($params), ['app' => Application::APP_ID]);
$this->analyze([$params['path']], Monitor::WRITE);
}
+ /**
+ * @param array $params
+ */
public function onFileDelete(array $params) {
$this->logger->error("Deleting ".$params['path'], ['app' => Application::APP_ID]);
$this->analyze([$params['path']], Monitor::DELETE);
}
+ /**
+ * @param array $params
+ */
public function onFileCopy(array $params) {
$this->logger->error("Copying ".$params['oldpath']." to ".$params['newpath'], ['app' => Application::APP_ID]);
$this->analyze([$params['oldpath'], $params['newpath']], Monitor::RENAME);
}
+ /**
+ * @param array $params
+ */
public function onFileTouch(array $params) {
$this->logger->error("Touching ".$params['path'], ['app' => Application::APP_ID]);
$this->analyze([$params['path']], Monitor::WRITE);
diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php
index efd81d0..6a74261 100644
--- a/lib/FilesHooks.php
+++ b/lib/FilesHooks.php
@@ -1,15 +1,8 @@
<?php
-declare(strict_types=1);
-
/**
- * Files_FullTextSearch - Index the content of your files
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @copyright 2018
+ * @copyright Copyright (c) 2020 Matthias Held <matthias.held@uni-konstanz.de>
+ * @author Matthias Held <matthias.held@uni-konstanz.de>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
@@ -23,28 +16,20 @@ declare(strict_types=1);
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-
namespace OCA\RansomwareDetection;
use OCA\RansomwareDetection\AppInfo\Application;
use OCA\RansomwareDetection\Events\FilesEvents;
-/**
- * Class FilesHooks
- *
- * @package OCA\Files_FullTextSearch\Hooks
- */
class FilesHooks {
/**
- * retrieve the FilesEvents' Controller
+ * Retrieve the FilesEvents' Controller.
*
* @return FilesEvents
- * @throws QueryException
*/
protected static function getController(): FilesEvents {
$app = new Application();
@@ -54,13 +39,9 @@ class FilesHooks {
}
/**
- * hook events: file is updated
+ * Hook events: file is updated.
*
* @param array $params
- *
- * @throws QueryException
- * @throws InvalidPathException
- * @throws NotFoundException
*/
public static function onFileUpdate(array $params) {
self::getController()
@@ -69,39 +50,60 @@ class FilesHooks {
/**
- * hook events: file is renamed
+ * Hook events: file is renamed.
*
* @param array $params
- *
- * @throws NotFoundException
- * @throws QueryException
- * @throws InvalidPathException
*/
public static function onFileRename(array $params) {
self::getController()
->onFileRename($params);
}
-
+
+ /**
+ * Hook events: file is created.
+ *
+ * @param array $params
+ */
public static function onFileCreate(array $params) {
self::getController()
->onFileCreate($params);
}
-
+
+ /**
+ * Hook events: file is written.
+ *
+ * @param array $params
+ */
public static function onFileWrite(array $params) {
self::getController()
->onFileWrite($params);
}
-
+
+ /**
+ * Hook events: file is deleted.
+ *
+ * @param array $params
+ */
public static function onFileDelete(array $params) {
self::getController()
->onFileDelete($params);
}
-
+
+ /**
+ * Hook events: file is touched.
+ *
+ * @param array $params
+ */
public static function onFileTouch(array $params) {
self::getController()
->onFileTouch($params);
}
-
+
+ /**
+ * Hook events: file is copied.
+ *
+ * @param array $params
+ */
public static function onFileCopy(array $params) {
self::getController()
->onFileCopy($params);