chrome-native-messaging

Very Slow to pass “large” amount of data from Chrome Extension to Host (written in C#)

孤人 提交于 2020-01-09 08:06:50
问题 I am using Chrome's Native Messaging API to pass the DOM of a page to my host. When I try passing a small string from my extension to my host, everything works, but when I try to pass the entire DOM (which isn't that large...only around 260KB), everything runs much slower and I eventually get a Native host has exited error preventing the host from responding. My main question: Why does it take so long to pass a 250KB - 350KB message from the extension to the host? According to the developer's

chrome.runtime.onSuspend.addListener not firing

时光总嘲笑我的痴心妄想 提交于 2020-01-05 22:43:46
问题 I am having a chrome extension connected to native messaging application. I need to do some cleanup when the chrome extension suspends. I am trying to use chrome.runtime.onSuspend.addListener but it is not working. Here is my code : - Manifest.json "background": {"scripts": ["background.js"], "persistent": false}, background.js function Connect() { console.log("Connected"); ext = chrome.runtime.connectNative('foxtrot'); chrome.runtime.onSuspend.addListener(function () { ext.postMessage({

Connect C++ native app to Firefox WebExtensions add-on with native messaging

吃可爱长大的小学妹 提交于 2020-01-05 02:36:28
问题 I want to make a easy example Firefox add-on using Native messaging. Here is my code: Native App: void SendDataToExtension(string message) { _setmode(_fileno(stdout), O_BINARY); try { unsigned int len = message.length(); std::string message = "{\"text\": \"This is a response message\"}"; unsigned int lenStr = str.length(); std::cout << char(((lenStr >> 0) & 0xFF)) << char(((lenStr >> 8) & 0xFF)) << char(((lenStr >> 16) & 0xFF)) << char(((lenStr >> 24) & 0xFF)); std::cout << str.c_str(); std:

Security of native messaging?

被刻印的时光 ゝ 提交于 2019-12-30 11:38:32
问题 I have a NPAPI plugin for sign-in data on website. I want to replace it by Native Messaging technology. I have read the documentation, but I have a question : Is this technology safe? Can hackers catch data in transfer from JavaScript to native host app and back? Edit: merging in a better-worded question: How secure is stdio data transfer ? Is there a way for man-in-middle attack for such data transfer ? 回答1: It is, in principle, possible to inspect stdio calls made by an executable. For

Chrome Native messaging with PHP

本秂侑毒 提交于 2019-12-30 09:48:10
问题 I am trying to build a PHP class that can communicate with a Chrome Extention through Native Messaging. I can connect to my code, but at initiation Chrome sends chrome-extension://lkjcciocnocjjgpacggbaikjehbfedbl/ --parent-window=1837060 To my PHP console app ( The Host) . What do I reply to make the connection working? Below my PHP code. Yes its dirty because its a POC project and I am very new to Chrome Extensions especially with the current updates. function out($data = ""){ $fp = fopen(

How to parse JSON from stdin at Native Messaging host?

ぃ、小莉子 提交于 2019-12-29 09:47:13
问题 Utilizing the code at How do I use a shell-script as Chrome Native Messaging host application as a template and given the file file.json which contains {"text":"abc"} following the code at Iterate over json with jq and the jq documentation $ cat file.json | jq --raw-output '.text' outputs abc Am not certain how to incorporate the pattern at this Answer while read -r id name date; do echo "Do whatever with ${id} ${name} ${date}" done< <(api-producing-json | jq --raw-output '.newList[] | "\(.id

JavaScript syncronicity: Combining onAuthRequired Listener and native massaging

旧时模样 提交于 2019-12-29 09:35:26
问题 I have this problem ... and I've been trying to get a username and password pair passed to background.js of my extension. The process goes as follows: A Credentials Server (CS) is started up with encrypted credential tokens Selenium opens the browser with custom extension The extension is triggered onAuthRequired The Native Messaging Host (NMH) starts then receives a 'ready' message The NMH uses a simple protocol to request tokens from the CS The NMH decrypts the tokens The NMH passes the

Native Message received, but response failed

五迷三道 提交于 2019-12-24 06:46:12
问题 I am developing a macOS application which can communicate with google chrome extension through native messaging . I used google official documentation from here, so I received data from extension successfully (as is shown in below). But when I tried to answer, I always get an error. My response is in JSON format and it is: { "text": "Client Started" } I use swift for my viewController and Objective-c++ for native messaging: ViewController.swift: let stream = StreamReader() override func

How to implement chrome native messaging message handling protocol in java

雨燕双飞 提交于 2019-12-24 04:37:04
问题 I tried to implement native messaging protocol in java but it didn't work. I tried it following way. private String readMessage() { int length = getInt(getLength()); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); byte[] b = new byte[4]; try { int total; for(int totalRead = 0 ; totalRead < length ; totalRead = totalRead + 4){ System.in.read(b); // make sure bOut.write(b); } } catch (IOException e) { e.printStackTrace(); } String bRes = null; try { bRes = new String(bOut.toByteArray(

need to open chrome native app on click of it, not at the time of enable the extension

半世苍凉 提交于 2019-12-23 05:42:08
问题 I have an chrome native application in windows form( c#). it use to open when i enable the extension in chrome. Can we manage this to open only when the application exe is clicked? How can we do that? This is the c# code private static string OpenStandardStreamIn() { //// We need to read first 4 bytes for length information Stream stdin = Console.OpenStandardInput(); int length = 0; byte[] bytes = new byte[4]; stdin.Read(bytes, 0, 4); length = System.BitConverter.ToInt32(bytes, 0); string