Human Emulator Studio has the ability to change a wide range of settings. All browser settings and other commands for managing the browser can be found in the documentation for the object – browser. This article will talk specifically about changing those settings that contain information about the browser.
Browser sizes.
The width and height of the browser are set using the commands set_width and set_height of the object browser.
php example:
1 2 3 4 5 6 7 8 |
// resize // randomly in the range from 300 to 1200 // width $browser->set_width(rand(300,1200)); // height $browser->set_height(rand(300,1200)); |
The scale of the browser.
You can set the browser scale using command set_zoom of the object browser.
php example:
1 2 3 4 |
// Set the scale to 400% $browser->set_zoom(400); |
Screen resolution and color depth.
Screen resolution and bit rate are set by one command of the object browser – set_screen_resolution. Defines navigator: (width, height, pixelDepth) and their duplicates (availWidth, availHeight, colorDepth).
php example:
1 2 3 4 |
// set screen resolution 1024x768 and 24 bits $browser->set_screen_resolution(1024,768, 24); |
Useragent string.
To set the Useragent string or the so-called browser identifier, the object browser command set_user_agent is used. Together with the browser identifier, you must fill in the following navigator parameters (window.navigator): appVersion, appName, appCodeName, language (s), platform, product, productsub.
php example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
// user-agent for chrome // Mozilla/5.0 ([Platform]) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[ChromeVer] Safari/537.36 // data to generate a random string user-agent // chrome versions // the contents of the file are as follows /* 78.0.3904.83 78.0.3904.84 78.0.3904.85 78.0.3904.86 78.0.3904.87 78.0.3904.88 78.0.3904.9 78.0.3904.90 */ // file must be in the script folder // you can download it in the topic on the forum $arr_chrome_versions = file('chrome_versions.txt'); // operating system // 6.1 Windows 7 // 6.2 Windows 8 // 6.3 Windows 8.1 // 10.0 Windows 10 $arr_winOS = array("6.1","6.2","6.3","10.0"); // platform $arr_pltf= array("Win32","Win64"); // we get randomly the version from the file $num = mt_rand(1,count($arr_chrome_versions)-1); $version=trim($arr_chrome_versions[$num]); // os $num = mt_rand(1,count($arr_winOS)-1); $winOS=$arr_winOS[$num]; // platform $pltf =array_rand($arr_pltf); // bit rate of running applications $pltf_app_bit =""; // navigator.cpuClass $cpuClass=""; if($pltf=="Win32") { $pltf_app_bit ="WOW64"; $cpuClass="x86"; } else { $pltf_app_bit ="Win64; x64"; $cpuClass="x64"; } // collect a random User agent string echo $user_agent_srting = "Mozilla/5.0 (Windows NT $winOS; $pltf_app_bit) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/$version Safari/537.36"; // set the string to the browser $browser->set_user_agent($user_agent_srting); // set navigaror.platform и navigator.cpuClass $browser->set_platform($pltf,$cpuClass); // must be completed and add. navigator properties: //appVersion, appName, appCodeName, language(s), platform, product, productsub, vendor, vendorSub // set the following parametersappName appCodeName appVersion product productSub vendor vendorSub // vendor и vendorSub can be set from version 7.0.42 $appMinorVersion = trim(str_replace("Mozilla/","",$user_agent_srting)); $browser->set_app_info("Netscape", "Mozilla", $appMinorVersion, "Gecko", "20030107","Google Inc.",""); // language $languages = "ru-RU,ru,en-US,en"; $arr_lang=explode(",",$languages); // sets the same parameters for navigator language, browserLanguage, systemLanguage, userLanguage // first from the list $browser->set_language($arr_lang[0]); // the entire list is set in accepts $browser->set_accept_language($languages); |
Information about the plugins.
Substitution of the list of plugins preinstalled in your browser is carried out using command set_plugins_info of the object browser.
Obtaining this information is included in the so-called browser fingerprints. Using this technology, the site owner can get your unique profile as a user and then determine all your subsequent visits and actions. We’ll talk about browser fingerprints in a separate article.
The list of plugins is given as a string:
«[{ name : ‘plugin name 1’, description : ‘plugin description 1’, filename : ‘plugin file 1’, version : ‘plugin version 1’ },
{ name : ‘plugin name 2’, description : ‘plugin description 2’, filename : ‘plugin file 2’, version : ‘plugin version 2’ },
{ name : ‘plugin name 3’, description : ‘plugin description 3’, filename : ‘plugin file 3’, version : ‘plugin version 3’ },
{ и т.д.}]»
From version 7.0.41, you can also specify a Mime list for plugins. Set as a string:
«[{type: ‘type’, suffixes: ‘suffixe’, description: ‘description’, __pluginName: ‘ plugin name 1′ },
{type: ‘type’, suffixes: ‘suffixe’, description: ‘description’, __pluginName: ‘ plugin name 2′ }
{type: ‘type’, suffixes: ‘suffixe’, description: ‘description’, __pluginName: ‘ plugin name 3′ }
{type: ‘type’, suffixes: ‘suffixe’, description: ‘description’, __pluginName: ‘ plugin name 3′ } ]»
php example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
// add information about 3 plugins /* Chromium PDF Plugin Portable Document Format Name: Chromium PDF Plugin Description: Portable Document Format Version: Location: internal-pdf-viewer Type: PPAPI (вне процесса) Types MIME: Type MIME Description File extensions application/x-google-chrome-pdf Portable Document Format ------------------------------------ Chromium PDF Viewer Name: Chromium PDF Viewer Version: Location: chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/ Type: Модуль браузера Types MIME: Type MIME Description File extensions application/pdf .pdf ------------------------------------ Adobe Flash Player - Версия: 31.0.0.153 Shockwave Flash 31.0 r0 Name: Shockwave Flash Description: Shockwave Flash 31.0 r0 System Version: 31.0.0.153 Location: C:\Windows\SysWOW64\Macromed\Flash\pepflashplayer32_31_0_0_153.dll Type: PPAPI (вне процесса) Types MIME: Type MIME Description File extensions application/x-shockwave-flash Shockwave Flash .swf application/futuresplash FutureSplash Player .spl */ // set navigaror.plugins $plugins=" [{ name: 'Chromium PDF Plugin', filename: 'internal-pdf-viewer', description: 'Portable Document Format' }, { name: 'Chromium PDF Viewer', filename: 'mhjfbmdgcfjbbpaeojofohoefgiehjai', description: '' }, { name: 'Adobe Flash Player', filename: 'pepflashplayer32_31_0_0_153.dll', description: 'Shockwave Flash 31.0 r0 System' , version : '31.0.0.153'}]"; $mimes_types="[{type: 'application/x-google-chrome-pdf', suffixes: 'pdf', description: 'Portable Document Format', enabledPlugin: Plugin, __pluginName: 'Chromium PDF Plugin' }, {type: 'application/pdf', suffixes: 'pdf', description: '', enabledPlugin: Plugin, __pluginName: 'Chromium PDF Viewer'}, {type: 'application/x-shockwave-flash',suffixes: 'swf',description: 'Shockwave Flash',__pluginName: 'Adobe Flash Player'}, {type: 'application/futuresplash',suffixes: 'spl',description: 'FutureSplash Player',__pluginName: 'Adobe Flash Player'}]"; // from version 7.0.41 you can set MIME types for plugins $browser->set_plugins_info($plugins,$mimes_types); // Let's go to the page for detecting the browser $browser->navigate("https://browserleaks.com/javascript"); $h3->set_focus_by_inner_text("Installed Plug-Ins", false); sleep(5); $btn->click_by_inner_text("iframe.contentWindow", false); sleep(5); |
You can view information on a real plug-in by installing them in the Chrome browser, and then through the Developer Tools (press F12) go to the console and there enter “navigator.plugins“. Information on the plugins appears as follows:
Hardware Information.
To set the parameters navigator hardwareConcurrency – the number of processors (threads) that are available to the browser and deviceMemory – the number of gigabytes of memory that are available to the browser using the object browser command set_hardware_info.
Also, from version 7.0.42, this command can also be used to set the devicePixelRatio parameter. DevicePixelRatio returns the ratio of resolution in physical pixels to resolution in CSS pixels for the current display device. This value can also be interpreted as the ratio of pixel sizes: the size of one CSS pixel to the size of one physical pixel. Simply put, this tells the browser how many actual pixels on the screen should be used to draw one pixel of CSS.
The parameter depends on the device: for ordinary displays it is 1, but there can be 2 and 1.5
php example:
1 2 3 4 |
// set the number of processors 2 and 4 GB of memory and the ratio of resolution 1 $browser->set_hardware_info(2,4,1); |
Do Not Track (DNT).
This is the proposed HTTP header field, designed to allow Internet users to opt out of web site tracking, which includes collecting data about user activity in several different contexts, as well as storing, using or sharing data received from this activity outside the context in which it occurred.
To set this flag, use the object browser command set_do_not_track.
php example:
1 2 3 4 |
// tell sites not to track our actions $browser->set_do_not_track(true); |
Touch screen.
You can set data about the used touch screen using the object browser command set_touch_info. The command changes the parameters of navigator.maxTouchPoints – the maximum number of simultaneous touch contacts and window.ontouchstart – whether touch events are enabled.
php example:
1 2 3 4 |
// Set the information about the screen sensor // 5 simultaneous touch contacts and enable the transmission of touch events $browser->set_touch_info(5,true); |