Contact us in messengers or by phone.

whatsapp telegram viber phone email
+79214188555

Monitoring user activity on the Internet. Ivan Glinkin.

Ivan Glinkin

Private access level
Joined
Sep 5, 2015
Messages
219
Reaction score
13
Points
18
Location
Nicaragua
Monitoring user activity on the Internet.

Relevance
Today it is difficult to imagine modern life without innovative technologies used to automate business processes, their remote management, and information exchange. This was made possible thanks to the active integration of the Internet in the daily life of a person. The capabilities of new technologies reduce the economic costs of the enterprise, minimize the time it takes to complete tasks, and also provide other additional benefits.

At the same time, the usability of new technologies is often neglected by security, which opens the way to user vulnerabilities. Analyzing the use of the Internet as the main element of the infrastructure of new technologies makes it possible to obtain a lot of information about the user. This becomes possible through the creation of special software, the use of which makes it possible, for example, in the corporate sphere to track the work activity of personnel.

In this regard, we propose, within the framework of this article, to consider, using real-life examples, methods and means of monitoring user activity on the network.


Methods and Tools

As an example, to control user activity on the network, consider the social network VKontakte. This resource offers us not only user data, but also a number of possibilities for processing them. Take advantage of these opportunities.

On the page Developers | VK (menu of the site “For Developers”) “VKontakte” offers users ample opportunities to integrate their services on their home page, application on the phone, makes it possible to build a business and even develop an online store.

To solve the problem within the framework of this article, one function will suffice - users.get [DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftn1"] [1] [/ DLMURL], which returns advanced user information. At the same time, only those data that are publicly available are returned: last name, first name, user ID (id), date of birth, link to photos, etc. [DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC- 06C5-445C-BEA3-B30CC4A4FE73 # _ftn2 "] [2] [/ DLMURL].

To control user activity within the users.get function, we will use the fields id (user identifier), first_name (first name), last_name (last name), photo_100 (url of a square photo of a user 100 pixels wide) and online (whether the user is currently on the site). The object of the study will choose the founder of the social network "VKontakte" Pavel Durov - Pavel durov . To call a function with the required fields for this user, we use a query of the form:
https://api.vk.com/method/users.get?user_ids=1&fields=id,first_name,last_name,photo_100,online


ee497d42ae06c0cb90bc83718cf7adc8.jpg
Program development
We choose PHP as the programming language - a scripting language for developing web applications. The program will request Paul's activity (being on the site) every minute, and record the information received in the database for further analysis. At the same time, one important feature should be noted: the user remains active for 15 minutes after leaving the site. Therefore, when processing the results and writing code, this circumstance must be taken into account.


The algorithm for constructing the future program is as follows:

1. We request VKontakte interesting information on the above algorithm;
$ vk_query = " https://api.vk.com/method/users.get?user_ids=1&fields=id , first_name, last_name, photo_100, online ";

2. Receive data from VKontakte and process it;
$ vk_info = file_get_contents ($ vk_query);
$ info_array = json_decode ($ vk_info, true);

3. We form the output data;
$ uid = $ info_array ["response"] [0] ["uid"]; $ first_name = $ info_array ["response"] [0] ["first_name"]; $ last_name = $ info_array ["response"] [0] ["last_name"]; $ photo = $ info_array ["response"] [0] ["photo_100"]; $ online_value = $ info_array ["response"] [0] ["online"]; if ($ online_value == 0) {$ online = "Offline";} else {$ online = "Online";}; if (isset ($ info_array ["response"] [0] ["online_mobile"])) {$ online_mobile = $ info_array ["response"] [0] ["online_mobile"]; if ($ online_mobile = 1) {$ online_type = "(Phone)";}} else {$ online_type = "(Computer)";} if ($ online == "Offline") {$ online_type = ""; }
4. We write data to the database
$ query = "INSERT INTO vk_stat (uid, first_name, last_name, photo, online, type, date, time) VALUES ($ uid, $ first_name, $ last_name, $ photo, $ online, $ online_type, date (dmY), date (H: i)) ";

