Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/safe_browsing/binary_feature_extractor.h

Issue 1015363003: Move BinaryFeatureExtractor and PEImageReader to common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@zip2
Patch Set: sync to position 321353 Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/binary_feature_extractor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_Digests;
20 class ClientDownloadRequest_ImageHeaders;
21 class ClientDownloadRequest_SignatureInfo;
22
23 class BinaryFeatureExtractor
24 : public base::RefCountedThreadSafe<BinaryFeatureExtractor> {
25 public:
26 // The type and defined values for a bitfield that controls aspects of image
27 // header extraction.
28 typedef uint32_t ExtractHeadersOption;
29 static const ExtractHeadersOption kDefaultOptions = 0;
30 static const ExtractHeadersOption kOmitExports = 1U << 0;
31
32 BinaryFeatureExtractor();
33
34 // Fills in the DownloadRequest_SignatureInfo for the given file path.
35 // This method may be called on any thread.
36 virtual void CheckSignature(
37 const base::FilePath& file_path,
38 ClientDownloadRequest_SignatureInfo* signature_info);
39
40 // Populates |image_headers| with the PE image headers of |file_path|.
41 // |options| is a bitfield controlling aspects of extraction. Returns true if
42 // |image_headers| is populated with any information.
43 virtual bool ExtractImageHeaders(
44 const base::FilePath& file_path,
45 ExtractHeadersOption options,
46 ClientDownloadRequest_ImageHeaders* image_headers);
47
48 // Populates |digests.sha256| with the SHA256 digest of |file_path|.
49 virtual void ExtractDigest(const base::FilePath& file_path,
50 ClientDownloadRequest_Digests* digests);
51
52 protected:
53 friend class base::RefCountedThreadSafe<BinaryFeatureExtractor>;
54 virtual ~BinaryFeatureExtractor();
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(BinaryFeatureExtractor);
58 };
59 } // namespace safe_browsing
60
61 #endif // CHROME_BROWSER_SAFE_BROWSING_BINARY_FEATURE_EXTRACTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/binary_feature_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698