Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///
- const now = Date.now();
- let Manufacturer = declare("InternetGatewayDevice.DeviceInfo.Manufacturer", { value: now }).value[0];
- let SerialNumber = declare("InternetGatewayDevice.DeviceInfo.SerialNumber", { value: now }).value[0];
- let HardwareVersion = declare("InternetGatewayDevice.DeviceInfo.HardwareVersion", { value: now }).value[0];
- let SoftwareVersion = declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", { value: now }).value[0];
- let ExternalIPAddress = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", { value: now }).value[0];
- let Tag_StartFwUpgrade = declare("Tags.StartFwUpgrade", { value: 1 });
- let Tag_StartFwUpgrade1 = declare("Tags.StartFwUpgrade1", { value: 1 });
- let ActualSoftwareVersion = "1.3.1_1811191345";
- let MatchModelCPE = HardwareVersion.match(/(^CPEMODEL).*/g);
- function FirmwareUpgrade(SerialNumber) {
- declare("Tags.StartFwUpgrade", null, { value: true });
- declare("Downloads.[FileType:1 Firmware Upgrade Image]", { path: 1 }, { path: 1 });
- declare("Downloads.[FileType:1 Firmware Upgrade Image].FileName", { value: 1 }, { value: "firmware.bin" });
- declare("Downloads.[FileType:1 Firmware Upgrade Image].Download", { value: 1 }, { value: now });
- log("(03) Push file : firmware.bin");
- };
- if (SoftwareVersion !== ActualSoftwareVersion && HardwareVersion == MatchModelCPE && SerialNumber == "51:51:82:B0:22:40" && Tag_StartFwUpgrade.value == undefined) {
- log(`Fw need update, current version is ${SoftwareVersion}, actual version is ${ActualSoftwareVersion}, start upgrade`);
- setTimeout(FirmwareUpgrade, 60000);
- }
- if (SoftwareVersion == ActualSoftwareVersion && HardwareVersion == MatchModelCPE && SerialNumber == "51:51:82:B0:22:40" && Tag_StartFwUpgrade1.value !== undefined && Tag_StartFwUpgrade.value !== undefined) {
- log(`Fw current version is ${SoftwareVersion}, finish upgrade | delete tags`);
- declare("Tags.StartFwUpgrade1", null, { value: false });
- declare("Tags.StartFwUpgrade", null, { value: false });
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment