v0.9.10
- initial primitive wtv-cookie service to satisfy newer builds and http(s) issues - update: wtv-home:/home: add wtv-visit: in case javascript URL accessor fails - update: replace bf0app and LC2 tellyscripts with box-specific PPP auth, rather than hard coded PPP auth (may disable CHAP support) - update: app.js: getServiceString overrides should only be temporary for that request - update: WTVClientCapabilities.js: catch exception when sent unknown configuration bits
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,468 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int dterate;
|
||||
int dcerate;
|
||||
int protocol;
|
||||
int compression;
|
||||
int connected;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
parseResult(int result)
|
||||
{
|
||||
int retcode = 0;
|
||||
char *comment = "";
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
comment = " OK";
|
||||
retcode = 1;
|
||||
}
|
||||
else if (result == 3)
|
||||
{
|
||||
comment = "NO CARRIER";
|
||||
retcode = 12;
|
||||
}
|
||||
else if (result == 6)
|
||||
{
|
||||
comment = "NO DIALTONE";
|
||||
retcode = 5;
|
||||
}
|
||||
else if (result == 7)
|
||||
{
|
||||
comment = "BUSY";
|
||||
retcode = 7;
|
||||
}
|
||||
else if (result == 8)
|
||||
{
|
||||
comment = "NO ANSWER";
|
||||
retcode = 6;
|
||||
}
|
||||
else if (result == 18)
|
||||
{
|
||||
comment = "Connected!";
|
||||
dterate = 0xe100;
|
||||
connected = 1;
|
||||
}
|
||||
else if (result == 19)
|
||||
{
|
||||
comment = "Connected!";
|
||||
dterate = 0x1c200;
|
||||
connected = 1;
|
||||
}
|
||||
else if (result == 20)
|
||||
{
|
||||
comment = "Connected!";
|
||||
dterate = 0x39210;
|
||||
connected = 1;
|
||||
}
|
||||
else if (result == 46)
|
||||
{
|
||||
dcerate = 0x4b0;
|
||||
}
|
||||
else if (result == 47)
|
||||
{
|
||||
dcerate = 0x960;
|
||||
}
|
||||
else if (result == 48)
|
||||
{
|
||||
dcerate = 0x12c0;
|
||||
}
|
||||
else if (result == 49)
|
||||
{
|
||||
dcerate = 0x1c20;
|
||||
}
|
||||
else if (result == 50)
|
||||
{
|
||||
dcerate = 0x2580;
|
||||
}
|
||||
else if (result == 51)
|
||||
{
|
||||
dcerate = 0x2ee0;
|
||||
}
|
||||
else if (result == 52)
|
||||
{
|
||||
dcerate = 0x3840;
|
||||
}
|
||||
else if (result == 53)
|
||||
{
|
||||
dcerate = 0x41a0;
|
||||
}
|
||||
else if (result == 54)
|
||||
{
|
||||
dcerate = 0x4b00;
|
||||
}
|
||||
else if (result == 55)
|
||||
{
|
||||
dcerate = 0x5460;
|
||||
}
|
||||
else if (result == 56)
|
||||
{
|
||||
dcerate = 0x5dc0;
|
||||
}
|
||||
else if (result == 57)
|
||||
{
|
||||
dcerate = 0x6720;
|
||||
}
|
||||
else if (result == 58)
|
||||
{
|
||||
dcerate = 0x7080;
|
||||
}
|
||||
else if (result == 66)
|
||||
{
|
||||
compression = 1;
|
||||
}
|
||||
else if (result == 67)
|
||||
{
|
||||
compression = 2;
|
||||
}
|
||||
else if (result == 69)
|
||||
{
|
||||
compression = 0;
|
||||
}
|
||||
else if (result == 76)
|
||||
{
|
||||
protocol = 0;
|
||||
}
|
||||
else if (result == 77)
|
||||
{
|
||||
protocol = 1;
|
||||
}
|
||||
else if (result == 78 || result == 60)
|
||||
{
|
||||
dcerate = 0x79e0;
|
||||
}
|
||||
else if (result == 79 || result == 65)
|
||||
{
|
||||
dcerate = 0x8340;
|
||||
}
|
||||
else if (result == 80)
|
||||
{
|
||||
protocol = 2;
|
||||
}
|
||||
else if (result == 81)
|
||||
{
|
||||
protocol = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("TellyScript: ParseResult -- %d unknown", result);
|
||||
retcode = 9;
|
||||
}
|
||||
|
||||
printf("TellyScript: ParseResult -- %d %s (retcode=%d)", result,
|
||||
comment, retcode);
|
||||
return retcode;
|
||||
}
|
||||
|
||||
ConfigureModem(char *cmd, char *response)
|
||||
{
|
||||
int retries;
|
||||
int len = strlen(response);
|
||||
|
||||
retries = 0;
|
||||
while (retries++ <= 3)
|
||||
{
|
||||
flush();
|
||||
|
||||
sendstr(cmd);
|
||||
if (waitfor(response, len, 120))
|
||||
{
|
||||
printf("TellyScript: Configured modem.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("TellyScript: TIMEOUT waiting for OK");
|
||||
builtin_winkdtr();
|
||||
}
|
||||
}
|
||||
|
||||
if (retries > 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int count, i, result;
|
||||
int start = ticks();
|
||||
int end;
|
||||
char *number;
|
||||
char buffer[32];
|
||||
char *settings = getphonesettings();
|
||||
char *accessNumber = &settings[108];
|
||||
char *dialOutsidePrefix = &settings[32];
|
||||
char *dialLDPrefix = &settings[140];
|
||||
char *callWaitingPrefix = &settings[0];
|
||||
char usePulseDialing = settings[96];
|
||||
char audibleDialing = settings[97];
|
||||
char disableCallWaiting = settings[98];
|
||||
char dialOutsideLine = settings[99];
|
||||
char changedCity = settings[100];
|
||||
char waitForTone = settings[101];
|
||||
char hasCallWaiting = settings[102];
|
||||
char useCallWaitingHack = settings[103];
|
||||
char dialSpeed = settings[104];
|
||||
char brokenPBX = settings[106];
|
||||
char numberToDial[32];
|
||||
char secondConfigCommand[80];
|
||||
char dialCommand[80];
|
||||
char *configurationCommand = "ATS38=0S30=180S95=36S11=60&D2V1E0L3&Q5&K3\r";
|
||||
char *defaultNumber = "18006138199";
|
||||
char *nvOverRide = getpreregnumber();
|
||||
char *secret = getsecret();
|
||||
char *serial_number = getserialnumber();
|
||||
char username[32];
|
||||
char password[32];
|
||||
|
||||
printf("TellyScript: 800 Registration Script 4.1-zefie");
|
||||
setprogressmode(1);
|
||||
setprogresstext("Preparing to call");
|
||||
setprogresspercentage(16);
|
||||
setprogressdirty(1);
|
||||
|
||||
|
||||
|
||||
|
||||
if (nvOverRide != 0)
|
||||
{
|
||||
defaultNumber = nvOverRide;
|
||||
printf("TellyScript: Over-riding default preregistration number with %s from NVRAM", nvOverRide);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (accessNumber[0])
|
||||
strcpy(numberToDial, accessNumber);
|
||||
else
|
||||
strcpy(numberToDial, defaultNumber);
|
||||
|
||||
|
||||
|
||||
if (brokenPBX)
|
||||
if (numberToDial[0] == 49)
|
||||
strcpy(numberToDial, &numberToDial[1]);
|
||||
|
||||
|
||||
|
||||
strcpy(secondConfigCommand, "ATV0");
|
||||
|
||||
|
||||
|
||||
if (audibleDialing)
|
||||
strcat(secondConfigCommand, "M1");
|
||||
else
|
||||
strcat(secondConfigCommand, "M0");
|
||||
|
||||
|
||||
|
||||
if (waitForTone)
|
||||
strcat(secondConfigCommand, "S6=10X4");
|
||||
else
|
||||
strcat(secondConfigCommand, "S6=4X3");
|
||||
|
||||
|
||||
|
||||
strcat(secondConfigCommand, "S10=14");
|
||||
|
||||
|
||||
|
||||
if (dialSpeed == 0)
|
||||
strcat(secondConfigCommand, "S11=200");
|
||||
else if (dialSpeed == 1)
|
||||
strcat(secondConfigCommand, "S11=110");
|
||||
else if (dialSpeed == 2)
|
||||
strcat(secondConfigCommand, "S11=60");
|
||||
else if (dialSpeed == 3)
|
||||
strcat(secondConfigCommand, "S11=1");
|
||||
|
||||
strcat(secondConfigCommand, "\r");
|
||||
|
||||
|
||||
|
||||
if (usePulseDialing)
|
||||
strcpy(dialCommand, "ATDP");
|
||||
else
|
||||
strcpy(dialCommand, "ATDT");
|
||||
|
||||
|
||||
|
||||
if (disableCallWaiting)
|
||||
{
|
||||
strcat(dialCommand, callWaitingPrefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (strlen(dialLDPrefix) > 0)
|
||||
{
|
||||
strcat(dialCommand, dialLDPrefix);
|
||||
strcat(dialCommand, ",");
|
||||
}
|
||||
else
|
||||
if (dialOutsideLine)
|
||||
{
|
||||
strcat(dialCommand, dialOutsidePrefix);
|
||||
strcat(dialCommand, ",");
|
||||
}
|
||||
|
||||
|
||||
|
||||
setwindowsize(3);
|
||||
printf("TellyScript: TCP Window Size set to 3 (USR).");
|
||||
|
||||
enablemodem();
|
||||
|
||||
builtin_winkdtr();
|
||||
setflowcontrol(3);
|
||||
setbaud(0xe100);
|
||||
|
||||
if (!ConfigureModem(configurationCommand, "OK"))
|
||||
{
|
||||
printf("TellyScript: Couldn't get OK from modem during first config cmd");
|
||||
setdtr(0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
flush();
|
||||
|
||||
if (!ConfigureModem(secondConfigCommand, "0"))
|
||||
{
|
||||
printf("TellyScript: Couldn't get OK from modem during second config cmd");
|
||||
setdtr(0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
flush();
|
||||
|
||||
setprogresstext("Dialing your hacky modem...");
|
||||
setprogresspercentage(32);
|
||||
setprogressdirty(1);
|
||||
|
||||
printf("TellyScript: Overriding exclusion circuit...");
|
||||
setforcehook(1);
|
||||
|
||||
printf("TellyScript: Dialing %s...", numberToDial);
|
||||
if ((numberToDial[0] != 65) && (numberToDial[0] != 97))
|
||||
sendstr(dialCommand);
|
||||
sendstr(numberToDial);
|
||||
|
||||
sendstr(";\r");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sprintf(buffer, "prereg: %s", numberToDial);
|
||||
setworkingnumber(buffer);
|
||||
|
||||
flush();
|
||||
|
||||
i = 0;
|
||||
connected = 0;
|
||||
while (!connected && i < 6) {
|
||||
count = getline(buffer, 31, 0x1068);
|
||||
i++;
|
||||
|
||||
if (count == 0) {
|
||||
printf("TellyScript: TIMEOUT waiting for dial result.");
|
||||
setdtr(0);
|
||||
if (i == 1)
|
||||
return 4;
|
||||
else
|
||||
return 8;
|
||||
}
|
||||
|
||||
result = parseResult(atoi(buffer));
|
||||
if (result == 1) {
|
||||
if (i == 1) {
|
||||
setprogresstext("Waiting for answer...");
|
||||
setprogresspercentage(48);
|
||||
setprogressdirty(1);
|
||||
sendstr("ATD\r");
|
||||
result = 0;
|
||||
} else {
|
||||
|
||||
setdtr(0);
|
||||
printf("TellyScript: got '%s' at odd time", buffer);
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
setdtr(0);
|
||||
if (result == 12 && i > 2) {
|
||||
|
||||
return 8;
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
if (i > 1) {
|
||||
setprogresstext("HackTV answered...");
|
||||
setprogresspercentage(64);
|
||||
setprogressdirty(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("TellyScript: Setting NameServers: 10.0.0.50, 8.8.8.8");
|
||||
setnameservice(0xa000032, 0x8080808);
|
||||
|
||||
printf("TellyScript: dterate = %d, dcerate = %d, protocol = %d, compression = %d",
|
||||
dterate, dcerate, protocol, compression);
|
||||
setconnectionstats(dterate, dcerate, protocol, compression);
|
||||
|
||||
setprogresstext("Starting communication...");
|
||||
setprogresspercentage(80);
|
||||
setprogressdirty(1);
|
||||
|
||||
sprintf(username, "wtv_%s", serial_number);
|
||||
sprintf(password, "%d", computefcs(serial_number));
|
||||
|
||||
printf("TellyScript: Using '%s' for username", username);
|
||||
printf("TellyScript: Using '%s' for password", password);
|
||||
|
||||
setusername(username);
|
||||
setpassword(password);
|
||||
setpapmode(1);
|
||||
|
||||
if (!startppp())
|
||||
{
|
||||
setdtr(0);
|
||||
if (getpppresult() == 3)
|
||||
{
|
||||
printf("TellyScript: PAP authentification failure");
|
||||
return 10;
|
||||
}
|
||||
|
||||
printf("TellyScript: PPP negotiation failed");
|
||||
return 11;
|
||||
}
|
||||
|
||||
setprogresstext("Connected to HackTV");
|
||||
setprogresspercentage(100);
|
||||
setprogressdirty(1);
|
||||
|
||||
printf("TellyScript: Link connected.");
|
||||
printf("TellyScript: total time = %d (seconds)", (ticks() - start) / 60);
|
||||
|
||||
return 2;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,463 @@
|
||||
int dterate;
|
||||
int dcerate;
|
||||
int protocol;
|
||||
int compression;
|
||||
|
||||
parseResult(int result)
|
||||
{
|
||||
int retcode = 0;
|
||||
|
||||
printf("TellyScript: parseResult -- %d", result);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
retcode = 0;
|
||||
}
|
||||
else if (result == 1)
|
||||
{
|
||||
dterate = 300;
|
||||
}
|
||||
else if (result == 3)
|
||||
{
|
||||
printf("TellyScript: Got NO CARRIER");
|
||||
retcode = 8;
|
||||
}
|
||||
else if (result == 5)
|
||||
{
|
||||
dterate = 0x4b0;
|
||||
}
|
||||
else if (result == 6)
|
||||
{
|
||||
printf("TellyScript: Got NO DIALTONE");
|
||||
retcode = 5;
|
||||
}
|
||||
else if (result == 7)
|
||||
{
|
||||
printf("TellyScript: Got BUSY");
|
||||
retcode = 7;
|
||||
}
|
||||
else if (result == 8)
|
||||
{
|
||||
retcode = 7;
|
||||
}
|
||||
else if (result == 9)
|
||||
{
|
||||
dterate = 0x258;
|
||||
}
|
||||
else if (result == 10)
|
||||
{
|
||||
dterate = 0x960;
|
||||
}
|
||||
else if (result == 11)
|
||||
{
|
||||
dterate = 0x12c0;
|
||||
}
|
||||
else if (result == 12)
|
||||
{
|
||||
dterate = 0x2580;
|
||||
}
|
||||
else if (result == 13)
|
||||
{
|
||||
dterate = 0x1c20;
|
||||
}
|
||||
else if (result == 14)
|
||||
{
|
||||
dterate = 0x2ee0;
|
||||
}
|
||||
else if (result == 15)
|
||||
{
|
||||
dterate = 0x3840;
|
||||
}
|
||||
else if (result == 16)
|
||||
{
|
||||
dterate = 0x4b00;
|
||||
}
|
||||
else if (result == 17)
|
||||
{
|
||||
dterate = 0x9600;
|
||||
}
|
||||
else if (result == 18)
|
||||
{
|
||||
dterate = 0xe100;
|
||||
}
|
||||
else if (result == 19)
|
||||
{
|
||||
dterate = 0x1c200;
|
||||
}
|
||||
else if (result == 22)
|
||||
{
|
||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
||||
dterate = 75;
|
||||
}
|
||||
else if (result == 23)
|
||||
{
|
||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
||||
dterate = 0x4b0
|
||||
}
|
||||
else if (result == 40)
|
||||
{
|
||||
dcerate = 300;
|
||||
}
|
||||
else if (result == 44)
|
||||
{
|
||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
||||
dcerate = 0x4b0;
|
||||
}
|
||||
else if (result == 45)
|
||||
{
|
||||
printf("TellyScript: Got a CONNECT 75TX/1200RX and I don't know why");
|
||||
dcerate = 0x4b0;
|
||||
}
|
||||
else if (result == 46)
|
||||
{
|
||||
dcerate = 0x4b0;
|
||||
}
|
||||
else if (result == 47)
|
||||
{
|
||||
dcerate = 0x960;
|
||||
}
|
||||
else if (result == 48)
|
||||
{
|
||||
dcerate = 0x12c0;
|
||||
}
|
||||
else if (result == 49)
|
||||
{
|
||||
dcerate = 0x1c20;
|
||||
}
|
||||
else if (result == 50)
|
||||
{
|
||||
dcerate = 0x2580;
|
||||
}
|
||||
else if (result == 51)
|
||||
{
|
||||
dcerate = 0x2ee0;
|
||||
}
|
||||
else if (result == 52)
|
||||
{
|
||||
dcerate = 0x3840;
|
||||
}
|
||||
else if (result == 53)
|
||||
{
|
||||
dcerate = 0x41a0;
|
||||
}
|
||||
else if (result == 54)
|
||||
{
|
||||
dcerate = 0x4b00;
|
||||
}
|
||||
else if (result == 55)
|
||||
{
|
||||
dcerate = 0x5460;
|
||||
}
|
||||
else if (result == 56)
|
||||
{
|
||||
dcerate = 0x5dc0;
|
||||
}
|
||||
else if (result == 57)
|
||||
{
|
||||
dcerate = 0x6720;
|
||||
}
|
||||
else if (result == 58)
|
||||
{
|
||||
dcerate = 0x7080;
|
||||
}
|
||||
else if (result == 59)
|
||||
{
|
||||
dcerate = 0x41a0;
|
||||
}
|
||||
else if (result == 61)
|
||||
{
|
||||
dcerate = 0x5460;
|
||||
}
|
||||
else if (result == 62)
|
||||
{
|
||||
dcerate = 0x5dc0;
|
||||
}
|
||||
else if (result == 63)
|
||||
{
|
||||
dcerate = 0x6720;
|
||||
}
|
||||
else if (result == 64)
|
||||
{
|
||||
dcerate = 0x7080;
|
||||
}
|
||||
else if (result == 66)
|
||||
{
|
||||
compression = 1;
|
||||
}
|
||||
else if (result == 67)
|
||||
{
|
||||
compression = 2;
|
||||
}
|
||||
else if (result == 69)
|
||||
{
|
||||
compression = 0;
|
||||
}
|
||||
else if (result == 76)
|
||||
{
|
||||
protocol = 0;
|
||||
}
|
||||
else if (result == 77)
|
||||
{
|
||||
protocol = 1;
|
||||
}
|
||||
else if (result == 78)
|
||||
{
|
||||
dcerate = 0x79e0;
|
||||
}
|
||||
else if (result == 79)
|
||||
{
|
||||
dcerate = 0x8340;
|
||||
}
|
||||
else if (result == 80)
|
||||
{
|
||||
protocol = 2;
|
||||
}
|
||||
else if (result == 81)
|
||||
{
|
||||
protocol = 3;
|
||||
}
|
||||
else if (result == 84)
|
||||
{
|
||||
dcerate = 0x8340;
|
||||
}
|
||||
else if (result == 91)
|
||||
{
|
||||
dcerate = 0x79e0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("TellyScript: Unknown result code %d", result);
|
||||
retcode = 9;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
winkdtr()
|
||||
{
|
||||
setdtr(0);
|
||||
delay(30);
|
||||
setdtr(1);
|
||||
delay(30);
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int count, i, retries, result;
|
||||
int start = ticks();
|
||||
int end;
|
||||
char *number;
|
||||
char buffer[32];
|
||||
char *settings = getphonesettings();
|
||||
char *accessNumber = &settings[64];
|
||||
char *dialOutsidePrefix = &settings[32];
|
||||
char *callWaitingPrefix = &settings[0];
|
||||
char usePulseDialing = settings[96];
|
||||
char audibleDialing = settings[97];
|
||||
char disableCallWaiting = settings[98];
|
||||
char dialOutsideLine = settings[99];
|
||||
char changedCity = settings[100];
|
||||
char waitForTone = settings[101];
|
||||
char hasCallWaiting = settings[102];
|
||||
char useCallWaitingHack = settings[103];
|
||||
char dialSpeed = settings[104];
|
||||
char numberToDial[32];
|
||||
char dialCommand[80];
|
||||
char *configurationCommand = "ATS38=0S30=180S95=36S11=60&D2V1E0L2&Q5&K3\r";
|
||||
char *defaultNumber = "18006138199";
|
||||
char *nvOverRide = getpreregnumber();
|
||||
char *secret = getsecret();
|
||||
char *serial_number = getserialnumber();
|
||||
char username[32];
|
||||
char password[32];
|
||||
|
||||
printf("TellyScript: 800 Registration Script 3.1-zefie");
|
||||
|
||||
|
||||
|
||||
|
||||
if (nvOverRide != 0)
|
||||
{
|
||||
defaultNumber = nvOverRide;
|
||||
printf("TellyScript: Over-riding default preregistration number with %s from NVRAM", nvOverRide);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (accessNumber[0])
|
||||
strcpy(numberToDial, accessNumber);
|
||||
else
|
||||
strcpy(numberToDial, defaultNumber);
|
||||
|
||||
|
||||
|
||||
strcpy(dialCommand, "ATV0");
|
||||
|
||||
|
||||
|
||||
if (audibleDialing)
|
||||
strcat(dialCommand, "M1");
|
||||
else
|
||||
strcat(dialCommand, "M0");
|
||||
|
||||
|
||||
|
||||
if (waitForTone)
|
||||
strcat(dialCommand, "S6=10X4");
|
||||
else
|
||||
strcat(dialCommand, "S6=4X3");
|
||||
|
||||
|
||||
|
||||
strcat(dialCommand, "S10=14");
|
||||
|
||||
|
||||
|
||||
if (dialSpeed == 0)
|
||||
strcat(dialCommand, "S11=200");
|
||||
else if (dialSpeed == 1)
|
||||
strcat(dialCommand, "S11=110");
|
||||
else if (dialSpeed == 2)
|
||||
strcat(dialCommand, "S11=60");
|
||||
else if (dialSpeed == 3)
|
||||
strcat(dialCommand, "S11=1");
|
||||
|
||||
|
||||
|
||||
if (usePulseDialing)
|
||||
strcat(dialCommand, "DP");
|
||||
else
|
||||
strcat(dialCommand, "DT");
|
||||
|
||||
|
||||
|
||||
if (disableCallWaiting)
|
||||
{
|
||||
strcat(dialCommand, callWaitingPrefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (dialOutsideLine)
|
||||
{
|
||||
strcat(dialCommand, dialOutsidePrefix);
|
||||
strcat(dialCommand, ",");
|
||||
}
|
||||
|
||||
|
||||
|
||||
setwindowsize(3);
|
||||
printf("TellyScript: TCP Window Size set to 3 (USR).");
|
||||
|
||||
enablemodem();
|
||||
|
||||
winkdtr();
|
||||
setflowcontrol(3);
|
||||
setbaud(0xe100);
|
||||
|
||||
setstatus(6);
|
||||
retries = 0;
|
||||
while (retries++ <= 2)
|
||||
{
|
||||
flush();
|
||||
|
||||
sendstr(configurationCommand);
|
||||
if (waitfor("OK", 2, 120))
|
||||
{
|
||||
printf("TellyScript: Configured modem.");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("TellyScript: TIMEOUT waiting for OK");
|
||||
winkdtr();
|
||||
}
|
||||
}
|
||||
|
||||
if (retries > 3)
|
||||
{
|
||||
printf("TellyScript: Couldn't get OK from modem");
|
||||
setdtr(0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
setstatus(3);
|
||||
|
||||
printf("TellyScript: Overriding exclusion circuit...");
|
||||
setforcehook(1);
|
||||
|
||||
printf("TellyScript: Dialing %s...", numberToDial);
|
||||
if ((numberToDial[0] != 65) && (numberToDial[0] != 97))
|
||||
sendstr(dialCommand);
|
||||
sendstr(numberToDial);
|
||||
|
||||
sendstr(";\r");
|
||||
|
||||
flush();
|
||||
|
||||
i = 0;
|
||||
while (i++ < 4)
|
||||
{
|
||||
count = getline(buffer, 31, 0xe10);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
printf("TellyScript: TIMEOUT waiting for dial result.");
|
||||
setdtr(0);
|
||||
return 4;
|
||||
}
|
||||
|
||||
result = parseResult(atoi(buffer));
|
||||
if ((result == 0) && (i == 1))
|
||||
{
|
||||
setstatus(7);
|
||||
sendstr("ATD\r");
|
||||
}
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
setdtr(0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
printf("TellyScript: Setting NameServers: 10.0.0.50, 8.8.8.8");
|
||||
setnameservice(0xa000032, 0x8080808);
|
||||
|
||||
printf("TellyScript: dterate = %d, dcerate = %d, protocol = %d, compression = %d",
|
||||
dterate, dcerate, protocol, compression);
|
||||
setconnectionstats(dterate, dcerate, protocol, compression);
|
||||
setstatus(2);
|
||||
|
||||
sprintf(username, "wtv_%s", serial_number);
|
||||
sprintf(password, "%d", computefcs(serial_number));
|
||||
|
||||
printf("TellyScript: Using '%s' for username", username);
|
||||
printf("TellyScript: Using '%s' for password", password);
|
||||
|
||||
setusername(username);
|
||||
setpassword(password);
|
||||
setnameservice(0xa000032, 0x8080808);
|
||||
setpapmode(1);
|
||||
setstatus(5);
|
||||
|
||||
if (!startppp())
|
||||
{
|
||||
setdtr(0);
|
||||
if (getpppresult() == 3)
|
||||
{
|
||||
printf("TellyScript: PAP authentification failure");
|
||||
return 10;
|
||||
}
|
||||
|
||||
printf("TellyScript: PPP negotiation failed");
|
||||
return 8;
|
||||
}
|
||||
|
||||
printf("TellyScript: Link connected.");
|
||||
setstatus(1);
|
||||
|
||||
printf("TellyScript: total time = %d (seconds)", (ticks() - start) / 60);
|
||||
|
||||
return 2;
|
||||
}
|
||||
@@ -39,6 +39,7 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
}
|
||||
|
||||
// if relogin and wtv-script-id != 0, skip tellyscript
|
||||
ssid_sessions[socket.ssid].set("wtv-open-access", (request_headers['wtv-open-access'] == "true") ? true : false);
|
||||
var file_path = null;
|
||||
var bf0app_update = false;
|
||||
var romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
@@ -57,40 +58,32 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
}
|
||||
|
||||
switch (romtype) {
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OISP_5555732_56k.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/lc2_production_normal.tok";
|
||||
break;
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
case "US-LC2-disk-0MB-8MB-softmodem-CPU5230":
|
||||
case "US-BPS-flashdisk-0MB-8MB-softmodem-CPU5230":
|
||||
case "US-LC2-flashdisk-0MB-16MB-softmodem-CPU5230":
|
||||
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_OpenISP_56k.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/LC2/LC2_WTV_18006138199.tok";
|
||||
break;
|
||||
|
||||
case "US-LC2-disk-0MB-8MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/DERBY/derby_production_normal.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/DERBY/derby_production_normal.tok";
|
||||
break;
|
||||
case "bf0app":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_OISP.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
break;
|
||||
|
||||
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/WEBSTAR/dishplayer_production_normal.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/WEBSTAR/dishplayer_production_normal.tok";
|
||||
break;
|
||||
// the following are not yet zefie generated and may have an unknown username/password attached
|
||||
|
||||
case "JP-Fiji":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/DC/dc_production_normal.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/DC/dc_production_normal.tok";
|
||||
break;
|
||||
|
||||
case "bf0app":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access") == "true") var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/BF0APP/bf0app_production_braindead.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/BF0APP/bf0app_production_braindead.tok";
|
||||
break;
|
||||
case "JP-Fiji":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (ssid_sessions[socket.ssid].get("wtv-open-access")) var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/FIJI/dc_production_normal.tok";
|
||||
else var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/FIJI/dc_production_normal.tok";
|
||||
break;
|
||||
|
||||
default:
|
||||
data = '';
|
||||
@@ -98,11 +91,12 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!request_headers['wtv-client-rom-type'] && bootrom == "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
prereg_contype = "text/tellyscript";
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/BF0APP/bf0app_boot_uncompressed.tok";
|
||||
var file_path = __dirname + "/ServiceDeps/premade_tellyscripts/bf0app/bf0app_WTV_18006138199.tok";
|
||||
var bf0app_update = true;
|
||||
ssid_sessions[socket.ssid].set("bf0app_update", bf0app_update);
|
||||
}
|
||||
@@ -111,6 +105,9 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
gourl = "wtv-head-waiter:/login-stage-two?relogin=true";
|
||||
}
|
||||
|
||||
|
||||
if (!file_path != null && !zquiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
|
||||
headers = "200 OK\n"
|
||||
if (bf0app_update) headers += "minisrv-use-carriage-return: false\n";
|
||||
headers += "Connection: Keep-Alive\n";
|
||||
@@ -129,7 +126,7 @@ if (ssid_sessions[socket.ssid].data_store.wtvsec_login) {
|
||||
if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n";
|
||||
else headers += "wtv-boot-url: wtv-1800:/preregister?relogin=true\n";
|
||||
headers += "wtv-visit: " + gourl + "\n";
|
||||
if (!bf0app_update) headers += "wtv-open-isp-disabled: false\n";
|
||||
if (!bf0app_update && ssid_sessions[socket.ssid].get("wtv-open-access")) headers += "wtv-open-isp-disabled: false\n";
|
||||
headers += "wtv-client-time-zone: GMT -0000\n";
|
||||
headers += "wtv-client-time-dst-rule: GMT\n"
|
||||
headers += "wtv-client-date: " + strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + " GMT";
|
||||
|
||||
6
zefie_wtvp_minisrv/ServiceVault/wtv-cookie/list.js
Normal file
6
zefie_wtvp_minisrv/ServiceVault/wtv-cookie/list.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
headers =`200 OK
|
||||
Connection: Keep-Alive
|
||||
Content-type: text/plain`
|
||||
|
||||
data=`.passporttest.com/ppsecure.passporttest.com/`
|
||||
@@ -4,6 +4,8 @@ wtv-expire-all: wtv-home:/splash
|
||||
wtv-expire-all: wtv-flashrom:
|
||||
Content-type: text/html`
|
||||
|
||||
if (request_headers.query.url) headers += "\nwtv-visit: " + unescape(request_headers.query.url);
|
||||
|
||||
if (ssid_sessions[socket.ssid].get('box-does-psuedo-encryption')) {
|
||||
var cryptstatus = "<a href='client:showalert?message=Your%20WebTV%20Unit%20sent%20us%20a%20request%20for%20SECURE%20ON%2C%20but%20did%20not%20encrypt%20any%20data%2C%20nor%20will%20accept%20it.%20However%2C%20we%20send%20the%20wtv-encryption%20flag%20to%20roll%20with%20it%2C%20enabling%20%27psuedo-encryption%27.%20Nothing%20is%20encrypted%2C%20but%20the%20box%20trusts%20us.%20This%20will%20probably%20go%20away%20if%20you%20reload%20or%20change%20pages.&buttonaction1=client:donothing&buttonlabel1=Oh%2C%20okay...'>Psuedo-encrypted</a>";
|
||||
} else {
|
||||
|
||||
@@ -128,7 +128,11 @@ class WTVClientCapabilities {
|
||||
var bitfield_result = (bitfield[k] == "1")
|
||||
|
||||
// set flags based on position of bit
|
||||
add(capabilities_table[k][0], bitfield_result);
|
||||
try {
|
||||
add(capabilities_table[k][0], bitfield_result);
|
||||
} catch (ex) {
|
||||
console.error(" * Unknown configuration bit", k);
|
||||
}
|
||||
});
|
||||
|
||||
this.capabilities = capabilities;
|
||||
|
||||
@@ -1225,7 +1225,7 @@ Object.keys(minisrv_config.services).forEach(function (k) {
|
||||
}
|
||||
// minisrv_config service toString
|
||||
minisrv_config.services[k].toString = function (overrides) {
|
||||
var self = this;
|
||||
var self = Object.assign({}, this);
|
||||
if (overrides != null) {
|
||||
if (typeof (overrides) == 'object') {
|
||||
Object.keys(overrides).forEach(function (k) {
|
||||
@@ -1242,7 +1242,6 @@ Object.keys(minisrv_config.services).forEach(function (k) {
|
||||
outstr += "\nwtv-service: name=wtv-* host=" + self.host + " port=" + self.port;
|
||||
if (self.flags) outstr += " flags=" + self.flags;
|
||||
if (self.connections) outstr += " connections=" + self.connections;
|
||||
if (self['no_star_word']) delete self['no_star_word'];
|
||||
}
|
||||
return outstr;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,10 @@
|
||||
"port": 1630,
|
||||
"connections": 3
|
||||
},
|
||||
"wtv-cookie": {
|
||||
"port": 1619,
|
||||
"connections": 1
|
||||
},
|
||||
"http": {
|
||||
"port": 1650,
|
||||
"connections": 3,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zefie_wtvp_minisrv",
|
||||
"version": "0.9.9",
|
||||
"version": "0.9.10",
|
||||
"description": "WebTV Service (WTVP) Emulation Server",
|
||||
"main": "app.js",
|
||||
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv",
|
||||
|
||||
Reference in New Issue
Block a user