Cek IP Dinamis: Difference between revisions

From AbahDoku Wiki
Created page with ":local dnsName "cctv.bele.net"; :local hotspotHostAddress [/ip hotspot host get [find comment="cctv.bele.net"] address]; :local dnsStaticValue [/ip dns static get [find name="cctv.bele.net"] address]; :local bot "1931317277:AAFRdZ_pexR03lA_MHmwU3_T8RCx80_Sm7s"; :local chatID "1952568357"; :if ($hotspotHostAddress != $dnsStaticValue) do={ /ip dns static set [find name="cctv.bele.net"] address=$hotspotHostAddress :local message "Nilai DNS statis telah diubah menjadi $..."
 
m 8 revisions imported
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
:local dnsName "cctv.bele.net";
==Script untuk 1 DNS==
:local hotspotHostAddress [/ip hotspot host get [find comment="cctv.bele.net"] address];
:local dnsName "nama.dns.net";
:local dnsStaticValue [/ip dns static get [find name="cctv.bele.net"] address];
:local hotspotHostAddress [/ip hotspot ip-binding get [find comment="nama.dns.net"] address];
:local bot "1931317277:AAFRdZ_pexR03lA_MHmwU3_T8RCx80_Sm7s";
:local dnsStaticValue [/ip dns static get [find name="cctv.bele.net"] address];
:local chatID "1952568357";
:local bot "BOOT_TOKEN";
 
:local chatID "CHAT_ID";
:if ($hotspotHostAddress != $dnsStaticValue) do={
:if ($hotspotHostAddress != $dnsStaticValue) do={
   /ip dns static set [find name="cctv.bele.net"] address=$hotspotHostAddress
   /ip dns static set [find name="cctv.bele.net"] address=$hotspotHostAddress
   :local message "Nilai DNS statis telah diubah menjadi $hotspotHostAddress"
   :local message "IP pada DNS statis $dnsName telah berubah menjadi $hotspotHostAddress"
   /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
   /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
} else={
} else={
   :local message "Nilai DNS statis tidak berubah: $hotspotHostAddress"
   :local message "IP DNS statis $dnsName tidak berubah: $hotspotHostAddress"
   /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
   /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
}
}
 
==Script untuk banyak DNS==
:local dnsNames { "mainar.albait.net" ; "ipang.albait.net" ; "dokter.albait.net" ; "pondok.albait.net" ;
  "armbian.albait.net" ; "cctv.albait.net" };
:local bot "1931317277:AAFRdZ_pexR03lA_MHmwU3_T8RCx80_Sm7s";
:local chatID "1952568357";
:foreach dnsName in=$dnsNames do={
  :local hotspotHostAddress [/ip hotspot ip-binding get [find comment=$dnsName] address];
  :local dnsStaticValue [/ip dns static get [find name=$dnsName] address];
  :if ($hotspotHostAddress != $dnsStaticValue) do={
    /ip dns static set [find name=$dnsName] address=$hotspotHostAddress;
    :local message "IP DNS statis $dnsName telah berubah dari $dnsStaticValue menjadi $hotspotHostAddress";
    /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep
result=no;
  } else={
    :local message "IP DNS statis $dnsName tidak berubah: $hotspotHostAddress";
    /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-
result=no;
  }
}

Latest revision as of 22:47, 19 November 2024

Script untuk 1 DNS[edit]

:local dnsName "nama.dns.net";
:local hotspotHostAddress [/ip hotspot ip-binding get [find comment="nama.dns.net"] address];
:local dnsStaticValue [/ip dns static get [find name="cctv.bele.net"] address];
:local bot "BOOT_TOKEN";
:local chatID "CHAT_ID";
:if ($hotspotHostAddress != $dnsStaticValue) do={
 /ip dns static set [find name="cctv.bele.net"] address=$hotspotHostAddress
 :local message "IP pada DNS statis $dnsName telah berubah menjadi $hotspotHostAddress"
 /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
} else={
 :local message "IP DNS statis $dnsName tidak berubah: $hotspotHostAddress"
 /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep-result=no
}

Script untuk banyak DNS[edit]

:local dnsNames { "mainar.albait.net" ; "ipang.albait.net" ; "dokter.albait.net" ; "pondok.albait.net" ; 
 "armbian.albait.net" ; "cctv.albait.net" };
:local bot "1931317277:AAFRdZ_pexR03lA_MHmwU3_T8RCx80_Sm7s";
:local chatID "1952568357";
:foreach dnsName in=$dnsNames do={
  :local hotspotHostAddress [/ip hotspot ip-binding get [find comment=$dnsName] address];
  :local dnsStaticValue [/ip dns static get [find name=$dnsName] address];
  :if ($hotspotHostAddress != $dnsStaticValue) do={
    /ip dns static set [find name=$dnsName] address=$hotspotHostAddress;
    :local message "IP DNS statis $dnsName telah berubah dari $dnsStaticValue menjadi $hotspotHostAddress";
    /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep 
result=no;
  } else={
    :local message "IP DNS statis $dnsName tidak berubah: $hotspotHostAddress";
    /tool fetch url=("https://api.telegram.org/bot$bot/sendMessage\?chat_id=$chatID&text=$message") keep- 
result=no;
  }
}