What does this steam-desktop shortcut URL steam:// mean - url

How do steam-desktop shortcuts steam:// actually work?
The URL / target of them is something like: "steam://rungameid/717"
I know similar things like "ftp://mynetworkadress:1337/subfoldercontainsgoodstuff" or for sure "http://".
But why and how does this steam thing work, can you do something similar on your own (e.g. "niceapp://launchprocess/param") and if so, why would you?

steam:// is the Steam browser protocol, i.e. a proprietary URL handler.
The official documentation is at Valve Software.
An article by PCWorld on the Steam URL protocol and potential security threats can be found here:
When the Steam client is installed on a system, it registers itself as a steam:// URL protocol handler. This means that every time a user clicks on a steam:// URL in a browser or a different application, the URL is passed to the Steam client for execution.

But why and how does this steam thing work, can you do something similar on your own
Yes. You can implement anything on your own.
The URI format is basically:
<protocol>:<arguments>
Some protocols such as http and ftp accept URL as argument. However the argument for any arbitrary protocol does not have to be a URL. For example, the magnet: protocol used by Bittorrent does not use a URL instead it describes the torrent and the torrent hash.
As you have experienced, browsers support some protocols built in. This includes http and ftp as well as custom protocols such as about:config in Firefox and chrome://settings in Google Chrome to display the settings page.
If a browser encounters a protocol that it does not understand it will ask you what program you want to open the link with. It will then tell the OS to run that program and pass the argument as a command-line argument to that program. This is how you can get the browser to open steam: link in Steam or a magnet: link in a torrent client.
It used to be that you can type any protocol in the browser's URL bar and trigger this behavior. However, modern browsers also use the same input as a search bar so typing in protocol:argument manually these days will more likely trigger a Google search. But links still work as they used to.

Related

URI launching a program from site and getting information from link

I have searched here for answers but I only seen few links to Microsoft c++ codes but none for Delphi so just wondering if anyone has a working Delphi example on how to launch programs from URI and get data from it to maybe connect to a socket or load a resource within my program?
Thanks
am basically looking for away to launch my program from a web address URI c++ code am none the wiser what to post as I can not understand that to save my life
and am sorry about not being more clear but I do find spelling things little hard and putting across what I would like I like to use voice mostly ha
You must register URI scheme for your application. For example, you may create "myapp" scheme. After this, if you open url like "myapp:do_something&close" Windows will launch your application with single parameter equal to URL.
"C:\program file\Soft\MyApplication.exe" "myapp:do_something&close"
In your application, you can read first parameter (ParamStr(1)), parse it and decide what to do.
"do_something&close" in my example, may be any kind of data. But if you want to open your application from web site, you may use HTTP URL format, like "myapp:\cleandisk?drive=C&askuser=yes"
See more info what you must write into Windows Registry in order to register your own URI scheme.

How can http:// be changed to abc:// and can wireshark capture this traffic?

I've seen this before, but never knew how it is accomplished.
What is the http for? Does it direct my request? Is this related to MIME Types? How is it like saying ftp:// ?
http:// ftp:// file:// etc. are some of many URI Schemes
You're not mentioning any specific application so it's hard to answer your questions. Basicaly the URI scheme tells the application that handles to URI what is the URI for and what protocol should be used.
For example the web browsers support many protocols including HTTP, FTP, direct local file access etc. You can tell your browser to open file://path/to/local/file.html and it'll access the file from disk. You can also tell it to open ftp://server/path/to/file.html and it'll load the file from FTP server.
It's allowed to have any scheme you like in your application. For example a lot of mobile applications handle their URI schemes like fb:// for facebook or instagram:// for instagram.
Wireshark can capture any network traffic regardless of the URI scheme used. It works on low network layer and can capture even 'raw' wifi or ethernet traffic (that's huge simplification - please refer to the course mentioned in my profile bio)

Monitor the Custom Url Protocol Messages - Delphi

As you know the custom url protocol is a feature that allow us to make a communication between a web page and our application. For example, Y! Messenger uses this protocol when you want to send a pm to another person through a web page:
Click to send pm
Now, the question is how can I monitor(hook) all custom url protocol messages in the windows? Is it possible to catch them?
Iterate over the contents of the registry, looking for registered custom protocols. Those will be children of the HKey_Classes_Root key that have a value named URL Protocol. Each time you find one, record the default value of the shell\open\command key, and then replace it with a command line pointing to your program.
When your program is invoked, do whatever you need to do, and then invoke the original program using the command line you recorded earlier.
You can register your own protocol: Can Delphi be used to create and handle a custom protocol handler? Just add few keys in user's registry (protocol name and application to launch). It is similar to register file extension. Simple example is here.
I'm not sure that you can catch every request. Antivirus programs can do that, but at driver-level.
You might want to take a look at Fiddler HTTP Web Debugger, which intercepts all HTTP traffic by being a temporary proxy.
It is not written in Delphi, but should give you a good idea on how to approach your problem.

How can I detect when user browses certain url?

I'm writing an application, which becomes "useful" once user is browsing certain url.
I want to add feature to my application, that it will be automatically launched once user browses this url, I was thinking of writing some sort of watchdog to trigger it.
My question is, whether there is a generic way to get notified when user browses to urls, I want to support at least IE and FireFox, chrome and safari is nice to have.
I read about DDE and WWW_RegisterURLEcho, but from what I understand it's not supported by FireFox, and also little sample I wrote didn't work with IE as well.
Thank you in advance
some more questions **
Do Url Monikers and Asynchronous Pluggable Protocols help me here ? Is it supported by FireFox ?
If you have control over the website, you could have it write a cookie to the computer. Then have your application monitor for that cookie.
You can implement this in many ways and at many different layers.
At the highest level, you could implement a browser plugin. There is no cross-browser solution at this layer that will let you write the code once and work for every browser. On the easy end of the spectrum, Firefox, you could implement it entirely as a Javascript + XUL plugin and use built-in XPCom interfaces (nsIProcess) for launching your helper process. For IE you would need to write a COM, C++ and win32 BHO that handles DWebBrowserEvents2::BeforeNavigate2. This is the hardest thing to do. There are mechanisms for Safari, Chrome and other webbrowsers that you could use to achieve this same behavior, with varying degrees of difficulty.
At the next level you could implement an HTTP proxy, similar to Fiddler2, that redirects all HTTP traffic through your local proxy first. Each browser has a different way of configuring its proxy settings, but they're all basically registry settings or config files.
At the most basic level you could just snif all IP traffic going out of the machine, similar to the way Wireshark does it, and just look for http requests to your URL. This is probably more difficult to code, but would work for all browsers without any special per-browser configuration stuff going on. You may need to write a driver. I dunno, I've never done work at this level in the stack.

Is there a replacement for browser plugin(maybe a driver?)?

The reason I don't want to go the browser plugin way is that you need to implement it for various browsers.
Like xpi for firefox, browser helper object for IE.
My target platform is only windows, and I just want the alternative of browser plugin to call a client side programe after instructed when the user is browser the web page.
Is that viable?
The only "viable" solution would be to register a protocol handler system-wide so say addresses starting with "myprotocol://" trigger your app. Users will still need to install your program and your program will only have access to the parameters passed by that protocol handler, so you will have to evaluate on your own if it's worth it.
Also note that some browsers or settings might show a confirmation message before using your new protocol for the first time, so users should be informed on what to do (and warned that this prompt is part of the normal workings of your app).

Resources