5. We derive the result.
<div style="display:inline-block;">
<div style="display:inline-block"><img src="<?=$photo?>" style="border-radius:50px;"></div><div style="display:inline-block"><?php echo $first_name . " " . $last_name; ?>

Status: <?php echo $online . $online_type; ?></div></div>

6. Automate minute requests
header ('refresh: 60');

After executing the specified code, the program will give us one of the following results:

ae67e75a2f52e1a8b41319549bf2dc61.jpg


7967fd299ca578b1a87ed4dfc87af70f.jpg


af75509014ed090211bb2af81242d8b2.jpg



Processing the results

After starting the program and its work for several days, a sufficient amount of information will accumulate in the database. The general view of the database will be presented in the form of a table:

587c4b8b65a1d8586228105df9194d6c.jpg


The number of lines directly depends on the time of the program and at our settings it will be 1440 entries per day (1 line per minute).

With this information, you can start the analysis. The type of presentation of information can be selected in different ways, depending on the preferences of the database operator. In the framework of this article, we suggest considering 2 presentation options: a graph and a Gantt chart.

When analyzing information in the framework of "Graphics" we take the Cartesian coordinate system. On the "Y" axis, we distinguish 2 items: 0 - "Offline" and 1 - "Online"; on the axis “X” - date and time.

5d240f53a283cd8e0b25c22ca2923188.jpg


A more interesting, from our point of view, and visual analysis of user activity on the network is implemented using the Gantt chart.

41e98e55faa34baa9da97da22248f9a9.jpg


Under the conditions of control of one user, the Gantt chart is not much different from the graphical representation. However, all the power of this method will manifest itself when we expand the functions of our program.


Functionality Extension

Controlling a single user can hardly be convenient. In real time, it is necessary to control from 10 (small businesses) to 3000-5000 people (corporations, public associations, etc.)

The fulfillment of these requirements is feasible. So, in accordance with the documentation of VKontakte, the users.get function supports the ability to simultaneously receive information for up to 1000 users.

In order to obtain information about several persons, it is necessary to list user identifiers (uid) separated by commas. Thus, the request will look as follows (for example, 4 users):

https://api.vk.com/method/users.ge...lds=id,first_name,last_name,photo_100,online .

8458b2ba7853309282bf78fc899ff1d3.jpg


In order to control several users in automatic mode, it is necessary to modify the program code in two stages.

So, we find out the total number of users:

$ users_under_control = count ($ info_array ["response"]);

And we add an enumeration cycle together with the number of the array element to the end of the variables used:
for ($ i = 0; $ i <$ users_under_control; $ i ++)
{
$ uid [$ i] = $ info_array ["response"] [$ i] ["uid"];
$ first_name [$ i] = $ info_array ["response"] [$ i] ["first_name"];
...
}

As a result of the program, we get the following:

f8777e70502eb3769b0eb49212749c25.jpg



Practical significance

Consider the practical application of the created program.
For illustrative purposes, let's return to the Gantt chart and fill it with the activity of our users. Demonstrate what information can be extracted from the resulting graph.

bdff7d0aa198a416d280502c76e6ad2c.jpg


If we talk about the application of this program in the commercial sector, then, first of all, this is the identification of hidden relationships.

Please note that Pavel Durov and Nikolai Durov are online at the same time. At the same time, Nikolai is online only during the activity of Paul. If this trend continues for a long time, it can be confidently stated that Pavel and Nikolai not only know each other, but are on friendly terms, even if they are trying hard to hide it.

Also, corporate sector management can pay attention to reduced labor activity of employees and lack of involvement in the work process. Let us analyze the activity of Ilya Perekopsky. The graph shows that Ilya is online all day, which is not his main job. What Ilya does on VKontakte, we can only speculate. However, we are sure that Ilya is not engaged in work.

Another type of worker: Alexey Kobylyansky. During the day, Alexey is engaged in daily routine work, is not distracted on the Internet, and does not use company resources for personal purposes. However, it’s hard for Alexey to talk, he is uninitiated and does not show activity.
Let's analyze the diagram. Alexey is online for 8 hours and goes to bed at 3 a.m. Considering that at 6 a.m. he wakes up and is going to work, it takes him only 3 hours to sleep. Besides the corporate sector, there are other areas of life where monitoring the activity of users on the network can be useful:
  • Social sphere: is the child a participant in the deadly game “Blue Whale, Quiet House”, where children are forced to wake up at 4:20 in the morning and complete tasks.
  • Education: distraction on the Internet during lessons or lectures.
  • Army environment and other industries with state secrets: the fact of a user being online through mobile communications in categorized premises.
conclusions
Using specialized software, you can not only access your personal information, but also automate this process.

Methods and means of monitoring user activity are completely legal: open sources of information are used for the program to work. The possibilities used in this article are not exhaustive. But even the analysis of information, such as being on the network, can provide a sufficient amount of data in order to draw certain conclusions. It all depends on the goals and objectives. The main thing is not to be afraid to experiment and think outside the box.

[DLMURL="https://detective.marycream.ru/applewebdata https://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftnref1"] [1] [/ DLMURL] The method description is described in detail at users.get | Developers | VK

[DLMURL="https://detective.marycream.ru/applewebdata https://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftnref2"] [2] [/ DLMURL] All returned data and their description are disclosed at User | Developers | VK
 
Original message
Контроль активности пользователей в сети Интернет.

Актуальность
Сегодня трудно представить современную жизнь без инновационных технологий, используемых для автоматизации бизнес-процессов, их удаленного управления, обмена информацией. Это стало возможным благодаря активному интегрированию интернета в повседневную жизнедеятельность человека. Возможности новых технологий сокращают экономические затраты предприятия, минимизируют время исполнения задач, а также предоставляют другие дополнительные преимущества.

Вместе с тем, удобство использования новых технологий зачастую пренебрегается безопасностью, что открывает путь к уязвимостям пользователей. Анализируя использование Интернета, как главного элемента инфраструктуры новых технологий, дает возможность получить достаточно много информации о пользователе. Это становится возможным с помощью создания специального программного обеспечения, использование которого дает возможность, например, в корпоративной сфере проследить рабочую активность персонала.

В связи с этим, предлагаем в рамках настоящей статьи рассмотреть на реальных примерах методы и средства контроля активности пользователей в сети.


Методы и средства

В качестве примера, для контроля активности пользователя в сети рассмотрим социальную сеть «ВКонтакте». Данный ресурс предлагает нам не только данные пользователей, но также ряд возможностей по их обработке. Воспользуемся этими возможностями.

На странице Developers | VK (меню сайта «Разработчикам») «ВКонтакте» предлагает пользователям широкие возможности по интеграции их сервисов на домашнюю страничку, приложение на телефон, дает возможность построить бизнес и даже разработать интернет-магазин.

Для решения поставленной задачи в рамках данной статьи будет достаточно одной функции – users.get [DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftn1"][1][/DLMURL], которая возвращает расширенную информацию о пользователях. При этом, возвращаются только те данные, которые являются общедоступными: фамилия, имя, идентификатор пользователя (id), дата рождения, ссылка на фотографии и др [DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftn2"][2][/DLMURL].

Для контроля активности пользователя в рамках функции users.get будем использовать поля id (идентификатор пользователя), first_name (имя), last_name (фамилия), photo_100 (url квадратной фотографии пользователя шириной 100 пикселей) и online (находится ли пользователь сейчас на сайте). Объектом исследования выберем основателя социальной сети «ВКонтакте» Павла Дурова - Pavel Durov. Для вызова функции с нужными полями по данному пользователю используем запрос вида:
https://api.vk.com/method/users.get?user_ids=1&fields=id,first_name,last_name,photo_100,online


