v0.9.1
- fix: throw proper error if wtv-update:/sync called without arguments
- feature: Support to route all HTTP proxied requests over a SOCKS proxy (eg Tor or VPN)
- feature: Psuedo-HTTPS (WebTV can now visit HTTPS URLs via proxy, but
we do not use SSL encryption when sending back to the WebTV)
- fix: header issue with login-stage-two.js
- fix: encrypted request headers were shown despite verbosity level
- update: wtv-update/sync: allow multiple groups in sync diskmap, fix md5 comparsion
- update: wtv-home:/home: added connection speed
- Renamed processSSID to filterSSID
- Documented and rewrote some functions
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
if (socket.ssid != null && !ssid_sessions[socket.ssid].get("wtvsec_login")) {
|
||||
if (socket.ssid != null) {
|
||||
if (ssid_sessions[socket.ssid].get("wtvsec_login")) ssid_sessions[socket.ssid].delete("wtvsec_login");
|
||||
var wtvsec_login = new WTVSec();
|
||||
wtvsec_login.IssueChallenge();
|
||||
wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
ssid_sessions[socket.ssid].set("wtvsec_login", wtvsec_login);
|
||||
} else if (socket.ssid != null) {
|
||||
var wtvsec_login = ssid_sessions[socket.ssid].get("wtvsec_login");
|
||||
}
|
||||
|
||||
if (wtvsec_login) {
|
||||
|
||||
@@ -24,11 +24,11 @@ if (socket.ssid !== null) {
|
||||
if (challenge_response && client_challenge_response) {
|
||||
//if (challenge_response.toString(CryptoJS.enc.Base64).substring(0,85) == client_challenge_response.substring(0,85)) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) == client_challenge_response) {
|
||||
console.log(" * wtv-challenge-response success for " + processSSID(socket.ssid));
|
||||
console.log(" * wtv-challenge-response success for " + filterSSID(socket.ssid));
|
||||
wtvsec_login.PrepareTicket();
|
||||
//socket_sessions[socket.id].secure = true;
|
||||
} else {
|
||||
console.log(" * wtv-challenge-response FAILED for " + processSSID(socket.ssid));
|
||||
console.log(" * wtv-challenge-response FAILED for " + filterSSID(socket.ssid));
|
||||
if (zdebug) console.log("Response Expected:", challenge_response.toString(CryptoJS.enc.Base64));
|
||||
if (zdebug) console.log("Response Received:", client_challenge_response)
|
||||
gourl = "wtv-head-waiter:/login?reissue_challenge=true";
|
||||
@@ -63,7 +63,7 @@ wtv-country: US
|
||||
wtv-language-header: en-US,en
|
||||
wtv-visit: client:closeallpanels
|
||||
wtv-expire-all: client:closeallpanels
|
||||
wtv-offline-user-list: `+offline_user_list+`
|
||||
wtv-offline-user-list: `+ offline_user_list + `
|
||||
wtv-bypass-proxy: true
|
||||
wtv-ticket: `+ wtvsec_login.ticket_b64 + `
|
||||
wtv-messagewatch-checktimeoffset: off
|
||||
@@ -72,14 +72,15 @@ wtv-connection-timeout: 90
|
||||
wtv-fader-timeout: 900
|
||||
wtv-ssl-log-url: wtv-log:/log
|
||||
wtv-smartcard-inserted-message: Contacting service
|
||||
user-id: `+userid+`
|
||||
user-id: `+ userid + `
|
||||
wtv-transition-override: off
|
||||
wtv-allow-dsc: true
|
||||
wtv-messenger-enable: 0
|
||||
wtv-noback-all: wtv-
|
||||
wtv-service: reset
|
||||
`+ getServiceString('all') + `
|
||||
wtv-boot-url: wtv-1800:/preregister?relogin=true`
|
||||
wtv-boot-url: wtv-1800:/preregister?relogin=true
|
||||
`;
|
||||
//wtv-ssl-certs-download-url: wtv-head-waiter:/ssl-cert.der
|
||||
//wtv-ssl-certs-checksum: 473926DC1B11F635A6B920953FDCDE6A
|
||||
headers += `wtv-user-name: `+ nickname + `
|
||||
|
||||
@@ -22,8 +22,8 @@ function go() {
|
||||
}
|
||||
</script>
|
||||
<h2>Welcome to `+ z_title + `</h2>
|
||||
<h3>Encryption Status: `+cryptstatus+`</h3>`
|
||||
data += `<h4>Working stuff</h4>
|
||||
<h3>Encryption Status: `+cryptstatus+`</h3>
|
||||
Connection Speed: &rate;
|
||||
<form name=access onsubmit="go()">
|
||||
<ul>
|
||||
<li><a href="client:relog">client:relog (direct)</a></li>
|
||||
@@ -43,11 +43,6 @@ data += `width=250 height=10 bgcolor=#444444 text=#ffdd33 cursor=#cc9933 select
|
||||
</form></li>
|
||||
</ul>`
|
||||
|
||||
try {
|
||||
if (fs.lstatSync(service_dir + "/home.zefie.html")) {
|
||||
data += fs.readFileSync(service_dir + "/home.zefie.html", { 'encoding': 'utf8' });
|
||||
}
|
||||
} catch (e) {
|
||||
// silent
|
||||
}
|
||||
data += "</body>\n</html>";
|
||||
if (fs.existsSync(service_vaults[0].path + "/" + service_name + "/home.zefie.html")) {
|
||||
data += fs.readFileSync(service_vaults[0].path + "/" + service_name + "/home.zefie.html", { 'encoding': 'utf8' });
|
||||
}
|
||||
@@ -23,7 +23,7 @@ Content-length: 0`;
|
||||
logdata_outstring_hex += request_headers.post_data.toString(CryptoJS.enc.Hex);
|
||||
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
||||
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
||||
if (!zquiet) console.log(" * Wrote POST log data from", processSSID(socket.ssid), "for", socket.id);
|
||||
if (!zquiet) console.log(" * Wrote POST log data from", filterSSID(socket.ssid), "for", socket.id);
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
} else {
|
||||
@@ -43,7 +43,7 @@ Content-length: 0`;
|
||||
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
|
||||
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
||||
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
||||
if (!zquiet) console.log(" * Wrote GET log data from", processSSID(socket.ssid), "for", socket.id);
|
||||
if (!zquiet) console.log(" * Wrote GET log data from", filterSSID(socket.ssid), "for", socket.id);
|
||||
sendToClient(socket, headers, data);
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -75,10 +75,10 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
post_data_current_file = post_data[k];
|
||||
}
|
||||
if (post_data[k].indexOf(":") > 0) {
|
||||
var post_data_line = post_data[k].split(":")
|
||||
var post_data_line = post_data[k].split(": ")
|
||||
var post_data_line_name = post_data_line[0];
|
||||
post_data_line.shift();
|
||||
var post_data_line_data = post_data_line.join(":");
|
||||
var post_data_line_data = post_data_line.join(": ");
|
||||
|
||||
if (!post_data_fileinfo[post_data_filecount]) post_data_fileinfo[post_data_filecount] = new Array();
|
||||
|
||||
@@ -90,8 +90,6 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
else {
|
||||
post_data_fileinfo[post_data_filecount][post_data_line_name] = post_data_line_data;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
post_data_filecount++;
|
||||
post_data_current_file = post_data_current_directory + post_data[k];
|
||||
@@ -108,8 +106,10 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
post_match_file = service_vaults[g].path + "/" + service_name + "/" + diskmap_group_data.files[k].location;
|
||||
if (!fs.existsSync(post_match_file)) post_match_file = null;
|
||||
});
|
||||
|
||||
var post_match_file_lstat = fs.lstatSync(post_match_file);
|
||||
var post_match_result = post_data_fileinfo.find(el => el["file"] === diskmap_group_data.files[k].file) || false;
|
||||
var post_match_result = post_data_fileinfo.find(el => el.file === diskmap_group_data.files[k].file) || null;
|
||||
|
||||
var post_match_file_data = new Buffer.from(fs.readFileSync(post_match_file, {
|
||||
encoding: null,
|
||||
flags: 'r'
|
||||
@@ -121,7 +121,7 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
|
||||
if (post_match_result) {
|
||||
// md5s match, so client doesn't need file
|
||||
if (diskmap_group_data.files[k]['wtv-checksum'] == post_match_result["wtv-checksum"]) return;
|
||||
if (diskmap_group_data.files[k]['wtv-checksum'].toLowerCase() == post_match_result["wtv-checksum"]) return;
|
||||
else wtv_download_list.push(diskmap_group_data.files[k]);
|
||||
} else {
|
||||
wtv_download_list.push(diskmap_group_data.files[k]);
|
||||
@@ -150,13 +150,13 @@ if (request_headers.query.diskmap && request_headers.query.group && request_head
|
||||
}
|
||||
data = '';
|
||||
diskmap_data = diskmap_data[request_headers.query.group];
|
||||
/*if (!diskmap_data.display) {
|
||||
if (!diskmap_data.display) {
|
||||
Object.keys(diskmap_data).forEach(function (k) {
|
||||
if (diskmap_data[k]) data += processGroup(request_headers.query.group,diskmap_data[k],k);
|
||||
});
|
||||
} else { */
|
||||
data = processGroup(request_headers.query.group, diskmap_data);
|
||||
//}
|
||||
} else {
|
||||
data = processGroup(request_headers.query.group, diskmap_data);
|
||||
}
|
||||
|
||||
headers = "200 OK\nContent-Type: wtv/download-list";
|
||||
} catch (e) {
|
||||
@@ -172,5 +172,10 @@ if (request_headers.query.diskmap && request_headers.query.group && request_head
|
||||
data = errpage[1];
|
||||
console.log("wtv-update:/sync error", "could not find diskmap");
|
||||
}
|
||||
} else {
|
||||
var errpage = doErrorPage(400);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
if (zdebug) console.log("wtv-update:/sync error", "missing query arguments");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user