Code: Select all
# Vars:
# AdminPassword (User request)
# CommentAdminPassword (Derived from AdminPassword)
# WebDomain (Derived from appliance system settings)
# DomainName (User request)
# DomainNameForURI (Derived from DomainName)
# HotSpotName (User request)
# HotSpotNameForURI (Derived from HotSpotName)
# HotSpotDNSName (Derived from HotSpotName) Hot spot dns name derived from HotSpotName without alphanumeric chars + .hotspot (Ex. myhsnetwork.hotspot)
# RadiusPassword (Derived from /etc/raddb/clients.conf secret)
# RadiusTimeout (Derived from HsOptions)
# SSID (User request)
# WanInterface (Wan interface: ether1; wlan2)
# WanInterfaceOrVLAN (Wan interface or vlan: ether1; wlan2; vlan)
# CommentLAN (Derived from LanUseDHCP. Enable/Disable IP settings)
# CommentLANDHCP (Derived from LanUseDHCP. Enable/Disable DHCP)
# LanIPAddress (User request)
# LanNetMask (User request)
# LanNetwork (Derived from 192.168.1.10 and 255.255.255.0. Ex: 192.168.1.10=192.168.0.201 and 255.255.255.0=255.255.255.0 =192.168.0.0)
# LanGatewayIP (User request)
# CommentVLAN (Values: #; Null. If VLAN is disabled, set value = #)
# VLANId (VLan ID)
# HotSpotIPAddress (User request)
# HotSpotNetMask (User request)
# HotSpotNetwork (Derived from and . Ex: =10.10.10.1 and =255.255.255.0 =10.10.10.0)
# HotSpotNetworkPrefix (Derived from . Ex: =255.255.255.0 0=24)
# DNSIPAddress (User request)
# ApplianceIP (Derived resolving appliance url)
# UsersPoolFromIP (User request)
# UsersPoolToIP (User request)
# LogDisabled (User request. Values: yes; no. Enable syslog)
# CommentWireless (User request. Disable wireless)
# HotSpotInterface (Values: wlan1; ether2. If = "" set wlan1 else ether2)
# CommentBridgeEth2 (Values: #; Null. If wireless is disabled Or wireless is enabled and Add Eth2 to hot spot bridge is enabled, set value = #)
# WalledGardenApplianceURL (Appliance url for walled garden with *.domain.extension or IP address)
# PPTPEnabled (User request. Enable VPN)
# CommentPPTP (Derived from PPTPEnabled. Enable/Disable PPTP)
# PPTPServer (User request. Server name PPTP)
# PPTPServerIP (Derived from PPTPServer)
# PPTPUserName (User request. UserName for PPTP)
# PPTPPassword (User request. Password for PPTP)
# CommentPPTPIfIP (Derived from PPTPServer or PPTPEnabled)
# CommentStaticDNS (Derived from HotSpotInLan setting)
# CommentStaticDNS0 (Derived from WebDomain and HotSpotInLan setting)
# CommentStaticDNS1 (Derived from RoundRobin1 and HotSpotInLan settings)
# CommentStaticDNS2 (Derived from RoundRobin2 and HotSpotInLan settings)
# WebDomainWalledGarden (Derived from appliance system settings and port redirecting)
# WalledGardenUpdateMins (User request. WalledGardenUpdateMins setting)
# CommentWalledGardenIP (Enable or disable walled garden IP. Used only if a port is defined and <> 80)
# TimeZone (Derived from appliance system settings)
# NTPServer1 (Derived from appliance system settings)
# NTPServer2 (Derived from appliance system settings)
# CustomCommands (Custom commands)
# CommentRoundRobin0 (Derived from WebDomain. If WebDomain is a domain is empty, if an IP address set #)
# CommentRoundRobin1 (Derived from RoundRobinDomain1. If RoundRobinDomain1 Or RoundRobinIP1 is empty, set #)
# CommentRoundRobin2 (Derived from RoundRobinDomain2. If RoundRobinDomain2 Or RoundRobinIP2 is empty, set #)
# RoundRobinDomain1 (Derived from appliance system settings)
# RoundRobinIP1 (Derived from appliance system settings)
# RoundRobinDomain2 (Derived from appliance system settings)
# RoundRobinIP2 (Derived from appliance system settings)
# CountryCode (Derived from appliance system settings)
# Country (Derived from appliance system settings)
#
delay 15s;
/interface wireless
set 0 antenna-gain=2 channel-width=20mhz country=italy \
default-authentication=yes default-client-tx-limit=0 default-forwarding=\
no disable-running-check=no disabled=no frequency=2452 \
frequency-mode=manual-txpower frequency-offset=0 hide-ssid=no \
max-station-count=2007 mode=ap-bridge mtu=1500 name=wlan1 \
radio-name="Hotspot" security-profile=default ssid="" \
tx-power-mode=default band=2ghz-b/g wireless-protocol=802.11
/interface bridge add name=hs-bridge
/interface bridge port add interface=wlan1 bridge=hs-bridge
#/interface bridge port add interface=ether2 bridge=hs-bridge
#/interface vlan add vlan-id= name=vlan interface=ether1
#/interface pptp-client add connect-to=%PPTPServerIP% user=%PPTPUserName% password=%PPTPPassword% profile=default-encryption disabled=no
/ip hotspot profile
add dns-name="" hotspot-address= html-directory=hotspot http-proxy=\
0.0.0.0:0 login-by=http-pap,https,http-chap name=hsprof1 nas-port-type=wireless-802.11 \
radius-accounting=yes radius-default-domain="" radius-interim-update=\
received radius-location-id="" radius-location-name="" radius-mac-format=\
XX:XX:XX:XX:XX:XX rate-limit="" smtp-server=0.0.0.0 split-user-domain=no \
use-radius=yes
/ip pool
add name=HotSpotIP ranges=-
/ip dhcp-server
add address-pool=HotSpotIP authoritative=after-2sec-delay bootp-support=\
static disabled=no interface=hs-bridge lease-time=1h name=HotSpotDHCP
/ip hotspot
add disabled=no address-pool=HotSpotIP idle-timeout=5m interface=hs-bridge keepalive-timeout=10s name=\
"Hotspot" profile=hsprof1
/ip hotspot user profile
set default idle-timeout=none keepalive-timeout=none name=default shared-users=\
unlimited status-autorefresh=1m transparent-proxy=no
/snmp
set contact="" enabled=no engine-id="" location="" trap-version=1
/snmp community
set public address=0.0.0.0/0 authentication-password="" \
authentication-protocol=MD5 encryption-password="" encryption-protocol=\
DES name=public read-access=yes security=none write-access=no
/system logging action
set memory memory-lines=100 memory-stop-on-full=no name=memory target=memory
set disk disk-file-count=2 disk-file-name=log disk-lines-per-file=100 \
disk-stop-on-full=no name=disk target=disk
set echo name=echo remember=yes target=echo
set remote bsd-syslog=no name=remote remote=192.168.1.244 remote-port=1514 \
src-address=0.0.0.0 syslog-facility=daemon syslog-severity=auto target=\
remote
/ip address
add address= netmask= disabled=no interface=hs-bridge network=
add address=192.168.1.10 netmask=255.255.255.0 disabled=no interface=ether1 network=192.168.1.0
#/ip dhcp-client
#add default-route-distance=0 disabled=no interface=ether1
/ip dhcp-server config
set store-leases-disk=5m
/ip dhcp-server network
add address=/0 comment="hotspot network" gateway= dns-server=8.8.8.8
/ip dns
set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB \
max-udp-packet-size=512 servers=8.8.8.8
#/ip dns static
##add address=192.168.1.244 disabled=no name=192.168.1.244 ttl=1d comment="appliance"
##add address= disabled=no name= ttl=1d comment="appliance"
##add address= disabled=no name= ttl=1d comment="appliance"
/ip firewall connection tracking
set enabled=yes
/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
/ip firewall mangle
add action=log chain=forward disabled=yes log-prefix="Hotspot" protocol=tcp \
tcp-flags=!,ack
add action=log chain=forward disabled=yes log-prefix="Hotspot" protocol=udp
/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
disabled=no src-address=/0
/ip firewall service-port
set ftp disabled=no ports=21
set tftp disabled=no ports=69
set irc disabled=no ports=6667
set h323 disabled=no
set sip disabled=no ports=5060,5061 sip-direct-media=yes
set pptp disabled=no
/ip hotspot service-port
set ftp disabled=no ports=21
/ip hotspot walled-garden
add action=allow disabled=no dst-host=*.paypal.com
add action=allow disabled=no dst-host=*.paypalobjects.com
add action=allow disabled=no dst-host=paypal.112.2O7.net
add action=allow disabled=no dst-host=":^www\\.paypal\\.com\$" dst-port=443
add action=allow disabled=no dst-host=":^content\\.paypalobjects\\.com\$" dst-port=443
add action=allow disabled=no dst-host=*.mediaplex.com
add action=allow disabled=no dst-host=*akamai*
add dst-host=192.168.1.244 path=!/ action=allow disabled=no
add dst-host=192.168.1.244 path=!/ action=allow disabled=no
#add dst-host= path=!/ action=allow disabled=no
#add dst-host= path=!/ action=allow disabled=no
#add dst-host= path=!/ action=allow disabled=no
#add dst-host= path=!/ action=allow disabled=no
#/ip hotspot walled-garden ip
#add action=accept disabled=no dst-host=192.168.1.244 protocol=tcp
#add action=accept disabled=no dst-address=192.168.1.244 protocol=tcp
/ip proxy
set always-from-cache=no cache-administrator=webmaster cache-hit-dscp=4 \
cache-on-disk=no enabled=no max-cache-size=none max-client-connections=\
600 max-fresh-time=3d max-server-connections=600 parent-proxy=0.0.0.0 \
parent-proxy-port=0 port=8080 serialize-connections=no src-address=\
0.0.0.0
/ip route
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.1.1 scope=30 \
target-scope=10
/ip service
set telnet disabled=no port=23
set ftp disabled=no port=21
set www disabled=yes port=80
set ssh disabled=yes port=22
set www-ssl certificate=none disabled=yes port=443
set api disabled=yes port=8728
set winbox disabled=no port=8291
/radius
add accounting-backup=no accounting-port=1813 address=192.168.1.244 \
authentication-port=1812 called-id="" disabled=no domain="" realm="" \
secret=paperino service=hotspot timeout=5000ms
#add accounting-backup=no accounting-port=1813 address= \
# authentication-port=1812 called-id="" disabled=no domain="" realm="" \
# secret=paperino service=hotspot timeout=5000ms
#add accounting-backup=no accounting-port=1813 address= \
# authentication-port=1812 called-id="" disabled=no domain="" realm="" \
# secret=paperino service=hotspot timeout=5000ms
/radius incoming
set accept=no port=3799
/system identity
set name="Hotspot"
/system logging
add action=memory disabled=no prefix="Hotspot" topics=info,!firewall
add action=remote disabled=no prefix="Hotspot" topics=hotspot
add action=remote disabled=no prefix="Hotspot" topics=firewall
/system clock
set time-zone-name=Africa/Gaborone
/system ntp client
set enabled=yes primary-ntp=132.163.4.102 secondary-ntp=\
173.255.246.13
/system scheduler
add interval=10s name=dynIP on-event=ipResolve policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-time=startup
add disabled=no interval=1m name=ImportWalledGarden on-event=WalledGarden \
policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-time=startup
add disabled=no interval=15s name=PaypalResolve on-event=PaypalResolve policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-time=startup
add interval=5m name=DownloadHTMLPages on-event=DownloadHTMLPages policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-time=startup
add disabled=no interval=9m name=HotspotUpgConf on-event=HotspotUpgConf \
policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-time=startup
add disabled=yes interval=30s name=AddWiFiUsrMACToHSNM on-event=AddWiFiUsrMACToHSNM \
policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
start-time=startup
add disabled=no interval=1m name=TicketPrinterImport on-event=\
TicketPrinterImport policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive start-time=\
startup
###### Admin Password
#:log info "Creating admin password";
#/user set admin password="%AdminPassword%"
###### System note
/system note
set show-at-login=yes note="ANY ATTEMPT WILL BE REGARDED AS MALICIOUS IN INTENT AND WILL BE PURSURED ACCORDING TO THE LAW!"
/system script
# Vars:
# CommentPPTPIfIP (Derived from PPTPServer or PPTPEnabled)
# PPTPServer (User request. Server name PPTP)
# CommentPPTPIfIP (Derived from PPTPServer or PPTPEnabled)
# Path (Derived from gateway hardwate type settings)
# DomainNameForURI (Derived from DomainName)
# HotSpotNameForURI (Derived from HotSpotName)
add name=ipResolve policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive \
source="#:local SERVERPPTP [resolve %PPTPServer%]\r\
\n\r\
\n#:if ([/interface pptp-client get 0 connect-to] != \$SERVERPPTP) do={\r\
\n# /interface pptp-client set 0 connect-to=\$SERVERPPTP \r\
\n# :log info \"Updated ip server pptp: \$SERVERPPTP\"\r\
\n#}"
add name=WalledGarden policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive \
source=":local URL;\r\
\n:local continue true;\r\
\n\r\
\n:local content [/file get \"hotspot/roundrobindomains.txt\" contents];\r\
\n:local RoundRobinHost [:toarray \$content];\r\
\n:local NumRoundRobinHost;\r\
\n:local counter 0;\r\
\n\r\
\n:while (\$continue) do={\r\
\n :set URL [:pick \$RoundRobinHost \$counter];\r\
\n :do {\r\
\n :set continue false;\r\
\n :log info \"Check if is a right appliance or not...\";\r\
\n /tool fetch url=\"http://\$URL/functions/checkidentity.php\" ds\
t-path=\"hotspot/checkidentity.txt\" mode=http;\r\
\n :local checkidentity [/file get \"hotspot/checkidentity.txt\" c\
ontents];\r\
\n :if (\$checkidentity = \"yes\") do={\r\
\n :log info \"YES, is answering a right appliance so...\"\r\
\n :log info \"Download walled-garden from \$URL started\";\r\
\n /tool fetch url=\"http://\$URL/functions/walledgarden.php\\\?do\
main=Gaborone&hotspotname=Hotspot\" dst-path=\"w\
alled-garden.rsc\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/walledgardenpaypalip.php\\\?do\
main=Gaborone&hotspotname=Hotspot\" dst-path=\"w\
alled-garden-paypalip.rsc\" mode=http;\r\
\n :log info \"Download walled-garden finished, now starting impor\
t...\"; \r\
\n }\r\
\n } on-error={\r\
\n :log info \"\$URL doesn't respond\";\r\
\n :set continue true;\r\
\n }\r\
\n :set counter (\$counter + 1);\r\
\n :if ((\$counter=[:len \$RoundRobinHost]) || ([:len \$RoundRobinHos\
t]=0)) do={\r\
\n :set continue false;\r\
\n }\r\
\n}\r\
\nip hotspot walled-garden remove numbers=[/ip hotspot walled-garden find]\
;\r\
\nimport file-name=walled-garden.rsc;\r\
\n:log info \"Import walled-garden finished\";"
add name=PaypalResolve policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\
"import file-name=walled-garden-paypalip.rsc;"
add name=DownloadHTMLPages policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive \
source=":local URL;\r\
\n:local continue true;\r\
\n\r\
\n:local content [/file get \"hotspot/roundrobindomains.txt\" contents];\r\
\n:local RoundRobinHost [:toarray \$content];\r\
\n:local NumRoundRobinHost;\r\
\n:local counter 0;\r\
\n\r\
\n:while (\$continue) do={\r\
\n :set URL [:pick \$RoundRobinHost \$counter];\r\
\n :do {\r\
\n :set continue false;\r\
\n :log info \"Check if is a right appliance or not...\";\r\
\n /tool fetch url=\"http://\$URL/functions/checkidentity.php\" ds\
t-path=\"hotspot/checkidentity.txt\" mode=http;\r\
\n :local checkidentity [/file get \"hotspot/checkidentity.txt\" c\
ontents];\r\
\n :if (\$checkidentity = \"yes\") do={\r\
\n :log info \"YES, is answering a right appliance so...\"\r\
\n :log info \"Download file with round robin domains from \$URL s\
tarted\";\r\
\n /tool fetch url=\"http://\$URL/functions/getroundrobindomains.p\
hp\\\?domain=Gaborone&hotspotname=Hotspot\" \
dst-path=\"hotspot/roundrobindomains.txt\" mode=http;\r\
\n :log info \"Download file with round robin domains finished\";\
\r\
\n :local check [/file get \"hotspot/roundrobindomains.txt\" conte\
nts];\r\
\n :if ((\$check=\"\") || (\$check=\" \")) do={\r\
\n :log info \"The downloaded file roundrobindomains.txt is emp\
ty. Re-setting the old value into the file... \";\r\
\n /file set hotspot/roundrobindomains.txt contents=\"\$content\
\";\r\
\n } \r\
\n :log info \"Download HTML file from \$URL started\";\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=login\" dst-path=\"hots\
pot/login.html\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=alogin\" dst-path=\"hots\
pot/alogin.html\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=radvert\" dst-path=\"ho\
tspot/radvert.html\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=statushtml\" dst-path=\"ho\
tspot/status.html\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=statusjs\" dst-path=\"ho\
tspot/appjs.js\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=statuscss\" dst-path=\"ho\
tspot/style.css\" mode=http;\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotpages.php\\\
\?domain=Gaborone&hotspotname=Hotspot&page=logouthtml\" dst-path=\"ho\
tspot/logout.htm\" mode=http;\r\
\n :log info \"Download HTML file finished...\";\r\
\n :log info \"Download Radius IP from \$URL started\";\r\
\n /tool fetch url=\"http://\$URL/functions/getradiusip.php\\\?dom\
ain=Gaborone&hotspotname=Hotspot\" dst-path=radiusip.rsc mode=http\
;\r\
\n :log info \"Download Radius IP from \$URL finished\";\r\
\n }\r\
\n } on-error={\r\
\n :log info \"\$URL doesn't respond\";\r\
\n :set continue true;\r\
\n }\r\
\n :set counter (\$counter + 1);\r\
\n :if ((\$counter=[:len \$RoundRobinHost]) || ([:len \$RoundRobinHos\
t]=0)) do={\r\
\n :set continue false;\r\
\n }\r\
\n}\r\
\nimport file-name=radiusip.rsc;\r\
\n:log info \"Import radius finished\";"
add name=HotspotUpgConf policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive \
source=":local URL;\r\
\n:local continue true;\r\
\n:local content [/file get \"hotspot/roundrobindomains.txt\" contents];\r\
\n:local RoundRobinHost [:toarray \$content];\r\
\n:local counter 0;\r\
\n\r\
\n:while (\$continue) do={\r\
\n :set URL [:pick \$RoundRobinHost \$counter];\r\
\n :do {\r\
\n :set continue false;\r\
\n :log info \"Check if is a right appliance or not...\";\r\
\n /tool fetch url=\"http://\$URL/functions/checkidentity.php\" ds\
t-path=\"hotspot/checkidentity.txt\" mode=http;\r\
\n :local checkidentity [/file get \"hotspot/checkidentity.txt\" c\
ontents];\r\
\n :if (\$checkidentity = \"yes\") do={\r\
\n :log info \"YES, is answering a right appliance so...\"\r\
\n :log info \"Download file for check if hotspot is to reconfigur\
e or not...\";\r\
\n /tool fetch url=\"http://\$URL/functions/hotspotupdatable.php\\\
\?domain=Gaborone&hotspotname=Hotspot\" dst-path=\"hotspo\
t/updatable.txt\" mode=http;\r\
\n delay 2s;\r\
\n :local reconfigure [/file get \"hotspot/updatable.txt\" contents];\r\
\n :if (\$reconfigure = \"yes\") do={\r\
\n :log info \"Download new .rsc file for configure Hotspot...\
\";\r\
\n /tool fetch url=\"http://\$URL/functions/gethotspotconfigfiles.ph\
p\\\?domain=Gaborone&hotspotname=Hotspot&rsc\" \
dst-path=\"ConfigScriptHotSpotRouterOSNew.rsc\" mode=http;\r\
\n delay 2s;\r\
\n :log info \"Hotspot is resetted and reconfigured...\";\r\
\n /system reset-configuration no-default=yes run-after-reset=C\
onfigScriptHotSpotRouterOSNew.rsc\r\
\n }\r\
\n }\r\
\n } on-error={\r\
\n :log info \"\$URL doesn't respond\";\r\
\n :set continue true;\r\
\n }\r\
\n :set counter (\$counter + 1);\r\
\n :if ((\$counter=[:len \$RoundRobinHost]) || ([:len \$RoundRobinHos\
t]=0)) do={\r\
\n :set continue false;\r\
\n }\r\
\n}"
add name=AddWiFiUsrMACToHSNM policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive \
source=":local URL;\r\
\n:local continue true;\r\
\n:local content [/file get \"hotspot/roundrobindomains.txt\" contents];\r\
\n:local RoundRobinHost [:toarray \$content];\r\
\n:local counter 0;\r\
\n:local NumActiveHosts;\r\
\n:local MAC;\r\
\n\r\
\n:while (\$continue) do={\r\
\n :set URL [:pick \$RoundRobinHost \$counter];\r\
\n :do {\r\
\n :set continue false;\r\
\n :set NumActiveHosts [/ip hotspot host pri\
nt count-only];\r\
\n :local x 0;\r\
\n :if (\$NumActiveHosts != 0) do={\r\
\n :while (\$x < \$NumActiveHosts) do={\r\
\n /ip hotspot host print;\r\
\n :set MAC (\$MAC,[/ip hotspot host g\
et value-name=mac-address number=\$x]);\r\
\n# :log info \$MAC;\r\
\n :set x (\$x + 1);\r\
\n }\r\
\n /tool fetch url=\"http://\$URL/functions/wificonnection.php\\\?\
domain=Gaborone&hotspotname=Hotspot&mac=\$MAC\" mode=http\
;\r\
\n }\r\
\n } on-error={\r\
\n :log info \"\$URL doesn't respond\";\r\
\n :set continue true;\r\
\n }\r\
\n :set counter (\$counter + 1);\r\
\n :if ((\$counter=[:len \$RoundRobinHost]) || ([:len \$RoundRobinHost]\
=0)) do={\r\
\n :set continue false;\r\
\n }\r\
\n}"
add name=TicketPrinterImport policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive source=":local \
URL;\r\
\n:local continue true;\r\
\n\r\
\n:local content [/file get \"hotspot/roundrobindomains.txt\" contents];\r\
\n:local RoundRobinHost [:toarray \$content];\r\
\n:local NumRoundRobinHost;\r\
\n:local counter 0;\r\
\n\r\
\n:local username;\r\
\n:local password;\r\
\n:local profile;\r\
\n\r\
\n:if (([/ip hotspot user find] != \"\") || ([/tool user-manager user fin\
d] != \"\")) do={ \r\
\n:while (\$continue) do={\r\
\n :set URL [:pick \$RoundRobinHost \$counter];\r\
\n :do {\r\
\n :set continue false;\r\
\n :log info \"Check if is a right appliance or not...\";\r\
\n /tool fetch url=\"http://\$URL/functions/checkidentity.php\" ds\
t-path=\"hotspot/checkidentity.txt\" mode=http;\r\
\n :local checkidentity [/file get \"hotspot/checkidentity.txt\" c\
ontents];\r\
\n :if (\$checkidentity = \"yes\") do={\r\
\n :log info \"YES, is answering a right appliance so...\"\r\
\n /tool fetch url=\"http://\$URL/functions/importmikrotikusersenab\
led.php\?domainname=Gaborone&hotspotname=Hotspot\" dst-path=\
\"hotspot/userexportenabled.txt\" mode=http;\r\
\n :local export [/file get \"hotspot/userexportenabled.txt\" conte\
nts];\r\
\n :if (\$export = \"1\") do={ \r\
\n :foreach i in [/ip hotspot user find] do={\r\
\n :set username [ip hotspot user get \$i name];\r\
\n :set password [ip hotspot user get \$i password];\r\
\n :set profile [ip hotspot user get \$i profile];\r\
\n /tool fetch url=\"http://\$URL/functions/importmikrotikuse\
rs.php\?domainname=Gaborone&profile=\$profile&username=\$username&passw\
ord=\$password\" mode=http;\r\
\n :log info \"Exported user \$username da HotSpot User\";\r\
\n /ip hotspot user remove \$i\r\
\n }\r\
\n :if ([/system package find name=user-manager disabled=no] = \"\
\") do={ \r\
\n :log info \"User Manager IS DISABLE OR NOT INSTALLED . Can\
not export users from User Manager\";\r\
\n } else={\r\
\n :foreach i in [/tool user-manager user find] do={\r\
\n :set username [/tool user-manager user get \$i username\
];\r\
\n :set password [/tool user-manager user get \$i password\
];\r\
\n :set profile [/tool user-manager user get \$i actual-pr\
ofile];\r\
\n /tool fetch url=\"http://\$URL/functions/importmikrotikuse\
rs.php\?domainname=Gaborone&profile=\$profile&username=\$username&passw\
ord=\$password\" mode=http;\r\
\n :log info \"Exported user \$username da User Manager\";\
\r\
\n /tool user-manager user remove \$i\r\
\n }\r\
\n }\r\
\n }\r\
\n }\r\
\n } on-error={\r\
\n :log info \"\$URL doesn't respond\";\r\
\n :set continue true;\r\
\n }\r\
\n :set counter (\$counter + 1);\r\
\n :if ((\$counter=[:len \$RoundRobinHost]) || ([:len \$RoundRobinHos\
t]=0)) do={\r\
\n :set continue false;\r\
\n }\r\
\n}\r\
\n}"
Users browsing this forum: No registered users and 1 guest