ee497d42ae06c0cb90bc83718cf7adc8.jpg
Разработка программы
В качестве языка программирования выберем PHP – скриптовой язык для разработки веб-приложений. Программа будет запрашивать активность (нахождение на сайте) Павла каждую минуту, и записывать полученные сведения в базу данных для дальнейшего анализа. При этом, следует обратить внимание на одну важную особенность: пользователь остается активным в течение 15 минут после выхода с сайта. Поэтому при обработке результатов и написания кода обязательно должно учитываться указанное обстоятельство.


Алгоритм построения будущей программы следующий:

1. Запрашиваем ВКонтакте интересующие сведения по вышеописанному алгоритму;
$vk_query = "https://api.vk.com/method/users.get?user_ids=1&fields=id, first_name,last_name,photo_100,online";

2. Получаем от ВКонтакте данные и обрабатываем их;
$vk_info = file_get_contents($vk_query);
$info_array = json_decode($vk_info, true);

3. Формируем выходные данные;
$uid = $info_array["response"][0]["uid"]; $first_name = $info_array["response"][0]["first_name"]; $last_name = $info_array["response"][0]["last_name"]; $photo = $info_array["response"][0]["photo_100"]; $online_value = $info_array["response"][0]["online"]; if ($online_value == 0) {$online = "Не в сети";} else {$online = "В сети";}; if (isset($info_array["response"][0]["online_mobile"])){$online_mobile = $info_array["response"][0]["online_mobile"]; if ($online_mobile = 1) {$online_type = " (Телефон)";} } else {$online_type = " (Компьютер)";} if ($online == "Не в сети") {$online_type = "";}
4. Записываем данные в базу данных
$query = "INSERT INTO vk_stat (uid, first_name, last_name, photo, online, type, date, time) VALUES ($uid, $first_name, $last_name, $photo, $online, $online_type, date(d.m.Y), date(H:i))";

5. Выводим результат.
<div style="display:inline-block;">
<div style="display:inline-block"><img src="<?=$photo?>" style="border-radius:50px;"></div><div style="display:inline-block"><?php echo $first_name . " " . $last_name; ?><br>
Статус: <?php echo $online . $online_type; ?></div></div>

6. Автоматизируем ежеминутные запросы
header('refresh: 60');

После исполнения указанного кода программа нам выдаст один из следующих результатов:

ae67e75a2f52e1a8b41319549bf2dc61.jpg


7967fd299ca578b1a87ed4dfc87af70f.jpg


af75509014ed090211bb2af81242d8b2.jpg



Обработка полученных результатов

После запуска программы и ее работы в течение нескольких суток, в базе данных накопится достаточное количество сведений. Общий вид базы будет представлен в виде таблицы:

587c4b8b65a1d8586228105df9194d6c.jpg


Количество строк напрямую зависит от времени работы программы и при наших настройках составит 1440 записей в сутки (1 строка в минуту).

Располагая указанной информацией, можно приступать к анализу. Вид представления сведений можно выбрать в разных вариантах, в зависимости от предпочтений оператора базы данных. В рамках настоящей статьи предлагаем рассмотреть 2 варианта представления: график и диаграмма Ганта.

При анализе сведений в рамках «Графика» возьмем Декартову систему координат. По оси «Y» разграничим 2 наименования: 0 - «Не в сети» и 1 - «В сети»; по оси «X» - дату и время.

5d240f53a283cd8e0b25c22ca2923188.jpg


Более интересный, с нашей точки зрения, и наглядный анализ активности пользователя в сети реализуется при помощи диаграммы Ганта.

41e98e55faa34baa9da97da22248f9a9.jpg


При условиях контроля одного пользователя диаграмма Ганта мало чем отличается от графического представления. Однако, вся сила указанного метода проявится, когда мы расширим функции нашей программы.


Расширение функционала

Контроль одного пользователя вряд ли может быть удобным. В условиях реального времени необходимо контролировать от 10 (субъекты малого предпринимательства) до 3000-5000 человек (корпорации, общественные объединения и т.д.)

Выполнение указанных требований реализуемо. Так, в соответствии с документацией ВКонтакте, функция users.get поддерживает возможность одномоментно получать информацию до 1000 пользователей.

