|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @copyright Copyright (c) 2020 Matthias Held <[email protected]> |
|
5
|
|
|
* @author Matthias Held <[email protected]> |
|
6
|
|
|
* @license GNU AGPL version 3 or any later version |
|
7
|
|
|
* |
|
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
10
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
11
|
|
|
* License, or (at your option) any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU Affero General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
19
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace OCA\RansomwareDetection\Db; |
|
23
|
|
|
|
|
24
|
|
|
use OCP\AppFramework\Db\Entity; |
|
|
|
|
|
|
25
|
|
|
use OCA\RansomwareDetection\Db\FileOperation; |
|
26
|
|
|
|
|
27
|
|
|
class RecoveredFileOperation extends Entity |
|
28
|
|
|
{ |
|
29
|
|
|
/** @var string */ |
|
30
|
|
|
public $userId; |
|
31
|
|
|
|
|
32
|
|
|
/** @var string */ |
|
33
|
|
|
public $path; |
|
34
|
|
|
|
|
35
|
|
|
/** @var string */ |
|
36
|
|
|
public $originalName; |
|
37
|
|
|
|
|
38
|
|
|
/** @var string */ |
|
39
|
|
|
public $newName; |
|
40
|
|
|
|
|
41
|
|
|
/** @var string */ |
|
42
|
|
|
public $type; |
|
43
|
|
|
|
|
44
|
|
|
/** @var string */ |
|
45
|
|
|
public $mimeType; |
|
46
|
|
|
|
|
47
|
|
|
/** @var int */ |
|
48
|
|
|
public $size; |
|
49
|
|
|
|
|
50
|
|
|
/** @var int */ |
|
51
|
|
|
public $corrupted; |
|
52
|
|
|
|
|
53
|
|
|
/** @var string */ |
|
54
|
|
|
public $timestamp; |
|
55
|
|
|
|
|
56
|
|
|
/** @var int */ |
|
57
|
|
|
public $command; |
|
58
|
|
|
|
|
59
|
|
|
/** @var int */ |
|
60
|
|
|
public $sequence; |
|
61
|
|
|
|
|
62
|
|
|
/** @var float */ |
|
63
|
|
|
public $entropy; |
|
64
|
|
|
|
|
65
|
|
|
/** @var float */ |
|
66
|
|
|
public $standardDeviation; |
|
67
|
|
|
|
|
68
|
|
|
/** @var string */ |
|
69
|
|
|
public $fileClass; |
|
70
|
|
|
|
|
71
|
|
|
/** @var string */ |
|
72
|
|
|
public $fileExtensionClass; |
|
73
|
|
|
|
|
74
|
|
|
/** @var int */ |
|
75
|
|
|
public $suspicionClass; |
|
76
|
|
|
|
|
77
|
|
|
public function __construct() |
|
78
|
|
|
{ |
|
79
|
|
|
// Add types in constructor |
|
80
|
|
|
$this->addType('size', 'integer'); |
|
81
|
|
|
$this->addType('corrupted', 'integer'); |
|
82
|
|
|
$this->addType('command', 'integer'); |
|
83
|
|
|
$this->addType('sequence', 'integer'); |
|
84
|
|
|
$this->addType('entropy', 'float'); |
|
85
|
|
|
$this->addType('standardDeviation', 'float'); |
|
86
|
|
|
$this->addType('suspicionClass', 'integer'); |
|
87
|
|
|
$this->addType('fileExtensionClass', 'integer'); |
|
88
|
|
|
$this->addType('fileClass', 'integer'); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function toFileOperation() { |
|
92
|
|
|
$fileOperation = new FileOperation(); |
|
93
|
|
|
$fileOperation->setUserId($this->getUserId()); |
|
94
|
|
|
$fileOperation->setPath($this->getPath()); |
|
95
|
|
|
$fileOperation->setOriginalName($this->getOriginalName()); |
|
96
|
|
|
$fileOperation->setNewName($this->getNewName()); |
|
97
|
|
|
$fileOperation->setType($this->getType()); |
|
98
|
|
|
$fileOperation->setMimeType($this->getMimeType()); |
|
99
|
|
|
$fileOperation->setSize($this->getSize()); |
|
100
|
|
|
$fileOperation->setTimestamp($this->getTimestamp()); |
|
101
|
|
|
$fileOperation->setCorrupted($this->getCorrupted()); |
|
102
|
|
|
$fileOperation->setCommand($this->getCommand()); |
|
103
|
|
|
$fileOperation->setSequence($this->getSequence()); |
|
104
|
|
|
$fileOperation->setEntropy($this->getEntropy()); |
|
105
|
|
|
$fileOperation->setStandardDeviation($this->getStandardDeviation()); |
|
106
|
|
|
$fileOperation->setFileClass($this->getFileClass()); |
|
107
|
|
|
$fileOperation->setFileExtensionClass($this->getFileExtensionClass()); |
|
108
|
|
|
return $fileOperation; |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths