add beginnings to safe browsing integration
This commit is contained in:
parent
4506a0d460
commit
b74eca3d38
67 changed files with 100000 additions and 2 deletions
|
@ -4,11 +4,49 @@ using System.Windows.Forms;
|
|||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using EasyTabs;
|
||||
using Google.Apis.Safebrowsing.v4;
|
||||
using Google.Apis.Safebrowsing.v4.Data;
|
||||
using Google.Apis.Services;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace XeroBrowser
|
||||
{
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public static async Task<bool> IsUrlUnsafe(string url, string apiKey)
|
||||
{
|
||||
var safeBrowsingService = new SafebrowsingService(new BaseClientService.Initializer
|
||||
{
|
||||
ApiKey = "AIzaSyCQV - s52iNah - il6T5iFuqo6M_JzcLyaxs",
|
||||
ApplicationName = "XeroBrowser"
|
||||
});
|
||||
|
||||
var request = new GoogleSecuritySafebrowsingV4FindThreatMatchesRequest
|
||||
{
|
||||
Client = new GoogleSecuritySafebrowsingV4ClientInfo { ClientId = "XeroBrowser", ClientVersion = "1.0" },
|
||||
ThreatInfo = new GoogleSecuritySafebrowsingV4ThreatInfo
|
||||
{
|
||||
ThreatTypes = new List<string>
|
||||
{
|
||||
"MALWARE",
|
||||
"SOCIAL_ENGINEERING",
|
||||
"UNWANTED_SOFTWARE",
|
||||
"POTENTIALLY_HARMFUL_APPLICATION"
|
||||
},
|
||||
PlatformTypes = new List<string> { "ANY_PLATFORM" },
|
||||
ThreatEntryTypes = new List<string> { "URL" },
|
||||
ThreatEntries = new List<GoogleSecuritySafebrowsingV4ThreatEntry> { new GoogleSecuritySafebrowsingV4ThreatEntry { Url = url } }
|
||||
}
|
||||
};
|
||||
|
||||
var response = await safeBrowsingService.ThreatMatches.Find(request).ExecuteAsync();
|
||||
|
||||
return response != null && response.Matches != null && response.Matches.Count > 0;
|
||||
}
|
||||
|
||||
public static AppContainer Container;
|
||||
|
||||
private static TitleBarTabsApplicationContext _applicationContext;
|
||||
|
@ -26,6 +64,9 @@ namespace XeroBrowser
|
|||
settings.UserAgent = "Mozilla/5.0 (Windows NT 11.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 XeroBrowser/1.0.0";
|
||||
settings.CefCommandLineArgs.Add("enable-media-stream", "1");
|
||||
settings.CachePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\CEF";
|
||||
settings.CefCommandLineArgs.Add("safebrowsing-disable-download-protection", "0");
|
||||
settings.CefCommandLineArgs.Add("safebrowsing-disable-extension-blacklist", "0");
|
||||
settings.CefCommandLineArgs.Add("safebrowsing-disable-auto-update", "0");
|
||||
|
||||
Cef.Initialize(settings);
|
||||
|
||||
|
|
Reference in a new issue