I'd like to make an SSH-based extension for Chrome, but I can't figure out how the secure shell extension is able to access raw sockets in Chrome.
It only has these permissions:
Yet I'm able to connect on port 22 via SSH. I know it uses PNaCl through Enscripten, but how do these provide raw socket access?
Has Google hard-coded whitelabel permission to the sockets API just for this extension?
Secure Shell gets access to raw sockets via (P)NaCl because it has been whitelisted in the Chromium source. ugly, i know.
https://chromium.googlesource.com/apps/libapps/+/master/nassh/doc/hack.md#Whitelisted-Permissions
if you want to do raw sockets in your own Chrome app, you can do so via JavaScript:
https://developer.chrome.com/apps/socket
if you want to access raw sockets from Chrome extensions, or via a PWA, then currently you won't be able to do so. those only have access to WebSockets currently (which is basically HTTP). this is why projects like WebSockify exist.
if you check the manifest, you will see that it has this permission "terminalPrivate".
Then if you poke alittle bit around you will find those posts:
http://chromium.2324630.n4.nabble.com/crx-Use-chrome-terminalPrivate-API-in-chromeOS-extension-app-td17265.html
https://groups.google.com/a/chromium.org/forum/#!topic/chromium-hterm/PtR2q2p_vss
The "good" comments you find on those sites are:
chrome.terminalPrivate exists, but it's native code only available to
the Secure Shell chrome extension, and only on Chrome OS.
Or this one:
chrome.xPrivate APIs are, well, private APIs that are only used by
certain Chrome or Google extensions and applications.
Related
In my particular network environment the Google chrome executable can access via an authenticated outgoing proxy server external web sites. Other executables however (when pointing to that outgoing proxy) are not able to do so.
I now have the idea to use Chrome itself as a local proxy for other executables like git or pip. - Is this possible, say, with a Chrome extension or with a tool that uses Chrome in a headless mode to connect to the Internet?
To clarify, I am not asking how to configure the proxy settings inside Chrome - I have successfully done this. I am asking how I can set up Chrome to receive HTTP(S) requests from other local programs and pass the requests on as an intermediate proxy (to the outgoing proxy specified in Chrome's settings).
On its own, no: Chrome will not open a port that other software can connect to. Even WebRTC requires an intermediate server to begin a peer to peer connection between browsers.
However Chrome supports Native Messaging, which means it will execute a specific native application that already exists on the system.
With this set up you can have:
a native application that accepts incoming connections and forwards data to the extension.
the extension listens to messages from the application and sends them via Chrome elsewhere on the internet.
i want to know if it is possible for google chrome extension to check if there is already a native app installed on the client machine or not
So we established that you control both the extension and the native app.
Note that the extension cannot access the filesystem to check for existence of files; presumably, you also want to detect the presence of the app even if it's not running, and ideally be able to launch it if it isn't.
The best way to check that the app is installed is to provide a Native Messaging host in the app. The installer would then add a registry key to let Chrome know that the native host is present, and you can connect to it.
Now, there are some considerations:
You can't check the presence of the native host without trying to launch it.
The process launched that way lives only as long as its communication port is opened in the extension.
The communication channel between the extension and the app is the STDIO.
It would not be wise to just declare your main Windows Forms app as the native host. You should write a separate utility app that can communicate according to the Native Messaging protocol (even if to just answer "I'm here"). If needed, it can launch the main app and/or communicate with it as needed using other channels. You could also just launch the main app from your native host and then communicate with it using WebSockets.
In the context of a unit test I need to send some code to the console of a chrome app I am developing. It's clear that I can do that from the chrome.debug API, but is there a way to do that from outside the browser?
Yes, there is a way; if you can do something with chrome.debug you can do so with remote debugging.
You need to enable remote debugging with command line switches; you can then connect to Chrome with a debugger client instance.
Google lists some existing debugger clients, and you can implement your own by following the debugger protocol (which works over HTTP+WebSockets).
The procedure for a debugger client is to request /json from the debugger port over HTTP, which lists all possible debug targets; the client then connects to the WebSocket associated with that target to work with it.
I am developing a chrome extension which needs to fetch some configuration from a system file... Earlier chrome provided NPAPI plug-ins, which could access any system resource (win registry, file system, IPC calls etc...)
However knowing that NPAPI will be discontinued soon, i am looking for alternatives.. one of the ways to build a plug-in is using Pepper clients, but pepper clients read/write only to chrome local storage.. which looks like a more data version of cookies...
So is there any other alternative to access system resources (like registry, files etc) in chrome extensions now??
The suggested alternative to NPAPI for many cases is "Native Messaging", where you provide an installer to users which adds binary code that chrome can communicate with via message passing. See http://developer.chrome.com/extensions/messaging.html#native-messaging.
For file access, in packaged apps there is the fileSystem API that lets you get access to the actual (non-sandboxed) filesystem. See http://developer.chrome.com/apps/fileSystem.html.
I've installed chrome remote desktop extension for desktop sharing.
https://chrome.google.com/webstore/detail/chrome-remote-desktop/gbchcmhmhahfdphkhkmpfmihenigjmpp?hl=en-US&utm_source=chrome-ntp-launcher
Im very impressed. Its fast and easy.
There's an option to add your computer to My Computers list by Enabling remote connection. The computers in the lists are also called hosts, Google has also provide an API to add/update/list/delete the hosts. https://developers.google.com/chrome/remote-desktop/v1/reference/hosts/insert
Now my question is; has anyone able to add host/computer to host lists using the Google Chrome Remote Desktop API? If yes, can you help me out with this.
Please let me know if you need more explanation.
Done it myself. I've used the php CURL for sending the host insert request. API only supports json content-type so you need to send data in json format.