How Does Your Search Query Transit to Search Engine 🔍
Tags: performance, theycoded, healthydebate
Published: 2020-12-26 20:35:53

This might be a spooky topic to write about, but I kept this topic in my drafts for a quite long, long, long time.

I don't want to pick up some movie examples that many of us have seen about the internet and privacy. Privacy is these days quite a hot topic not just regards to mainstream social media, but as well to some known leaks that went public.

>I have asked myself, after several tests and findings, do network itself can manipulate (even track) and modify search results of what we are looking for on our favorite search engine? 

*Disclaimer 1: In some parts of these topics, I'll just scratch the surface, to do not write in technical jargon as much.*

The first part of the article will cover the basic theory of how does keyword search and autosuggest works and gently touches privacy setup when you first time run your favorite search engine.

While the second part will be talking about the technical aspect of the internet network you are using.

This article and topic itself will be of most interest to those readers coming in with interest of SEO and internet network. The ideal reader will have experience with technical SEO and terminal commands.

##Search Engine "Magic"
You may wonder how the search engine is giving you ideas as you type your questions into the search input field. Search engine collect overall searches of search queries on a frequent basis then calculates similarity as homonyms and plurality to offer you then potential query suggestions you may then feel it is some sort of magic, in other words, he tries to whisper you what to type. Behind this magic, there is sophisticated calculation into what we are not going to dig in this article for now.

##Tracking and collecting
It's one of the many technical prove that search engines track and collect your search queries and store them for other internal processes then after. A number of queries are a trigger to calculate and to display more popular queries higher in the list of suggested queries and this same query count can correspond to the popularity of the query itself.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/q7wkf6viyn1q1821jk9f.png)

It depends on the search engine you are going to choose from, but mostly when you launch the browser for the first time and type your favorite search engine, you'll be notified about privacy options for search activity within products that certain search engine can cover. This privacy setting can vary and differs from search engine to search engine and do not always touch just cookies setup.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/x8ak879ewtsvslim4te0.png)

##A calculations to offer results
These queries the user insert into the input field of a search engine (A) then after input try to provide to the user result that corresponds to search query as the product in a product database to yield from (B) as shown on the picture below. 

> Product in the case of the search engine (Google, Bing, Duckduckgo, Baidu or other) is represented as search engine results page (list of websites) in case of e-shop search it can be a list of products (Amazon, eBay). A more descriptive process can be found in patent explanation number US10832310B2. 

In the case of search engines, this website search result page calculation is more likely to be sophisticated (is not explained in this patent mentioned above) than in the case of common e-shops nearby, you are using to buy from.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/n0vtbbig8anb0kooug5d.png)

##How Does Your Search Query Travel
Once the user realizes information input into the input field for searching via the device (A: mobile, tablet, laptop), then after this information is transmitted to (B) the one search server.

This search query is represented as a URL search string in the top part of your browser and travels to the search server. To see the path how does your "search query string travel" there is a command for that.

> There is a simple network diagnostic tool for showing how many different devices are between you (device you are requesting from) and target (destination server). 

It sending ping (ICMP - Internet control message protocol) displaying these devices - routers encountered represented as hops. There is command <code>traceroute</code> in Mac OSX system for your default [Terminal.app](https://en.wikipedia.org/wiki/Terminal_(macOS)) or <code>tracepath</code> (in IPv4 format) for other Linux based systems. To see this in form of IPv6 use <code>traceroute6</code> command. For windows it's <code>tracert</code> command. 

> This command can be helpful for a penetration tester when determining what devices are on a network, but it's true that this can be often blocked by routers in the network what make this trace highly inaccurate in many cases and just briefly informative.

```
traceroute
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/put8c61u8oaw04ii641z.png)

Command will show what does happen in reality when you look for something on your favourite search engine and you try to request search query on such a search engine.

In this example, there are six hops till you hit google server to provide your answer. There can be more hops as shown in the example and sometimes you can receive a response without identification represented as these three stars <code>* * *</code> as this tool is not super accurate.

So in reality, this command can return you in terminal something like this example hereunder that has been modified for publication purpose.

```
traceroute to your-search-engine (123.123.12.12), 64 hops max, 52 byte packets
 1  123.45.6.7 (123.45.6.7)  39.080 ms  36.643 ms  31.633 ms
 2  123.45.6.8 (123.45.6.8)  66.296 ms  31.786 ms  33.905 ms
 3  ab-cd-1.efgh2.ij6-klmno.pr456.net (123.12.0.1)  58.625 ms  51.051 ms  39.540 ms
 4  ab-cd-2.efgh3.ij7-klmno.pr456.net (123.12.0.1)  43.920 ms  51.837 ms  42.051 ms
 5  * * *
 6  ab-cd-4.efgh5.ij9-klmno.pr456.net (123.12.0.1)  57.162 ms  58.907 ms  64.653 ms
```

Would you like to know what these IPs,URLs or let's say devices are? Look for [Nmap tool](https://nmap.org/download.html#macosx) for example to download the latest install file regards to operation system you are running.

Then run <code>nmap -O -sV</code> to execute the basic Nmap scan report in your terminal. This command will run for remote operation system detection as <code>-O</code> part of code stays for and will try to determine the version of the service running on port as <code>-sV</code> part of code claim. Yes and don't forget it needs to be executed with <code>sudo</code> at beginning and IP address or URL you have found from <code>traceroute</code> output at the end. The whole command looks like this.

```
sudo nmap -O -sV IP-ADDRESS-OR-URL-YOU-WANT-CHECK
```

##Can Network's Routers Track Your Search?

*Disclaimer 2: I have included basic pieces of information on several commands. I have not extensively dug into penetration tests and their healthy or unhealthy variety of white or black hat techniques. I will be relying on just tiny speculation for these as well as my personal experiences with certain tests, programming language, knowledge and experience i'm deeper in.*

It really depends on how these routers are set up. In other words, it's a question of network setup and infrastructure of your ISP - Internet Service Provider (of your home internet service or internet service of your mobile provider, type of logs that these services capture) as well. And a really specific topic is your own home wifi router (its firmware) or device (mobile or laptop) with specific hardware, firmware or operation system you are running on that may realize their own routers visits (hops). 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9e20duvnp82ktc1m03uz.png)

To rephrase it all, your input, the search url string may travel from the device first somewhere that you don't even know, even your search intent may be secured in browser terminology.

**Do these devices (routers) may track search queries?** The answer will they might. 

> Same as search engine stores and process your search query input, these devices (based on their setup and maintainer privacy decision) may collect your search query strings, internet behaviour , without letting you know. 

**Do these devices (routers) influent search engine result order?** The answer will be positive with some specific condition. 
> It is one of the many other factors that influent the calculation of search results after you execute your search query but not the main one, but can have the manipulative influence to modify your search results order for sure.

> Good example, how to change path trough these devices to your search engine is to change your DNS setup or turn on VPN.

##Closin' of privacy topic
There can be a positive effort in search engine's data privacy towards users that can be not just limited by the ISP provider you are using but the local infrastructure you are plugged in. As your search may be "somehow" safe while you do your own personal research, you may look for artistic inspiration, or if some technical thing is already patented, browsing all that with HTTPS turned on in your favorite browser it may be collected and results of search engine modified by network setup even before you hit your favorite search engine to provide you an answer. 

> Maybe it can be that simple, that each search is our personal lowball. Maybe just try typing something really special into your search engine and then going out for a walk to see what'll happen. 

Sayin' hello and sending tribute to the author of [1984 book](https://en.wikipedia.org/wiki/Nineteen_Eighty-Four).