malwareDetector 0.1.12__tar.gz → 0.1.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of malwareDetector might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malwareDetector
3
- Version: 0.1.12
3
+ Version: 0.1.13
4
4
  Summary: Malware detector specification for NTUST isLab
5
5
  Author: PO-LIN LAI
6
6
  Author-email: bolin8017@gmail.com
@@ -8,50 +8,48 @@ License: MIT
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENCE.txt
11
+ Requires-Dist: numpy
12
+ Requires-Dist: pydantic
11
13
 
12
- malwareDetector
13
- ===============
14
+ # malwareDetector
14
15
 
15
16
  * Source code: https://github.com/louiskyee/malwareDetector.git
16
17
  * Wiki: https://github.com/louiskyee/malwareDetector/wiki
17
18
  * PyPI: https://pypi.org/project/malwareDetector/
18
19
 
19
- Description
20
- -----------
20
+ ## Description
21
21
 
22
22
  This is a malware detector specification for NTUST isLab.
23
23
  The `malwareDetector` is a base class designed for malicious software detection. It enables straightforward utilization of Python's inheritance feature. By inheriting from `malwareDetector` and implementing the required functions, you can achieve your specific goals. Additionally, it offers convenient configuration management. For more detailed instructions, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
24
24
 
25
- Requirements
26
- ------------
27
- Tool | Version |Source |
28
- |---|---|---|
29
- | Python | `>= 3.10` | https://www.python.org/downloads |
25
+ ## Requirements
30
26
 
31
- Installation
32
- ------------
27
+ Tool | Version | Source
28
+ -----|---------|-------
29
+ Python | `>= 3.10` | https://www.python.org/downloads
30
+
31
+ ## Installation
33
32
 
34
33
  Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `malwareDetector`.
35
34
  * Example: `pip install malwareDetector`
36
35
 
37
- Usage
38
- -----
36
+ ## Usage
39
37
 
40
- ### import
41
- * import class `detector` from `malwareDetector.detector`
42
- ```python=
38
+ ### Import
39
+ * Import class `detector` from `malwareDetector.detector`
40
+ ```python
43
41
  from malwareDetector.detector import detector
44
42
  ```
45
43
 
46
- ### Examples:
47
- ```python=
48
- from malwareDetector.detector import detector
49
- from typing import Any
44
+ ### Example:
45
+ ```python
50
46
  import numpy as np
47
+ from typing import Any
48
+ from malwareDetector.detector import detector
51
49
 
52
50
  class subDetector(detector):
53
- def __init__(self) -> None:
54
- super().__init__()
51
+ def __init__(self, config_path=None) -> None:
52
+ super().__init__(config_path)
55
53
 
56
54
  def extractFeature(self) -> Any:
57
55
  return 'This is the implementation of the extractFeature function from the derived class.'
@@ -59,9 +57,22 @@ class subDetector(detector):
59
57
  def vectorize(self) -> np.array:
60
58
  return 'This is the implementation of the vectorize function from the derived class.'
61
59
 
62
- def model(self) -> Any:
60
+ def model(self, training: bool = True) -> Any:
63
61
  return 'This is the implementation of the model function from the derived class.'
64
62
 
65
63
  def predict(self) -> np.array:
66
64
  return 'This is the implementation of the predict function from the derived class.'
67
65
  ```
66
+
67
+ ## Configuration
68
+
69
+ The `malwareDetector` uses a configuration system that can be customized through a JSON file or command-line arguments. The default configuration file is `config.json` in the current directory, but you can specify a custom path when initializing the detector.
70
+
71
+ ### Key Configuration Classes:
72
+
73
+ - `Config`: Stores all external settings for the detector.
74
+ - `PathConfig`: Manages input and output file paths.
75
+ - `FolderConfig`: Handles folder configurations for data storage.
76
+ - `ModelConfig`: Stores model-specific parameters and hyperparameters.
77
+
78
+ For detailed information on configuration options and usage, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
@@ -1,46 +1,42 @@
1
- malwareDetector
2
- ===============
1
+ # malwareDetector
3
2
 
4
3
  * Source code: https://github.com/louiskyee/malwareDetector.git
5
4
  * Wiki: https://github.com/louiskyee/malwareDetector/wiki
6
5
  * PyPI: https://pypi.org/project/malwareDetector/
7
6
 
8
- Description
9
- -----------
7
+ ## Description
10
8
 
11
9
  This is a malware detector specification for NTUST isLab.
12
10
  The `malwareDetector` is a base class designed for malicious software detection. It enables straightforward utilization of Python's inheritance feature. By inheriting from `malwareDetector` and implementing the required functions, you can achieve your specific goals. Additionally, it offers convenient configuration management. For more detailed instructions, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
13
11
 
14
- Requirements
15
- ------------
16
- Tool | Version |Source |
17
- |---|---|---|
18
- | Python | `>= 3.10` | https://www.python.org/downloads |
12
+ ## Requirements
19
13
 
20
- Installation
21
- ------------
14
+ Tool | Version | Source
15
+ -----|---------|-------
16
+ Python | `>= 3.10` | https://www.python.org/downloads
17
+
18
+ ## Installation
22
19
 
23
20
  Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `malwareDetector`.
24
21
  * Example: `pip install malwareDetector`
25
22
 
26
- Usage
27
- -----
23
+ ## Usage
28
24
 
29
- ### import
30
- * import class `detector` from `malwareDetector.detector`
31
- ```python=
25
+ ### Import
26
+ * Import class `detector` from `malwareDetector.detector`
27
+ ```python
32
28
  from malwareDetector.detector import detector
33
29
  ```
34
30
 
35
- ### Examples:
36
- ```python=
37
- from malwareDetector.detector import detector
38
- from typing import Any
31
+ ### Example:
32
+ ```python
39
33
  import numpy as np
34
+ from typing import Any
35
+ from malwareDetector.detector import detector
40
36
 
41
37
  class subDetector(detector):
42
- def __init__(self) -> None:
43
- super().__init__()
38
+ def __init__(self, config_path=None) -> None:
39
+ super().__init__(config_path)
44
40
 
45
41
  def extractFeature(self) -> Any:
46
42
  return 'This is the implementation of the extractFeature function from the derived class.'
@@ -48,9 +44,22 @@ class subDetector(detector):
48
44
  def vectorize(self) -> np.array:
49
45
  return 'This is the implementation of the vectorize function from the derived class.'
50
46
 
51
- def model(self) -> Any:
47
+ def model(self, training: bool = True) -> Any:
52
48
  return 'This is the implementation of the model function from the derived class.'
53
49
 
54
50
  def predict(self) -> np.array:
55
51
  return 'This is the implementation of the predict function from the derived class.'
56
- ```
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ The `malwareDetector` uses a configuration system that can be customized through a JSON file or command-line arguments. The default configuration file is `config.json` in the current directory, but you can specify a custom path when initializing the detector.
57
+
58
+ ### Key Configuration Classes:
59
+
60
+ - `Config`: Stores all external settings for the detector.
61
+ - `PathConfig`: Manages input and output file paths.
62
+ - `FolderConfig`: Handles folder configurations for data storage.
63
+ - `ModelConfig`: Stores model-specific parameters and hyperparameters.
64
+
65
+ For detailed information on configuration options and usage, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
@@ -39,11 +39,8 @@ class PathConfig(BaseModel, extra=Extra.allow):
39
39
 
40
40
  class ModelConfig(BaseModel, extra=Extra.allow):
41
41
  '''
42
- The `ModelConfig` class stores the
43
- hyperparameters of model for the detector,
44
- which are obtained from `parameter_parser()`.
45
- If no additional settings are provided,
46
- default values will be used.
42
+ The `ModelConfig` class is designed to store the
43
+ parameters and hyperparameters for the detector model.
47
44
 
48
45
  If you wish to create a customized parameter,
49
46
  there has two methods to do it.
@@ -51,15 +48,6 @@ class ModelConfig(BaseModel, extra=Extra.allow):
51
48
  method of the `ModelConfig` class.
52
49
  2. directly set the parameter in the `config.json` file.
53
50
  '''
54
- modelName: str = DEFAULT_MODEL_NAME
55
- dimensions: int = DEFAULT_DIMENSIONS
56
- workers: int = DEFAULT_WORKERS
57
- epochs: int = DEFAULT_EPOCHS
58
- min_count: int = DEFAULT_MIN_COUNT
59
- wl_iterations: int = DEFAULT_WL_ITERATIONS
60
- learning_rate: float = DEFAULT_LEARNING_RATE
61
- down_sampling: float = DEFAULT_DOWN_SAMPLING
62
-
63
51
  def set_param(self, __name: str, __value: Any):
64
52
  if hasattr(self, __name):
65
53
  raise AttributeError(f"Parameter {__name} already exists.")
@@ -192,62 +180,6 @@ def parameter_parser(config: Config) -> Config:
192
180
  default=DEFAULT_CONFIG_PATH,
193
181
  help="Configuration file path.")
194
182
 
