diff options
| author | Julien Voisin | 2015-03-05 15:36:22 +0100 |
|---|---|---|
| committer | Julien Voisin | 2015-03-05 15:36:22 +0100 |
| commit | 6beeeebe3c43f0643e521139d3f8b1ff4a7f3059 (patch) | |
| tree | 72de2c9e6f8eb30b847da44213b8482f98691589 /modules/scanmodule.py | |
| parent | 1c917ed43a58e1c1c77ccd0815b6e95fbcca54ff (diff) | |
Yara is cooler than Python
Diffstat (limited to '')
| -rw-r--r-- | modules/scanmodule.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/modules/scanmodule.py b/modules/scanmodule.py deleted file mode 100644 index 6ace387..0000000 --- a/modules/scanmodule.py +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | import ConfigParser | ||
| 2 | import pickle | ||
| 3 | |||
| 4 | |||
| 5 | class ScanModule(object): | ||
| 6 | def __init__(self): | ||
| 7 | self.config = ConfigParser.ConfigParser() | ||
| 8 | self.config.read('modules.conf') | ||
| 9 | |||
| 10 | self.samples = dict() | ||
| 11 | |||
| 12 | try: | ||
| 13 | self.populate(self.config.get(self.name, 'samples')) | ||
| 14 | except ConfigParser.NoOptionError: | ||
| 15 | pass | ||
| 16 | |||
| 17 | try: | ||
| 18 | self.load(self.config.get(self.name, 'persistence')) | ||
| 19 | except ConfigParser.NoOptionError: | ||
| 20 | pass | ||
| 21 | |||
| 22 | def is_disable(self): | ||
| 23 | try: | ||
| 24 | return self.config.getboolean(self.name, 'disable') | ||
| 25 | except ConfigParser.NoOptionError: | ||
| 26 | return False | ||
| 27 | |||
| 28 | def evaluate(self, path): | ||
| 29 | ''' Return in percent, the probability that | ||
| 30 | the file is a malware | ||
| 31 | @param path File to evaluate | ||
| 32 | ''' | ||
| 33 | raise NotImplemented | ||
| 34 | |||
| 35 | def populate(self, path): | ||
| 36 | ''' Populate the module's internal database | ||
| 37 | with data from the given path | ||
| 38 | @param path Path to the data | ||
| 39 | ''' | ||
| 40 | raise NotImplemented | ||
| 41 | |||
| 42 | |||
| 43 | def load(self, path): | ||
| 44 | ''' Unpickle the given path, and updates the samples dict with it. | ||
| 45 | @param path Path to the dict to unpickle | ||
| 46 | ''' | ||
| 47 | with open(path, 'r') as f: | ||
| 48 | self.samples.update(pickle.load(f)) | ||
| 49 | |||
| 50 | def save(self, path): | ||
| 51 | ''' Save the database to the given file | ||
| 52 | @param path Path where to save the database | ||
| 53 | ''' | ||
| 54 | with open(path, 'w') as f: | ||
| 55 | pickle.dump(self.samples, f) | ||
| 56 | |||