Для того, чтобы получить информацию о нескольких лицах, необходимо идентификаторы пользователей (uid) перечислить через запятую. Таким образом, запрос будет выглядеть следующим образом (на примере 4 пользователей):

https://api.vk.com/method/users.get?user_ids=1,5,6,7&fields=id,first_name,last_name,photo_100,online.

8458b2ba7853309282bf78fc899ff1d3.jpg


Для того, чтобы осуществлять контроль нескольких пользователей в автоматическом режиме, необходимо программный код видоизменить в два этапа.

Так, узнаем общее количество пользователей:

$users_under_control = count($info_array["response"]);

И добавляем цикл перебора вместе с номером элемента массива в конец используемых переменных:
for ($i = 0; $i < $users_under_control; $i++)
{
$uid[$i] = $info_array["response"][$i]["uid"];
$first_name[$i] = $info_array["response"][$i]["first_name"];

}

В результате работы программы получим следующее:

f8777e70502eb3769b0eb49212749c25.jpg



Практическая значимость

Рассмотрим практическое применение созданной программы.
Для наглядности примеров, вернемся к диаграмме Ганта и заполним ее активностью наших пользователей. Продемонстрируем какую информацию можно извлечь из полученного графика.

bdff7d0aa198a416d280502c76e6ad2c.jpg


Если говорить о применении данной программы в коммерческом секторе, то, прежде всего, это выявление скрытых взаимосвязей.

Обратите внимание, Павел Дуров и Николай Дуров находятся в сети в одно и то же время. При этом, Николай находится в сети исключительно во время активности Павла. Если указанная тенденция продолжается в течение длительного времени, то можно с уверенностью утверждать, что Павел и Николай не только знают друг друга, но и находятся в дружеских отношениях, даже если они усиленно стараются это скрыть.

Также, руководство корпоративного сектора может обратить внимание на пониженную трудовую активность работников и не вовлеченность в рабочий процесс. Проанализируем активность Ильи Перекопского. Из графика видно, что Илья в течение всего трудового дня находится в сети, что не является его основной работой. Чем Илья занимается в сети ВКонтакте, можем только предполагать. Однако, мы точно уверены, что Илья не занимается работой.

Другой тип работников: Алексей Кобылянский. В течение дня Алексей занимается повседневной рутинной работой, на интернет не отвлекается и ресурсами компании в личных целях не пользуется. Однако, Алексея тяжело разговорить, он безынициативный и активности не проявляет.
Проанализируем диаграмму. Алексей находится в сети в течение 8 часов и ложится спать в 3 часа ночи. С учетом того, что в 6 утра он просыпается и собирается на работу, на сон у него уходит всего 3 часа.Кроме корпоративного сектора, есть и другие сферы жизнедеятельности, где контроль активность пользователей в сети может быть полезным:
  • Социальная сфера: является ли ребенок участником смертельной игры «Синий кит, Тихий Дом», где детей заставляют просыпаться в 4:20 утра и выполнять задания.
  • Образование: отвлеченность на Интернет во время уроков или лекций.
  • Армейская среда и другие отрасли с государственной тайной: сам факт нахождения пользователя в сети через средства мобильной связи в категорируемых помещениях.
Выводы
С использованием специализированного программного обеспечения можно не только получить доступ к личным сведениям, но и автоматизировать данный процесс.

Методы и средства контроля активности пользователей являются совершенно легальными: для работы программы используются открытые источники информации. Используемые в настоящей статье возможности не являются исчерпывающими. Но даже анализ информации, как нахождение в сети, может предоставить достаточное количество данных для того, чтобы сделать определенные выводы. Все зависит от поставленных целей и решаемых задач. Главное – не бояться экспериментировать и нестандартно мыслить.

[DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftnref1"][1][/DLMURL] Описание метода подробно раскрыто по адресу users.get | Developers | VK

[DLMURL="https://detective.marycream.ru/applewebdata://72C7CFCC-06C5-445C-BEA3-B30CC4A4FE73#_ftnref2"][2][/DLMURL] Все возвращаемые данные и их описание раскрыто по адресу User | Developers | VK