Guest User

Untitled

a guest
Feb 26th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///
  2. const now = Date.now();
  3. let Manufacturer = declare("InternetGatewayDevice.DeviceInfo.Manufacturer", { value: now }).value[0];
  4. let SerialNumber = declare("InternetGatewayDevice.DeviceInfo.SerialNumber", { value: now }).value[0];
  5. let HardwareVersion = declare("InternetGatewayDevice.DeviceInfo.HardwareVersion", { value: now }).value[0];
  6. let SoftwareVersion = declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", { value: now }).value[0];
  7. let ExternalIPAddress = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", { value: now }).value[0];
  8. let Tag_StartFwUpgrade = declare("Tags.StartFwUpgrade", { value: 1 });
  9. let Tag_StartFwUpgrade1 = declare("Tags.StartFwUpgrade1", { value: 1 });
  10. let ActualSoftwareVersion = "1.3.1_1811191345";
  11. let MatchModelCPE = HardwareVersion.match(/(^CPEMODEL).*/g);
  12.  
  13. function FirmwareUpgrade(SerialNumber) {
  14.     declare("Tags.StartFwUpgrade", null, { value: true });
  15.     declare("Downloads.[FileType:1 Firmware Upgrade Image]", { path: 1 }, { path: 1 });
  16.     declare("Downloads.[FileType:1 Firmware Upgrade Image].FileName", { value: 1 }, { value: "firmware.bin" });
  17.     declare("Downloads.[FileType:1 Firmware Upgrade Image].Download", { value: 1 }, { value: now });
  18.     log("(03) Push file : firmware.bin");
  19. };
  20.  
  21. if (SoftwareVersion !== ActualSoftwareVersion && HardwareVersion == MatchModelCPE && SerialNumber == "51:51:82:B0:22:40" && Tag_StartFwUpgrade.value == undefined) {
  22.     log(`Fw need update, current version is ${SoftwareVersion}, actual version is ${ActualSoftwareVersion}, start upgrade`);
  23.     setTimeout(FirmwareUpgrade, 60000);
  24.  
  25. }
  26. if (SoftwareVersion == ActualSoftwareVersion && HardwareVersion == MatchModelCPE && SerialNumber == "51:51:82:B0:22:40" && Tag_StartFwUpgrade1.value !== undefined && Tag_StartFwUpgrade.value !== undefined) {
  27.     log(`Fw current version is ${SoftwareVersion}, finish upgrade | delete tags`);
  28.     declare("Tags.StartFwUpgrade1", null, { value: false });
  29.     declare("Tags.StartFwUpgrade", null, { value: false });
  30.     return;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment