Home | History | Annotate | Download | only in safe_browsing
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 //
      5 // Utility functions to extract file features for malicious binary detection.
      6 // Each platform has its own implementation of this class.
      7 
      8 #ifndef CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
      9 #define CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
     10 
     11 #include "base/basictypes.h"
     12 #include "base/memory/ref_counted.h"
     13 
     14 namespace base {
     15 class FilePath;
     16 }
     17 
     18 namespace safe_browsing {
     19 class ClientDownloadRequest_ImageHeaders;
     20 class ClientDownloadRequest_SignatureInfo;
     21 
     22 class BinaryFeatureExtractor
     23     : public base::RefCountedThreadSafe<BinaryFeatureExtractor> {
     24  public:
     25   BinaryFeatureExtractor();
     26 
     27   // Fills in the DownloadRequest_SignatureInfo for the given file path.
     28   // This method may be called on any thread.
     29   virtual void CheckSignature(
     30       const base::FilePath& file_path,
     31       ClientDownloadRequest_SignatureInfo* signature_info);
     32 
     33   // Populates |image_headers| with the PE image headers of |file_path|.
     34   virtual void ExtractImageHeaders(
     35       const base::FilePath& file_path,
     36       ClientDownloadRequest_ImageHeaders* image_headers);
     37 
     38  protected:
     39   friend class base::RefCountedThreadSafe<BinaryFeatureExtractor>;
     40   virtual ~BinaryFeatureExtractor();
     41 
     42  private:
     43   DISALLOW_COPY_AND_ASSIGN(BinaryFeatureExtractor);
     44 };
     45 }  // namespace safe_browsing
     46 
     47 #endif  // CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
     48