195
- parser.add_argument("--dimensions",
196
- dest="dimensions",
197
- type=int,
198
- default=DEFAULT_DIMENSIONS,
199
- help="Number of dimensions. Default is 128."
200
- )
201
-
202
- parser.add_argument("--workers",
203
- dest="workers",
204
- type=int,
205
- default=DEFAULT_WORKERS,
206
- help="Number of workers. Default is 4."
207
- )
208
-
209
- parser.add_argument("--epochs",
210
- dest="epochs",
211
- type=int,
212
- default=DEFAULT_EPOCHS,
213
- help="Number of epochs. Default is 10."
214
- )
215
-
216
- parser.add_argument("--min-count",
217
- dest="min_count",
218
- type=int,
219
- default=DEFAULT_MIN_COUNT,
220
- help="Minimal structural feature count. Default is 5."
221
- )
222
-
223
- parser.add_argument("--wl-iterations",
224
- dest="wl_iterations",
225
- type=int,
226
- default=DEFAULT_WL_ITERATIONS,
227
- help="Number of Weisfeiler-Lehman iterations. Default is 2."
228
- )
229
-
230
- parser.add_argument("--learning-rate",
231
- dest="learning_rate",
232
- type=float,
233
- default=DEFAULT_LEARNING_RATE,
234
- help="Initial learning rate. Default is 0.025."
235
- )
236
-
237
- parser.add_argument("--down-sampling",
238
- dest="down_sampling",
239
- type=float,
240
- default=DEFAULT_DOWN_SAMPLING,
241
- help="Down sampling rate of features. Default is 0.0001."
242
- )
243
-
244
- parser.add_argument('--model','-m',
245
- dest="model",
246
- nargs='?',
247
- default=DEFAULT_MODEL_NAME,
248
- help='Select the model(KNN, LR, MLP, RF, SVM).'
249
- )
250
-
251
183
  parser.add_argument('--classify', '-f',
252
184
  dest="classify",
253
185
  action='store_true',
@@ -259,14 +191,6 @@ def parameter_parser(config: Config) -> Config:
259
191
  config.path.input = args.input_path
260
192
  config.path.output = args.output_path
261
193
  config.path.config = args.config_path
262
- config.model.dimensions = args.dimensions
263
- config.model.workers = args.workers
264
- config.model.epochs = args.epochs
265
- config.model.min_count = args.min_count
266
- config.model.wl_iterations = args.wl_iterations
267
- config.model.learning_rate = args.learning_rate
268
- config.model.down_sampling = args.down_sampling
269
- config.model.modelName = args.model
270
194
  config.classify = args.classify
271
195
 
272
196
  return config
@@ -0,0 +1,14 @@
1
+ '''
2
+ Save the variables of the system's default constants.
3
+ '''
4
+
5
+ DEFAULT_INPUT_PATH="./Dataset/program"
6
+ DEFAULT_OUT_PATH="./Predict/predict.json"
7
+ DEFAULT_CONFIG_PATH="./config.json"
8
+ DEFAULT_CLASSIFY=False
9
+
10
+ DATASET_DIR="./Dataset/"
11
+ FEATURE_DIR="./Feature/"
12
+ VECTORIZE_DIR="./Vectorize/"
13
+ MODEL_DIR="./Model/"
14
+ PREDICT_DIR="./Predict/"
@@ -1,15 +1,19 @@
1
1
  import os
2
2
  import numpy as np
3
+
3
4
  from typing import Any
4
5
  from .config import read_config
5
6
  from .utils import platform_info
7
+ from .const import DEFAULT_CONFIG_PATH
6
8
 
7
9
  class detector(object):
8
- def __init__(self) -> None:
10
+ def __init__(self, config_path=None) -> None:
9
11
  '''
10
12
  read config.json by `read_config` function in `config.py`
11
13
  '''
12
- self.config = read_config()
14
+ if config_path is None:
15
+ config_path = DEFAULT_CONFIG_PATH
16
+ self.config = read_config(config_path)
13
17
 
14
18
  def extractFeature(self) -> Any:
15
19
  '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malwareDetector
3
- Version: 0.1.12
3
+ Version: 0.1.13
4
4
  Summary: Malware detector specification for NTUST isLab
5
5
  Author: PO-LIN LAI
6
6
  Author-email: bolin8017@gmail.com
@@ -8,50 +8,48 @@ License: MIT
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENCE.txt
11
+ Requires-Dist: numpy
12
+ Requires-Dist: pydantic
11
13
 
12
- malwareDetector
13
- ===============
14
+ # malwareDetector
14
15
 
15
16
  * Source code: https://github.com/louiskyee/malwareDetector.git
16
17
  * Wiki: https://github.com/louiskyee/malwareDetector/wiki
17
18
  * PyPI: https://pypi.org/project/malwareDetector/
18
19
 
19
- Description
20
- -----------
20
+ ## Description
21
21
 
22
22
  This is a malware detector specification for NTUST isLab.
23
23
  The `malwareDetector` is a base class designed for malicious software detection. It enables straightforward utilization of Python's inheritance feature. By inheriting from `malwareDetector` and implementing the required functions, you can achieve your specific goals. Additionally, it offers convenient configuration management. For more detailed instructions, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
24
24
 
25
- Requirements
26
- ------------
27
- Tool | Version |Source |
28
- |---|---|---|
29
- | Python | `>= 3.10` | https://www.python.org/downloads |
25
+ ## Requirements
30
26
 
31
- Installation
32
- ------------
27
+ Tool | Version | Source
28
+ -----|---------|-------
29
+ Python | `>= 3.10` | https://www.python.org/downloads
30
+
31
+ ## Installation
33
32
 
34
33
  Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `malwareDetector`.
35
34
  * Example: `pip install malwareDetector`
36
35
 
37
- Usage
38
- -----
36
+ ## Usage
39
37
 
40
- ### import
41
- * import class `detector` from `malwareDetector.detector`
42
- ```python=
38
+ ### Import
39
+ * Import class `detector` from `malwareDetector.detector`
40
+ ```python
43
41
  from malwareDetector.detector import detector
44
42
  ```
45
43
 
46
- ### Examples:
47
- ```python=
48
- from malwareDetector.detector import detector
49
- from typing import Any
44
+ ### Example:
45
+ ```python
50
46
  import numpy as np
47
+ from typing import Any
48
+ from malwareDetector.detector import detector
51
49
 
52
50
  class subDetector(detector):
53
- def __init__(self) -> None:
54
- super().__init__()
51
+ def __init__(self, config_path=None) -> None:
52
+ super().__init__(config_path)
55
53
 
56
54
  def extractFeature(self) -> Any:
57
55
  return 'This is the implementation of the extractFeature function from the derived class.'
@@ -59,9 +57,22 @@ class subDetector(detector):
59
57
  def vectorize(self) -> np.array:
60
58
  return 'This is the implementation of the vectorize function from the derived class.'
61
59
 
62
- def model(self) -> Any:
60
+ def model(self, training: bool = True) -> Any:
63
61
  return 'This is the implementation of the model function from the derived class.'
64
62
 
65
63
  def predict(self) -> np.array:
66
64
  return 'This is the implementation of the predict function from the derived class.'
67
65
  ```
66
+
67
+ ## Configuration
68
+
69
+ The `malwareDetector` uses a configuration system that can be customized through a JSON file or command-line arguments. The default configuration file is `config.json` in the current directory, but you can specify a custom path when initializing the detector.
70
+
71
+ ### Key Configuration Classes:
72
+
73
+ - `Config`: Stores all external settings for the detector.
74
+ - `PathConfig`: Manages input and output file paths.
75
+ - `FolderConfig`: Handles folder configurations for data storage.
76
+ - `ModelConfig`: Stores model-specific parameters and hyperparameters.
77
+
78
+ For detailed information on configuration options and usage, please refer to the [GitHub Wiki](https://github.com/louiskyee/malwareDetector/wiki).
@@ -11,7 +11,7 @@ required_packages = [
11
11
  setup(
12
12
  name='malwareDetector',
13
13
  packages=find_packages(include=['malwareDetector']),
14
- version='0.1.12',
14
+ version='0.1.13',
15
15
  description='Malware detector specification for NTUST isLab',
16
16
  long_description=long_description,
17
17
  long_description_content_type="text/markdown",
@@ -1,22 +0,0 @@
1
- '''
2
- Save the variables of the system's default constants.
3
- '''
4
-
5
- DEFAULT_INPUT_PATH="./Dataset/malware"
6
- DEFAULT_OUT_PATH="./Feature/feature.csv"
7
- DEFAULT_CONFIG_PATH="./config.json"
8
- DEFAULT_MODEL_NAME="SVM"
9
- DEFAULT_DIMENSIONS=128
10
- DEFAULT_WORKERS=4
11
- DEFAULT_EPOCHS=50
12
- DEFAULT_MIN_COUNT=1
13
- DEFAULT_WL_ITERATIONS=2
14
- DEFAULT_LEARNING_RATE=0.025
15
- DEFAULT_DOWN_SAMPLING=0.0001
16
- DEFAULT_CLASSIFY=False
17
-
18
- DATASET_DIR="./Dataset/"
19
- FEATURE_DIR="./Feature/"
20
- VECTORIZE_DIR="./Vectorize/"
21
- MODEL_DIR="./Model/"
22
- PREDICT_DIR="./Predict/"