0
일부 숨겨진 데이터를 얻기 위해 ISP 모뎀에 연결하려고합니다. 그래서 일부 자바 스크립트가 포함 된 html 페이지를 만들었습니다. xmlhttprequest를 사용하여 페이지에 로그인하면 작동하지만 쿠키를 얻을 수 없어 내 요청을하고 숨겨진 데이터를 가져와야합니다. 나는 NWJS와 내가 여기 0.22.1NWJS의 교차 도메인 원본 보안
는 최신 SDK의 NWJS를 사용 actualy있어 ... 을 내가 CORS 제한을 우회 할 수있다 ...하지만 난 내가 잘못 알고하지 않는 것이 읽어 내 package.json : 여기
{
"main": "index.html",
"name": "Liveboxinfos",
"description": "test app",
"version": "1.0.0",
"nodejs": true,
"node-remote": "http://192.168.1.1/*",
"permissions": ["*://*/*"],
"chromium-args": "--disable-web-security --user-data-dir",
"window": {
"title": "node-webkit demo",
"icon": "link.png",
"toolbar": true,
"frame": true,
"width": 1200,
"height": 600,
"position": "center",
"min_width": 600,
"min_height": 400,
"max_width": 1200,
"max_height": 600
}
}
그리고 내 index.html을의 자바 스크립트 일부입니다 ... 여기
var ip = "192.168.1.1";
var password = "password";
var HTTP = new XMLHttpRequest();
var url = "http://" + ip;
var params = '{"service":"sah.Device.Information","method":"createContext","parameters":{"applicationName":"so_sdkut","username":"admin","password":"' + password + '"}}';
HTTP.open("POST", url, false);
HTTP.setRequestHeader("Content-Type", "application/x-sah-ws-4-call+json");
HTTP.setRequestHeader("Authorization", "X-Sah-Login");
HTTP.withCredentials = true;
HTTP.onreadystatechange = function() {//Call a function when the state changes.
if(HTTP.readyState == 4 && HTTP.status == 200) {
//alert(HTTP.responseText);
}
}
HTTP.send(params);
const regex = /contextID":"(.*?)"/;
const Received = HTTP.responseText;
const cookie = HTTP.getResponseHeader("set-cookie");
가 null = 당신은 쿠키를 볼 수 있습니다 내 테스트 응용 프로그램입니다
그게 사실인지는 내가 여기에 이해하지 못하는 뭔가가있다 : http://docs.nwjs.io/en/v0.13.0/For%20Users/Advanced/Security%20in% 20NW.js/그들은 말한다 : 노드 프레임은 일반 프레임보다 다음과 같은 추가 기능을 가지고있다 : • 샌드 박스, 같은 오리진 정책 등과 같은 모든 보안 제한을 무시하라. 예를 들어, 원격지의 모든 사이트에 XHR을 교차시킬 수있다. – cetipabo