I am currently working on a script that makes use of the VirusTotal API.
My question is different from the one that was marked as duplicate, because I would like to know in which port my request goes, and since I need to use a specific URL, I cannot use nmap (it only accepts domain names).
It involves a certain level of automation, so I would like to test if there is a connection between my computer and the endpoint before submitting something to check. For example, to get the latest report on a certain URL, I would use the https://www.virustotal.com/vtapi/v2/url/report endpoint, with requests.get() method from the requests module.
Now I have come across an elegant solution for this in https://stackoverflow.com/a/40283805/12143140.
I would need to know which port number this request goes to, in order to perform the check as in the answer above. I think I would have to use something like socket.create_connection(("virustotal.com", 587)).
But I am not sure about the 587. I found it using nmap www.virustotal.com, and among others it returned
PORT STATE SERVICE
587/tcp open submission
Then I tried nmap virustotal.com -p 587 which returned
PORT STATE SERVICE
587/tcp filtered submission
(normally nmap virustotal.com without specifying a port number only returns ports 80 & 443)
I believe 587 is the correct port since it says submission. However I am extremely familiar with networks and protocols.
So, any ideas on how to find the proper port I need to "ping" (ask for a connection)? And also in my command, should I use ("virustotal.com", 587) or ("www.virustotal.com", 587)?