now generate LC2 telly
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -376,3 +376,6 @@ FodyWeavers.xsd
|
||||
# CodeQL
|
||||
codeql-custom-queries-javascript/
|
||||
codeql/
|
||||
/zefie_wtvp_minisrv/test_prereg.js
|
||||
/zefie_wtvp_minisrv/test_telly.js
|
||||
/zefie_wtvp_minisrv/test_telly2.js
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
InitGeneratedValues()
|
||||
{
|
||||
printf("TS: %ServiceName% minisrv Generated Artemis TellyScript");
|
||||
setani("");
|
||||
setlocalpopcount(1);
|
||||
gNVRAMMayBeInvalid = 0;
|
||||
gDisguiseRate = 1;
|
||||
|
||||
gUsingOpenISP = 0;
|
||||
gEnable56K = UnknownFunc(1);
|
||||
if (gEnable56K = 0x42554646 /* BUFF */) {
|
||||
gEnable56K = 1;
|
||||
}
|
||||
printf("TS: Setting NameServers: %DNSIP1%, %DNSIP2%");
|
||||
setnameservice(%DNS1%, %DNS2%);
|
||||
gBlock911 = 1;
|
||||
gWantsVideoAd = 1;
|
||||
|
||||
gUsername = getserialnumber();
|
||||
gPAPPassword = "dummy";
|
||||
gCHAPSecret = "=1lpHL>=bTVKh1Z?26";
|
||||
return 0;
|
||||
}
|
||||
|
||||
LoginToPOP(int Fb, int Gb)
|
||||
{
|
||||
return PAPChat("wtv_%s", 0);
|
||||
}
|
||||
|
||||
ChatWithIndexedProvider(int idx)
|
||||
{
|
||||
if (idx == 48) {
|
||||
return LoginToPOP(71, 100);
|
||||
}
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
DialIndexedPOP(char *staticConfig, char *dynamicConfig, int seq_idx, int idx,
|
||||
int *err)
|
||||
{
|
||||
char *accessNumber, *accessProvider, *Lb = "";
|
||||
int ka;
|
||||
|
||||
if (seq_idx == 48) {
|
||||
accessNumber = "%DialinNumber%";
|
||||
accessProvider = "artemis";
|
||||
ka = 1;
|
||||
} else {
|
||||
printf("BUG!");
|
||||
*err = 16;
|
||||
return 2;
|
||||
}
|
||||
|
||||
setfullpopnumber(Lb);
|
||||
return DialIAP(staticConfig, dynamicConfig, accessProvider, accessNumber, ka, err);
|
||||
}
|
||||
|
||||
|
||||
PatternDial(char* staticConfig, char* dynamicConfig)
|
||||
{
|
||||
int pMinute, pHour, pMonth, pYear, pDayOfWeek;
|
||||
int Rb, Sb;
|
||||
|
||||
WhatTimeIsIt(&pMinute, &pHour, &pMonth, &pYear, &pDayOfWeek);
|
||||
Rb = pYear * 100 + pMonth;
|
||||
Sb = pHour * 100 + pMinute;
|
||||
|
||||
printf("TS: using set for %d %d:%02d %d",
|
||||
Rb, pHour, pMinute, pDayOfWeek);
|
||||
|
||||
{
|
||||
{
|
||||
{
|
||||
return DialByIndex(staticConfig, dynamicConfig, "00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
AccessDial(char* staticConfig, char* dynamicConfig, char* accessNumber)
|
||||
{
|
||||
int tb, ub, vb;
|
||||
|
||||
if (version() >= 8) {
|
||||
vb = getconnectretrycount();
|
||||
} else {
|
||||
vb = 0;
|
||||
}
|
||||
|
||||
printf("TS: next=%d", vb);
|
||||
|
||||
if (vb)
|
||||
return 13;
|
||||
|
||||
tb = DialIAP(staticConfig, dynamicConfig,
|
||||
"-access-", accessNumber, 1, &ub);
|
||||
if (tb) {
|
||||
setdtr(0);
|
||||
return ub;
|
||||
}
|
||||
ub = LoginToPOP(71, 100);
|
||||
|
||||
return ub;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
|
||||
/*
|
||||
* Dial the user-chosen ISP. We retry once if the first attempt fails,
|
||||
* on a second phone number if available.
|
||||
*
|
||||
* Returns 0 on success, nonzero error code on failure.
|
||||
*/
|
||||
OpenISPDial(char* staticConfig, char* dynamicConfig)
|
||||
{
|
||||
char* settings;
|
||||
int settingsVersion;
|
||||
int status, err, nextNumber;
|
||||
char* second;
|
||||
char* phoneNumber;
|
||||
char* phoneNumber2;
|
||||
char* userName;
|
||||
char* passwd;
|
||||
|
||||
/*printf("TS: DEBUG: using OpenISPDial (count=%d)", nextNumber);*/
|
||||
|
||||
setwindowsize(7); /* be paranoid; we don't know what they have */
|
||||
|
||||
if (version() >= 8) {
|
||||
nextNumber = getconnectretrycount();
|
||||
} else {
|
||||
nextNumber = 0;
|
||||
}
|
||||
|
||||
settings = GetPhoneSettings(&settingsVersion);
|
||||
if (settingsVersion < 9) {
|
||||
/* can't have OpenISP options in a pre-1.2 phone settings field! */
|
||||
printf("TS: bad settingsVersion (%d) for OpenISP",
|
||||
settingsVersion);
|
||||
return 1; /* semi-defined error code */
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point we're guaranteed to have phone settings created by
|
||||
* a v1.2 or later box, no matter what version() we are.
|
||||
*/
|
||||
if (!settings[300]) {
|
||||
alert("ERROR 0425", "Continue", 0);
|
||||
return 1; /* semi-defined error code */
|
||||
}
|
||||
|
||||
phoneNumber = &settings[172];
|
||||
passwd = &settings[204];
|
||||
userName = &settings[236];
|
||||
setfullpopnumber(&settings[268]);
|
||||
phoneNumber2 = &settings[304];
|
||||
|
||||
if (nextNumber == 0) {
|
||||
status = DialIAP(staticConfig, dynamicConfig,
|
||||
"-OpenISP-", phoneNumber, 1, &err);
|
||||
if (status == 0) {
|
||||
if (!userName && !passwd) {
|
||||
/* for "open" dialups */
|
||||
setpapmode(0);
|
||||
return 0;
|
||||
} else {
|
||||
err = PAPChat(userName, passwd);
|
||||
/*if (err == 10)
|
||||
err = 15;*/ /* don't reboot on "bad password" */
|
||||
if (!err) {
|
||||
return 0;
|
||||
} else {
|
||||
dialerror(err);
|
||||
}
|
||||
}
|
||||
} else if (status == 1) {
|
||||
dialerror(err);
|
||||
} else /*status==2*/ {
|
||||
return err;
|
||||
}
|
||||
nextNumber++;
|
||||
}
|
||||
|
||||
second = phoneNumber2;
|
||||
if (*phoneNumber2 == 0)
|
||||
second = phoneNumber;
|
||||
|
||||
if (nextNumber == 1) {
|
||||
status = DialIAP(staticConfig, dynamicConfig,
|
||||
"-OpenISP-", second, 1, &err);
|
||||
if (status == 0) {
|
||||
if (!userName && !passwd) {
|
||||
setpapmode(0);
|
||||
return 0;
|
||||
}
|
||||
err = PAPChat(userName, passwd);
|
||||
/*if (err == 10)
|
||||
err = 15;*/ /* don't reboot on "bad password" */
|
||||
}
|
||||
return err;
|
||||
} else {
|
||||
return 13; /* kTellyBlackHole */
|
||||
}
|
||||
}
|
||||
|
||||
InitGeneratedValues()
|
||||
{
|
||||
printf("TS: %ServiceName% minisrv Generated OpenISP TellyScript");
|
||||
setani("");
|
||||
setlocalpopcount(1);
|
||||
gNVRAMMayBeInvalid = 0;
|
||||
gDisguiseRate = 1;
|
||||
|
||||
|
||||
gEnable56K = UnknownFunc(1);
|
||||
if (gEnable56K = 0x42554646 /* BUFF */) {
|
||||
gEnable56K = 1;
|
||||
}
|
||||
printf("TS: Setting NameServers: %DNSIP1%, %DNSIP2%");
|
||||
setnameservice(%DNS1%, %DNS2%);
|
||||
gBlock911 = 1;
|
||||
gWantsVideoAd = 1;
|
||||
|
||||
gUsername = getserialnumber();
|
||||
gPAPPassword = "dummy";
|
||||
gCHAPSecret = "=1lpHL>=bTVKh1Z?26";
|
||||
return 0;
|
||||
}
|
||||
|
||||
MaybePrereg() {}
|
||||
|
||||
PatternDial(char* staticConfig, char* dynamicConfig)
|
||||
{
|
||||
gUsingOpenISP = 1;
|
||||
return OpenISPDial(staticConfig, dynamicConfig);
|
||||
|
||||
}
|
||||
|
||||
AccessDial(char* staticConfig, char* dynamicConfig, char* accessNumber)
|
||||
{
|
||||
gUsingOpenISP = 1;
|
||||
return OpenISPDial(staticConfig, dynamicConfig);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
var minisrv_service_file = true;
|
||||
var template = "";
|
||||
var template_preprocessor = {};
|
||||
|
||||
|
||||
var gourl = "wtv-head-waiter:/login?";
|
||||
|
||||
@@ -59,6 +58,8 @@ if (session_data.data_store.wtvsec_login) {
|
||||
// if relogin and wtv-script-id != 0, skip tellyscript
|
||||
session_data.set("wtv-open-access", (request_headers['wtv-open-access'] == "true") ? true : false);
|
||||
var file_path = null;
|
||||
var template = null;
|
||||
var template_preprocessor = {};
|
||||
var bf0app_update = false;
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
|
||||
@@ -87,8 +88,13 @@ if (session_data.data_store.wtvsec_login) {
|
||||
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
/*
|
||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok", true);
|
||||
else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok", true);
|
||||
*/
|
||||
template = wtvshared.getServiceDep("/wtv-1800/tellyscripts/base.template.tsf")
|
||||
if (session_data.get("wtv-open-access")) template += wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2.openisp.template.tsf");
|
||||
else template += wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2.normal.template.tsf");
|
||||
break;
|
||||
|
||||
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
|
||||
@@ -160,7 +166,8 @@ if (session_data.data_store.wtvsec_login) {
|
||||
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
|
||||
}
|
||||
|
||||
if (!file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
if (file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
if (template != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Generating TellyScript on socket", socket.id);
|
||||
|
||||
|
||||
headers = "200 OK\n"
|
||||
|
||||
@@ -47,7 +47,7 @@ const reservedKeywords = new Set([
|
||||
'getline', 'connectingwithvideoad', 'version', 'alert', 'system_getboxfeatureflags',
|
||||
'parsesystemtime', 'getdatetimelocal', 'getdayofweek', 'gethour', 'getminute',
|
||||
'getmonth', 'getyear', 'getconnectretrycount', 'dialerror', 'setfullpopnumber',
|
||||
'setconnectretrycount', 'setani', 'setlocalpopcount', 'computefcs'
|
||||
'setconnectretrycount', 'setani', 'setlocalpopcount', 'computefcs', 'modem_parseresult'
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
const headerDelimiter = Buffer.from('\n\n');
|
||||
let accumulatedBuffer = Buffer.alloc(0);
|
||||
const process = require('process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const classPath = path.resolve(__dirname + path.sep + "includes" + path.sep + "classes" + path.sep) + path.sep;
|
||||
const { WTVShared, clientShowAlert } = require(classPath + "/WTVShared.js");
|
||||
const WTVTellyScript = require(classPath + "/WTVTellyScript.js")
|
||||
|
||||
headers = `GET wtv-1800:/preregister
|
||||
wtv-client-serial-number: 9111111111111111
|
||||
wtv-show-time-record: 1 <file://disk/Browser/cSetup/cSetup.html>
|
||||
wtv-request-type: primary
|
||||
wtv-system-cpuspeed: 166187148
|
||||
wtv-system-sysconfig: 4163328
|
||||
wtv-disk-size: 8006
|
||||
wtv-viewer: WebTVIntel--2.5-HE
|
||||
wtv-incarnation: 1
|
||||
Accept-Language: en
|
||||
wtv-connect-session-id: 7b662075
|
||||
wtv-system-version: 7181
|
||||
wtv-capability-flags: 10935ffc8f
|
||||
wtv-client-bootrom-version: 2046
|
||||
wtv-client-rom-type: bf0app
|
||||
wtv-system-chipversion: 51511296
|
||||
User-Agent: Mozilla/4.0 WebTV/2.2.6.1 (compatible; MSIE 4.0)
|
||||
wtv-encryption: true
|
||||
wtv-script-id: 0
|
||||
wtv-script-mod: 0
|
||||
|
||||
`
|
||||
//wtv-open-access: true
|
||||
|
||||
|
||||
//wtv-client-rom-type: US-LC2-disk-0MB-8MB
|
||||
|
||||
const net = require('net');
|
||||
|
||||
// Create a socket connection to localhost on port 1615
|
||||
const client = net.connect({ port: 1615, host: '127.0.0.1' }, () => {
|
||||
console.log('Connected to localhost:1615');
|
||||
// Optionally, write data to the server
|
||||
client.write(headers);
|
||||
});
|
||||
|
||||
// Handle incoming data from the server
|
||||
client.on('data', (chunk) => {
|
||||
accumulatedBuffer = Buffer.concat([accumulatedBuffer, chunk]);
|
||||
|
||||
// Look for the header delimiter in the accumulated buffer
|
||||
const headerEndIndex = accumulatedBuffer.indexOf(headerDelimiter);
|
||||
|
||||
if (headerEndIndex !== -1) {
|
||||
// Split the buffer into headers and body
|
||||
const headersBuffer = accumulatedBuffer.slice(0, headerEndIndex);
|
||||
const bodyBuffer = accumulatedBuffer.slice(headerEndIndex + headerDelimiter.length);
|
||||
|
||||
// Optionally, if you expect more body data in subsequent chunks,
|
||||
// you can reset the accumulatedBuffer to only hold the current body
|
||||
accumulatedBuffer = bodyBuffer;
|
||||
}
|
||||
|
||||
telly = new WTVTellyScript(accumulatedBuffer)
|
||||
console.log(telly.packed_header)
|
||||
// console.log(telly.raw_data)
|
||||
// Optionally, close the connection after receiving data
|
||||
client.end();
|
||||
});
|
||||
|
||||
// Handle the connection close event
|
||||
client.on('end', () => {
|
||||
console.log('Disconnected from server');
|
||||
});
|
||||
|
||||
// Handle errors
|
||||
client.on('error', (err) => {
|
||||
console.error('Socket error:', err);
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
const process = require('process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const classPath = path.resolve(__dirname + path.sep + "includes" + path.sep + "classes" + path.sep) + path.sep;
|
||||
const { WTVShared, clientShowAlert } = require(classPath + "/WTVShared.js");
|
||||
const WTVTellyScript = require(classPath + "/WTVTellyScript.js")
|
||||
|
||||
//const LC2 = classPath + "/../ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
//const prereg = fs.readFileSync(LC2);
|
||||
|
||||
//const LC2OISP = classPath + "/../ServiceDeps/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
//const isp = fs.readFileSync(LC2OISP);
|
||||
|
||||
//console.log("OGTOK:", tokened)
|
||||
bf0 = fs.readFileSync(classPath + "/../ServiceDeps/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok")
|
||||
var token = new WTVTellyScript(bf0);
|
||||
//var token2 = new WTVTellyScript(isp);
|
||||
console.log("OGTOK Header:", token.packed_header);
|
||||
console.log(token.raw_data)
|
||||
//console.log("OGTOK Header:", token2.packed_header);
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
const process = require('process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const classPath = path.resolve(__dirname + path.sep + "includes" + path.sep + "classes" + path.sep) + path.sep;
|
||||
const { WTVShared, clientShowAlert } = require(classPath + "/WTVShared.js");
|
||||
const WTVTellyScript = require(classPath + "/WTVTellyScript.js")
|
||||
//const bf0app = classPath + "/../ServiceDeps/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok"
|
||||
//const tokened = fs.readFileSync(bf0app);
|
||||
const LC2 = classPath + "/../ServiceDeps/wtv-1800/tellyscripts/LC2/LC2.prereg.template.txt";
|
||||
const tokened = fs.readFileSync(LC2);
|
||||
console.log("OGTOK:", tokened)
|
||||
var token = new WTVTellyScript(tokened, 2);
|
||||
console.log("OGTOK Header:", token.packed_header);
|
||||
token.setTemplateVars("Test", 5736666, "192.168.11.1", "8.8.8.8");
|
||||
console.log(token.raw_data);
|
||||
token.tokenize();
|
||||
token.pack();
|
||||
token.minify();
|
||||
|
||||
Reference in New Issue
Block a user