I'm using Chrome's native messaging API to connect to a native host I'm developing in Go with the Cobra library. The native application has a standalone CLI (implemented with Cobra), and the bare command (without any arguments) starts listening for JSON via stdin, which is meant to be an API for Chrome to interact with.
However, it fails every time the extension makes requests to the native messaging host (the client just immediately disconnects from the process). When I start Chrome with the --enable-logging flag I can see that the native host is erroring with unknown command "chrome-extension://cnjopnegooahjdngnkhiokognkdjiioc/" for "--native-app-name--". This is Cobra's error message that means "chrome-extension://cnjopnegooahjdngnkhiokognkdjiioc/" is being used as an argument, which seems to mean that Chrome is invoking the native host with app-name chrome-extension://cnjopnegooahjdngnkhiokognkdjiioc/ instead of just app-name.
Here's the code I'm using from the extension to call the native host:
var port = chrome.runtime.connectNative('app-name');
port.onMessage.addListener(function(msg) {
console.log(msg);
});
port.onDisconnect.addListener(function() {
console.log("disconnected");
});
port.postMessage({cmd:"ping"});
I can't find any documentation that suggests that Chrome sends the extension address as an argument, or whether it can be prevented.
It's part of the protocol and can't be disabled. The command line on Windows is something like this:
C:\Windows\system32\cmd.exe /c YOURHOSTAPP.exe chrome-extension://.................../
--parent-window=6752474 < \\.\pipe\chrome.nativeMessaging.in.e11ed8be274e1a85
> \\.\pipe\chrome.nativeMessaging.out.e11ed8be274e1a85
The first argument to the native messaging host is the origin of the caller, usually chrome-extension://[ID of whitelisted extension]. This allows native messaging hosts to identify the source of the message when multiple extensions are specified in the allowed_origins key in the native messaging host manifest.
On Windows, the native messaging host is also passed a command line argument with a handle to the calling chrome native window: --parent-window=<decimal handle value>. This lets the native messaging host create native UI windows that are correctly focused.
Warning: In Windows, in Chrome 54 and earlier, the origin was passed as the second parameter instead of the first parameter.
Related
I want to install the system using IPXE in UEFI mode and embed scripts using ipXE.efi.The following:
[root#localhost src]# cat uefi.ipxe
#!ipxe
dhcp
chain http://192.168.222.1/ipxeboot/menu.ipxe
compile:
make bin-x86_64-efi/ipxe.efi EMBED=uefi.ipxe
The installation error is as follows:
enter image description here
I think you need to provide some more context.
I assume you want to load a ipxe script over http on 192.168.222.1. So you have to run a http server on this ip which provides a ipxe script. This ipxe scripts has to provide instructions where to load the os.
I wrote a tutorial to achive this here:
https://medium.com/#peter.bolch/how-to-netboot-with-ipxe-6a41db514dee
Loading NaCl plugin... done.
Connecting to user#172.27.0.31...
###########################################################
# WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! #
###########################################################
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:C11asdfasdfxY6asdfasdfIUfadsfasdRB4.
Please contact your system administrator.
Add correct host key in /.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /.ssh/known_hosts:21
ECDSA host key for 172.27.0.31 has changed and you have requested strict checking.
Host key verification failed.
NaCl plugin exited with status code 255.
(R)econnect, (C)hoose another connection, or E(x)it?
This error is related to Chrome Secure Shell App extension.
This error may happen if you are under man in the middle attack or due to certificate change on the server side.
Previous fix to this was to delete local entry from known hosts by using Chrome console:
term_.command.removeKnownHostByIndex(21)
But produces error:
VM237:1 Uncaught TypeError: term_.command.removeKnownHostByIndex is not a function
at <anonymous>:1:15
Now (my chrome Version 85.0.4183.83 (Official Build) (64-bit)) an entry can be deleted manually in extension settings. 3 dots (chrome right upper corner) > More tools > Extensions > Secure Shell App Details > Extensions > options > SSH Files > Delete specific entry (whole row) in ~/.ssh/known_hosts
now that the app is discouraged in favour of the extension,
in the top-left corner of the terminal you may click the icon,
and delve into terminal settings and SSH.
~/.ssh/known_hosts is there.
good luck!
I downloaded the library as3-websocket-server for a desktop AIR app and it works fine on Chrome.
When I use Firefox it is ok for HTTP pages, while I get an error message if I test it on HTTPS pages:
SecurityError: The operation is insecure."
I read that I should use wss:// rather than ws://, but the AIR server doesn't work with this protocol.
I tried to convert all "Socket" to "SecureSocket" in the Air App but I get an error:
1118: Implicit coercion of a value with static type flash.net:Socket
to a possibly unrelated type flash.net:SecureSocket
Any idea on how to have the server available for both protocols? On the client side I could just check if I'm on HTTP or HTTPS and call the right websocket.
Thanks
I am a newbie to webrtc2sip. I have setup my webrtc2sip gateway and registered to sip2sip.info as my domain. The problem is when I make video calls from chrome to any SIP client(ekiga/jitsi) the call gets connected but I am unable to see videos on both the sides.
==================================================================================
Case 1: Chrome calls SIP client
Result: No video shown on both transmit and receive side
==================================================================================
On the chrome JS console it says that :
State machine: tsip_dialog_register_InProgress_2_Connected_X_2xx SIPml-api.js?svn=179:1
==session event = m_stream_video_local_added SIPml-api.js?svn=179:1
==session event = m_stream_video_remote_added SIPml-api.js?svn=179:1
==session event = m_stream_audio_local_added SIPml-api.js?svn=179:1
==session event = m_stream_audio_remote_added SIPml-api.js?svn=179:1
I have attached the JS console logs(case1_web2SIPClient_JSLogs.txt), wireshark trace(case1_web2SIPClient_WStrace.pcap) , webrtc2sip gateway console logs(case1_web2SIPClient_gatewayLogs.txt), sipml5 expert settings (Expert_settings.png) and config.xml (config.xml) for this case. I did not change anything in the config.xml that was generated after i built the source as mentioned in the instructions of this page (http://linux.autostatic.com/installing-webrtc2sip-on-ubuntu-1204).
I gave a try making calls between chrome and a android SIP client (CSipSimple) and the problem remains the same.
==================================================================================
case 2: SIP client calling chrome.
Result: as soon as I click answer button on chrome, the calls gets rejected.
==================================================================================
The JS console logs states that:
State machine: tsip_transac_ist_Proceeding_2_Completed_X_300_to_699 SIPml-api.js?svn=179:1
SEND: SIP/2.0 603 Failed to get local SDP
Via: SIP/2.0/WS 172.21.128.118:10060;rport=10060;branch=z9hG4bK-1441398960
From: <sip:tata#172.21.229.127>;tag=300647977
To: <sip:amshyam320#sip2sip.info>;tag=ZxQFfM7fIIP3rT1HINzb
Call-ID: fbdf5a11-ff9e-0072-fa8b-09525220cec6
CSeq: 1670757835 INVITE
Content-Length: 0
Reason: SIP; cause=603; text="Failed to get local SDP"
For this case I am attaching JS logs(case2_SIPClient2WebJSLogs.txt), wireshark dump(case2_jitsiToWeb_WStrace.pcap)
Configuration:
Chrome Version: checked on 30.0.1599.114 and even on Latest chrome version
Webrtc2sip version: 2.6.0
sipml5 Version: svn=203
ubuntu version: 12.04 (checked on both desktop and server editions)
Am I missing something in my setup or configuration please guide and help in moving further.
Thanks,
Shyam
Case2:
You're using RTCWeb-capable browser(Chrome) and trying to call a SIP client which may not be implementing some mandatory features like ICE,SRTP. Chrome uses SRTP-SDES and Firefox uses SRTP-DTLS.
Enable RTCWeb Breaker in sipml5 expert settings and check.
The RTCWeb Breaker is used to enable audio and video transcoding when the endpoints do not support the same codecs or the remote server is not RTCWeb-compliant.
Case:1:
Is audio working? and I can't see your logs.
I am looking to figure out a way to make incoming request to a browser. Installing an extension in the browser is OK. The goal of this is to allow another machine to connect to the extension to control a game without needing an intermediary server.
Is this feasible? Is it possible to make a Chrome or Firefox extension open a port to allow for incoming request?
What you are asking for are server sockets. For Chrome the answer is "no", Chrome extensions can only open client connections. Firefox extensions on the other hand can use nsIServerSocket interface to listen for incoming TCP connections on a port. If you use the Add-on SDK you would need to use the chrome package. Something like this:
var {Cc, Ci} = require("chrome");
var socket = Cc["#mozilla.org/network/server-socket;1"]
.createInstance(Ci.nsIServerSocket);
socket.init(12345, false, -1);
socket.asyncListen({
onSocketAccepted: function(socket, transport)
{
...
},
onStopListening: function(socket, status)
{
}
});