OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/safe_browsing/zip_analyzer.h" | 5 #include "chrome/common/safe_browsing/zip_analyzer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/common/safe_browsing/binary_feature_extractor.h" | 9 #include "chrome/common/safe_browsing/binary_feature_extractor.h" |
10 #include "chrome/common/safe_browsing/csd.pb.h" | 10 #include "chrome/common/safe_browsing/csd.pb.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 bool advanced = true; | 93 bool advanced = true; |
94 for (; reader.HasMore(); advanced = reader.AdvanceToNextEntry()) { | 94 for (; reader.HasMore(); advanced = reader.AdvanceToNextEntry()) { |
95 if (!advanced) { | 95 if (!advanced) { |
96 DVLOG(1) << "Could not advance to next entry, aborting zip scan."; | 96 DVLOG(1) << "Could not advance to next entry, aborting zip scan."; |
97 return; | 97 return; |
98 } | 98 } |
99 if (!reader.OpenCurrentEntryInZip()) { | 99 if (!reader.OpenCurrentEntryInZip()) { |
100 DVLOG(1) << "Failed to open current entry in zip file"; | 100 DVLOG(1) << "Failed to open current entry in zip file"; |
101 continue; | 101 continue; |
102 } | 102 } |
103 if (reader.current_entry_info()->is_unsafe()) { | |
104 DVLOG(1) << "Found unsafe entry in zip file."; | |
105 results->has_unsafe_file = true; | |
106 continue; | |
107 } | |
103 const base::FilePath& file = reader.current_entry_info()->file_path(); | 108 const base::FilePath& file = reader.current_entry_info()->file_path(); |
grt (UTC plus 2)
2015/03/23 20:11:55
It seems to me that this file_path() member should
mattm
2015/03/23 23:04:13
Hm, not sure this is necessary. I assume invalid c
grt (UTC plus 2)
2015/03/24 18:55:23
The motivation for this is that the file_basename
| |
104 if (download_protection_util::IsBinaryFile(file)) { | 109 if (download_protection_util::IsBinaryFile(file)) { |
105 // Don't consider an archived archive to be executable, but record | 110 // Don't consider an archived archive to be executable, but record |
106 // a histogram. | 111 // a histogram. |
107 if (download_protection_util::IsArchiveFile(file)) { | 112 if (download_protection_util::IsArchiveFile(file)) { |
108 results->has_archive = true; | 113 results->has_archive = true; |
109 } else { | 114 } else { |
110 DVLOG(2) << "Downloaded a zipped executable: " << file.value(); | 115 DVLOG(2) << "Downloaded a zipped executable: " << file.value(); |
111 results->has_executable = true; | 116 results->has_executable = true; |
112 AnalyzeContainedFile(binary_feature_extractor, file, &reader, | 117 AnalyzeContainedFile(binary_feature_extractor, file, &reader, |
113 &temp_file, results->archived_binary.Add()); | 118 &temp_file, results->archived_binary.Add()); |
114 } | 119 } |
115 } else { | 120 } else { |
116 DVLOG(3) << "Ignoring non-binary file: " << file.value(); | 121 DVLOG(3) << "Ignoring non-binary file: " << file.value(); |
117 } | 122 } |
118 } | 123 } |
119 results->success = true; | 124 results->success = true; |
120 } | 125 } |
121 | 126 |
122 } // namespace zip_analyzer | 127 } // namespace zip_analyzer |
123 } // namespace safe_browsing | 128 } // namespace safe_browsing |
OLD | NEW |