Tab Tab1 = instance.ActiveTab;
Random rndGenerator = new Random();
string strDate = DateTime.Now.ToString("dd.MM.yyyy hh.mm.ss");
string stTabURL = string.Empty;
project.Variables["dataNow"].Value = strDate;
instance.ClearCache(); //очищаю кэш
instance.ClearCookie(); //очищаю куки
instance.UseCSS = true;
instance.UseMedia = true;
instance.CanvasRenderMode = ZennoLab.InterfacesLibrary.Enums.Browser.CanvasMode.Emulate; //включаем эмуляцию канваса
instance.CanvasRenderSeed = Guid.NewGuid().ToString(); //генерируем новый Canvas Seed
instance.SetBrowserPreference("media.wmf.enabled", true);
int i=0;
string strRegisteredMail = string.Empty;
string strConfirmationCode = string.Empty;
string strRegistrationID = string.Empty;
string strSelectedAccount = string.Empty;
string strSetStatusResult = string.Empty;
string strGetResultHeaderBody = string.Empty;
string strCode = string.Empty;
string ProverkaNum = string.Empty;
string strServiseSite = string.Empty;
string strOperator = string.Empty;
string resultCode = string.Empty;
string strPhoneNumber = string.Empty;
string strMailResult = string.Empty;
string strTargetFolder = string.Empty;
string strBannerPhotoAkk = string.Empty;
var lstProxy = project.Lists["proxy"];
string strProxy = string.Empty;
int Rand = 0;
Random r = new Random();
//var lstUA = new List<string>();
//string[] arrUA = project.Variables["useragent"].Value.Split('\n');
//lstUA.AddRange(arrUA);
//Rand = r.Next(0,lstUA.Count);
//project.Profile.UserAgent = lstUA[Rand];
int ip = 0;
int ip1 = 0;
int ip2 = 0;
int ip3 = 0;
double dElevation = 0;
string proxys = string.Empty;
string strAPIResponse = string.Empty;
string strProxyList = "yes";
string strLogin = string.Empty;
string strPass = string.Empty;
string lat = string.Empty;
string Longitude = string.Empty;
string Latitude = string.Empty;
List<string> lstProxyTemp = new List<string>();
if (lstProxy.Count==0) {
instance.SetProxy("", false, true, true);
for (int b=0; b < 20; b++) {
strAPIResponse = ZennoPoster.HttpGet("https://browserleaks.com/ip", strProxy, "UTF-8", ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly, 30000);
if (strAPIResponse != string.Empty) break;
}
if (strAPIResponse == string.Empty) throw new Exception("Request is empty from browserleaks.com/ip");
lat = new Regex(@"(?<=""latlon"">).*?(?=</td>)").Match(strAPIResponse).Value;
strAPIResponse = new Regex(@"(?<=ISP</td><td>).*?(?=</td>)").Match(strAPIResponse).Value;
string[] arrlat = lat.Split(',');
Latitude = arrlat[0].Replace('.',',');
Longitude = arrlat[1].Replace('.',',');
ip = 192;
ip1 = 168;
ip2 = rndGenerator.Next(0,1);
ip3 = rndGenerator.Next(1,255);
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString();
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
} else {
Rand = rndGenerator.Next(0,lstProxy.Count);
strProxy = lstProxy[Rand];
lstProxy.RemoveAt(Rand);
lstProxy.Add(strProxy);
instance.SetProxy(strProxy, false, true, true);
for (int b=0; b < 20; b++) {
strAPIResponse = ZennoPoster.HttpGet("https://browserleaks.com/ip", strProxy, "UTF-8", ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly, 30000);
if (strAPIResponse != string.Empty) break;
}
if (strAPIResponse == string.Empty) throw new Exception("Request is empty from browserleaks.com/ip");
lat = new Regex(@"(?<=""latlon"">).*?(?=</td>)").Match(strAPIResponse).Value;
strAPIResponse = new Regex(@"(?<=ISP</td><td>).*?(?=</td>)").Match(strAPIResponse).Value;
string[] arrlat = lat.Split(',');
Latitude = arrlat[0].Replace('.',',');
Longitude = arrlat[1].Replace('.',',');
if (strAPIResponse.ToLower().Contains("megafon")) {
dElevation = r.Next(120,255);
ip = 192;
ip1 = 168;
ip2 = 43;
ip3 = 148;
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString();
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
if (strAPIResponse.ToLower().Contains("t2 mobile")) {
dElevation = r.Next(50,298);
ip = 192;
ip1 = 168;
ip2 = 43;
ip3 = 148;
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
if (strAPIResponse.ToLower().Contains("kyivstar")) {
dElevation = r.Next(10,40);
ip = 192;
ip1 = 168;
ip2 = rndGenerator.Next(0,100);
ip3 = rndGenerator.Next(1,255);
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"uk-UA,uk;"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
if (strAPIResponse.ToLower().Contains("mts ukraine")) {
dElevation = r.Next(55,80);
ip = 192;
ip1 = 168;
ip2 = rndGenerator.Next(0,100);
ip3 = rndGenerator.Next(1,255);
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"uk-UA,uk;"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
if (strAPIResponse.ToLower().Contains("beeline")) {
dElevation = r.Next(120,255);
ip = 192;
ip1 = 168;
ip2 = 43;
ip3 = 76;
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
if (strAPIResponse.ToLower().Contains("mts")) {
dElevation = r.Next(120,255);
ip = 192;
ip1 = 168;
ip2 = 43;
ip3 = 148;
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
} else {
dElevation = r.Next(120,255);
ip = 192;
ip1 = 168;
ip2 = rndGenerator.Next(0,100);
ip3 = rndGenerator.Next(1,255);
proxys = ip.ToString()+"."+ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString(); // Укажите здесь желаемый адрес, который Вы хотите подсунуть WebRTC вместо реального (локального).
string[] acceptLanguageSet = {
"ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4",
"ru-RU,ru;q=0.9,en;q=0.8",
"ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
};
string acceptLanguage = acceptLanguageSet[r.Next(0, acceptLanguageSet.Length)].ToString();
project.Profile.AcceptLanguage = acceptLanguage;
project.Profile.UserAgentBrowserLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
project.Profile.UserAgentLanguage = acceptLanguage.Substring(0, acceptLanguage.IndexOf(','));
goto ua;
}
}
ua:
instance.ClientRectWorkMode = ZennoLab.InterfacesLibrary.Enums.Browser.ClientRectMode.Emulate;
instance.AudioContextMode = ZennoLab.InterfacesLibrary.Enums.Browser.AudioMode.Emulate;
// Выбираем случайную версию Firefox
int random = 0;
int randomNumber = 0;
string version = string.Empty;
string build = string.Empty;
string build2 = string.Empty;
string winOC = string.Empty;
string platform = string.Empty;
string platformApp = string.Empty;
int Rnd = rndGenerator.Next(0,3);
version = Macros.TextProcessing.Spintax("{60|61|62}");
//Формируем набор buildID нашего Firefox (у каждой версии свой) [Идея хранения позаимствована у doc'a, за что ему большая благодарность!]
Dictionary <string, string> buildIDSet = new Dictionary <string, string>();
buildIDSet.Add("60", "20100101");
buildIDSet.Add("61", "20100101");
buildIDSet.Add("62", "20100101");
//
instance.ShowNavigatorField(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.BuildId);
// Устанавливаем BuildID
instance.SetHeader(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.BuildId, buildIDSet[version]);
// Формируем набор версий операционной системы Windows
// 6.0 Windows Vista
// 6.1 Windows 7
// 6.2 Windows 8
// 6.3 Windows 8.1
// 10.0 Windows 10
winOC = Macros.TextProcessing.Spintax("{6.0|6.1|6.2|6.3|10.0}");
platform = Macros.TextProcessing.Spintax("{Win32|Win64}");
//
// Определяем "битность" самого приложения
platformApp = string.Empty;
if(platform=="Win32"){
platformApp = Macros.TextProcessing.Spintax("{; WOW64|}");
} else {
platformApp = "; Win64; x64";
}
// Устанавливаем Useragent
project.Profile.UserAgent = string.Format("Mozilla/5.0 (Windows NT {0}{1}; rv:{2}.0) Gecko/20100101 Firefox/{2}.0", winOC, platformApp, version);
project.Profile.UserAgentAppVersion = "5.0 (Windows)";
project.Profile.UserAgentAppName = "Netscape";
project.Profile.UserAgentAppCodeName = "Mozilla";
project.Profile.UserAgentProduct = "Gecko";
project.Profile.UserAgentProductSub = "20100101";
// OC
project.Profile.UserAgentOsCpu = string.Format("Windows NT {0}{1}", winOC, platformApp);
project.Profile.UserAgentPlatform = platform;
// Формируем набор популярных десктопных разрешений [Идея хранения позаимствована у doc'a, за что ему большая благодарность!]
int [,] resolutionSet = {
{2880, 1800},
{2560, 1600},
{2560, 1440},
{1920, 1200},
{1920, 1080},
{1680, 1050},
{1600, 1200},
{1600, 900},
{1440, 900},
{1366, 768},
{1360, 768},
{1280, 1024},
{1280, 800},
{1280, 768},
{1152, 864},
{1080, 1920},
{1024, 768}
};
int resolution = rndGenerator.Next(resolutionSet.Length/2);
project.Profile.ScreenSizeWidth = resolutionSet[resolution, 0];
project.Profile.ScreenSizeHeight = resolutionSet[resolution, 1];
instance.SetWindowSize(project.Profile.ScreenSizeWidth, project.Profile.ScreenSizeHeight);
project.Profile.AvailScreenWidth = project.Profile.ScreenSizeWidth-17;
project.Profile.AvailScreenHeight = project.Profile.ScreenSizeHeight-40;
instance.SetScreenPreference("screen_color_depth", 24);
string cpu = Macros.TextProcessing.Spintax("{2|4|6|8}");
instance.ShowNavigatorField(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.HardwareConcurrency);
instance.SetHeader(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.HardwareConcurrency, cpu);
instance.SetBrowserPreference("dom.w3c_touch_events.enabled", 1); // Включаем сенсорные события
instance.ShowNavigatorField(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.MaxTouchPoints);
instance.SetHeader(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.MaxTouchPoints, "5"); // Устанавливаем 5 (например) максимальных одновременных касаний.
instance.SetBrowserPreference("dom.storage.enabled", false);
instance.SetBrowserPreference("dom.indexedDB.enabled", false);
instance.WebRTCWorkMode = ZennoLab.InterfacesLibrary.Enums.Browser.WebRTCMode.Emulate;
instance.SetWebRTCAdresses(proxys);
instance.ShowNavigatorField(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.DoNotTrack);
instance.SetHeader(ZennoLab.InterfacesLibrary.Enums.Browser.NavigatorField.DoNotTrack, "1"); // Включает Do Not Track
instance.SetBrowserPreference("webgl.disabled", true);
instance.SetBrowserPreference("webgl.enable-webgl2", false);
instance.SetBrowserPreference("webgl.disable-extensions", true);
instance.SetBrowserPreference("webgl.min_capability_mode", true);
instance.UseAdds = false;
instance.UsePlugins = false;
instance.AllowPopUp = false;
// Получаем список плагинов
var PluginList = instance.GetPlugins().ToList();
// По очерёдно в цикле скрываем все плагины
for (i=0; i < PluginList.Count; i++){
instance.HidePlugin(PluginList[i]);
}
int accuracyGeo = r.Next(0,300);
instance.SetProxy(strProxy,false,true,true);
double dLatitude = Convert.ToDouble(Latitude);
double dLongitude = Convert.ToDouble(Longitude);
double accuracy = r.Next(0,100);
double dElevationAccuracy = r.Next(0,100);
double Heading = r.Next(0,270);
double speed = r.Next(0,30);
instance.SetGeoposition(dLatitude,dLongitude,accuracy,dElevation,dElevationAccuracy,Heading,speed);
string response = String.Empty;
try {
for (int b=0; b<20; b++) {
response = ZennoPoster.HttpGet(@"http://api.sypexgeo.net/",strProxy,"UTF-8",
ZennoLab.InterfacesLibrary.Enums.Http.ResponceType.BodyOnly,30000);
if (response != string.Empty) break;
}
if (response == string.Empty) throw new Exception("");
} catch (Exception ex) {
return "Не загрузилось";
}
try {
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
dynamic usr = serializer.DeserializeObject(response);
instance.TimezoneWorkMode = ZennoLab.InterfacesLibrary.Enums.Browser.TimezoneMode.Emulate;
instance.SetTimezone(usr["region"]["utc"],0);
project.SendInfoToLog("установил таймзону новую");
} catch {
return "Не удалось получить таймзону от sypexgeo";
}