1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (c) 2017 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\RecoveredFileOperation; |
26
|
|
|
|
27
|
|
|
class FileOperation 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 toRecoveredFileOperation() { |
92
|
|
|
$recoveredFileOperation = new RecoveredFileOperation(); |
93
|
|
|
$recoveredFileOperation->setUserId($this->getUserId()); |
94
|
|
|
$recoveredFileOperation->setPath($this->getPath()); |
95
|
|
|
$recoveredFileOperation->setOriginalName($this->getOriginalName()); |
96
|
|
|
$recoveredFileOperation->setNewName($this->getNewName()); |
97
|
|
|
$recoveredFileOperation->setType($this->getType()); |
98
|
|
|
$recoveredFileOperation->setMimeType($this->getMimeType()); |
99
|
|
|
$recoveredFileOperation->setSize($this->getSize()); |
100
|
|
|
$recoveredFileOperation->setTimestamp($this->getTimestamp()); |
101
|
|
|
$recoveredFileOperation->setCorrupted($this->getCorrupted()); |
102
|
|
|
$recoveredFileOperation->setCommand($this->getCommand()); |
103
|
|
|
$recoveredFileOperation->setSequence($this->getSequence()); |
104
|
|
|
$recoveredFileOperation->setEntropy($this->getEntropy()); |
105
|
|
|
$recoveredFileOperation->setStandardDeviation($this->getStandardDeviation()); |
106
|
|
|
$recoveredFileOperation->setFileClass($this->getFileClass()); |
107
|
|
|
$recoveredFileOperation->setFileExtensionClass($this->getFileExtensionClass()); |
108
|
|
|
return $recoveredFileOperation; |
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