public void TestBasicUsage() { ReputationEngine rep = new ReputationEngine(); //cacheBaseDir will look something like "C:\\src\\SafebrowseCSharp\\SafeBrowsingCacheList", and should //point to the SafeBrowsingCacheList*.bin files included with this test. Initialize() will attempt to do that //automatically if it's not already set. rep.Initialize(Properties.Settings.Default.SafebrowseV2ApiKey, cacheBaseDir, 1800); Assert.AreEqual(SafebrowseV2.Reputation.None, rep.CheckUrl("http://google.com")); Assert.AreEqual(SafebrowseV2.Reputation.MalwareBlackList, rep.CheckUrl("http://gumblar.cn")); Assert.AreEqual(SafebrowseV2.Reputation.MalwareBlackList, rep.CheckUrl("http://goooogleadsence.biz/")); }
private static void GetFromGSB(object Uri) { /* Google Safe Browsing API에서 URL의 악성 여부를 탐지 * 이것역시 당연히 쓰레드로 작동 */ T2_Start = true; String Url = Convert.ToString(Uri); ReputationEngine REngine = new ReputationEngine(); String apiKey = "ABQIAAAAC3AZ2fUwo4XL0EHIKkwivBR2_kh7-74xyO468TODHKO2gknDXQ"; REngine.Initialize(apiKey); if (SafebrowseV2.Reputation.None == REngine.CheckUrl(Url)) { GSBScore = 0; } else { GSBScore = 50; } T2_Start = false; }