| 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 // Utilities for the SafeBrowsing code. | 5 // Utilities for the SafeBrowsing code. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 7 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
| 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 8 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
| 9 | 9 |
| 10 #include <cstring> | 10 #include <cstring> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // The URL is being used for phishing. | 136 // The URL is being used for phishing. |
| 137 SB_THREAT_TYPE_URL_PHISHING, | 137 SB_THREAT_TYPE_URL_PHISHING, |
| 138 | 138 |
| 139 // The URL hosts malware. | 139 // The URL hosts malware. |
| 140 SB_THREAT_TYPE_URL_MALWARE, | 140 SB_THREAT_TYPE_URL_MALWARE, |
| 141 | 141 |
| 142 // The download URL is malware. | 142 // The download URL is malware. |
| 143 SB_THREAT_TYPE_BINARY_MALWARE_URL, | 143 SB_THREAT_TYPE_BINARY_MALWARE_URL, |
| 144 | 144 |
| 145 // The hash of the download contents is malware. | |
| 146 SB_THREAT_TYPE_BINARY_MALWARE_HASH, | |
| 147 | |
| 148 // Url detected by the client-side phishing model. Note that unlike the | 145 // Url detected by the client-side phishing model. Note that unlike the |
| 149 // above values, this does not correspond to a downloaded list. | 146 // above values, this does not correspond to a downloaded list. |
| 150 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL, | 147 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL, |
| 151 | 148 |
| 152 // The Chrome extension or app (given by its ID) is malware. | 149 // The Chrome extension or app (given by its ID) is malware. |
| 153 SB_THREAT_TYPE_EXTENSION, | 150 SB_THREAT_TYPE_EXTENSION, |
| 154 | 151 |
| 155 // Url detected by the client-side malware IP list. This IP list is part | 152 // Url detected by the client-side malware IP list. This IP list is part |
| 156 // of the client side detection model. | 153 // of the client side detection model. |
| 157 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL, | 154 SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 }; | 278 }; |
| 282 | 279 |
| 283 | 280 |
| 284 // Utility functions ----------------------------------------------------------- | 281 // Utility functions ----------------------------------------------------------- |
| 285 | 282 |
| 286 namespace safe_browsing_util { | 283 namespace safe_browsing_util { |
| 287 | 284 |
| 288 // SafeBrowsing list names. | 285 // SafeBrowsing list names. |
| 289 extern const char kMalwareList[]; | 286 extern const char kMalwareList[]; |
| 290 extern const char kPhishingList[]; | 287 extern const char kPhishingList[]; |
| 291 // Binary Download list names. | 288 // Binary Download list name. |
| 292 extern const char kBinUrlList[]; | 289 extern const char kBinUrlList[]; |
| 293 extern const char kBinHashList[]; | |
| 294 // SafeBrowsing client-side detection whitelist list name. | 290 // SafeBrowsing client-side detection whitelist list name. |
| 295 extern const char kCsdWhiteList[]; | 291 extern const char kCsdWhiteList[]; |
| 296 // SafeBrowsing download whitelist list name. | 292 // SafeBrowsing download whitelist list name. |
| 297 extern const char kDownloadWhiteList[]; | 293 extern const char kDownloadWhiteList[]; |
| 298 // SafeBrowsing extension list name. | 294 // SafeBrowsing extension list name. |
| 299 extern const char kExtensionBlacklist[]; | 295 extern const char kExtensionBlacklist[]; |
| 300 // SafeBrowsing side-effect free whitelist name. | 296 // SafeBrowsing side-effect free whitelist name. |
| 301 extern const char kSideEffectFreeWhitelist[]; | 297 extern const char kSideEffectFreeWhitelist[]; |
| 302 // SafeBrowsing csd malware IP blacklist name. | 298 // SafeBrowsing csd malware IP blacklist name. |
| 303 extern const char kIPBlacklist[]; | 299 extern const char kIPBlacklist[]; |
| 304 | 300 |
| 305 // This array must contain all Safe Browsing lists. | 301 // This array must contain all Safe Browsing lists. |
| 306 extern const char* kAllLists[10]; | 302 extern const char* kAllLists[8]; |
| 307 | 303 |
| 308 enum ListType { | 304 enum ListType { |
| 309 INVALID = -1, | 305 INVALID = -1, |
| 310 MALWARE = 0, | 306 MALWARE = 0, |
| 311 PHISH = 1, | 307 PHISH = 1, |
| 312 BINURL = 2, | 308 BINURL = 2, |
| 313 BINHASH = 3, | 309 // Obsolete BINHASH = 3, |
| 314 CSDWHITELIST = 4, | 310 CSDWHITELIST = 4, |
| 315 // SafeBrowsing lists are stored in pairs. Keep ListType 5 | 311 // SafeBrowsing lists are stored in pairs. Keep ListType 5 |
| 316 // available for a potential second list that we would store in the | 312 // available for a potential second list that we would store in the |
| 317 // csd-whitelist store file. | 313 // csd-whitelist store file. |
| 318 DOWNLOADWHITELIST = 6, | 314 DOWNLOADWHITELIST = 6, |
| 319 // See above comment. Leave 7 available. | 315 // See above comment. Leave 7 available. |
| 320 EXTENSIONBLACKLIST = 8, | 316 EXTENSIONBLACKLIST = 8, |
| 321 // See above comment. Leave 9 available. | 317 // See above comment. Leave 9 available. |
| 322 SIDEEFFECTFREEWHITELIST = 10, | 318 SIDEEFFECTFREEWHITELIST = 10, |
| 323 // See above comment. Leave 11 available. | 319 // See above comment. Leave 11 available. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 353 | 349 |
| 354 // Given a URL, compare all the possible host + path full hashes to the set of | 350 // Given a URL, compare all the possible host + path full hashes to the set of |
| 355 // provided full hashes. Returns the index of the match if one is found, or -1 | 351 // provided full hashes. Returns the index of the match if one is found, or -1 |
| 356 // otherwise. | 352 // otherwise. |
| 357 int GetUrlHashIndex(const GURL& url, | 353 int GetUrlHashIndex(const GURL& url, |
| 358 const std::vector<SBFullHashResult>& full_hashes); | 354 const std::vector<SBFullHashResult>& full_hashes); |
| 359 | 355 |
| 360 bool IsPhishingList(const std::string& list_name); | 356 bool IsPhishingList(const std::string& list_name); |
| 361 bool IsMalwareList(const std::string& list_name); | 357 bool IsMalwareList(const std::string& list_name); |
| 362 bool IsBadbinurlList(const std::string& list_name); | 358 bool IsBadbinurlList(const std::string& list_name); |
| 363 bool IsBadbinhashList(const std::string& list_name); | |
| 364 bool IsExtensionList(const std::string& list_name); | 359 bool IsExtensionList(const std::string& list_name); |
| 365 | 360 |
| 366 GURL GeneratePhishingReportUrl(const std::string& report_page, | 361 GURL GeneratePhishingReportUrl(const std::string& report_page, |
| 367 const std::string& url_to_report, | 362 const std::string& url_to_report, |
| 368 bool is_client_side_detection); | 363 bool is_client_side_detection); |
| 369 | 364 |
| 370 SBFullHash StringToSBFullHash(const std::string& hash_in); | 365 SBFullHash StringToSBFullHash(const std::string& hash_in); |
| 371 std::string SBFullHashToString(const SBFullHash& hash_out); | 366 std::string SBFullHashToString(const SBFullHash& hash_out); |
| 372 | 367 |
| 373 } // namespace safe_browsing_util | 368 } // namespace safe_browsing_util |
| 374 | 369 |
| 375 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ | 370 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_UTIL_H_ |
| OLD | NEW |