kzyfl 发表于 2011-12-27 01:43:05

求助灰太狼版主的ExpAuto的到期提醒的问题.

本帖最后由 kzyfl 于 2011-12-27 01:48 编辑

用的是灰太狼版主的ExpAuto的脚本,在这里首先对灰太狼版主表示感谢,写出这么好的脚本,现在问题是可以打开提醒页面,可以点击跳过提醒才可以上网,就是正常上网后,还得等重启路由器后才再出现提醒页面,重新断开宽带连接也不行,能不能实现每次连接宽带连接后打开网页都弹出到期页面.该如何修改呀,先谢了,脚本如下:,
/system script
remove
add name=Exp_Auto policy=\
    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
    # \BD\C5\B1\BE\C3\FB\B3\C6: ExpAuto\r\
    \n# \BD\C5\B1\BE\B0\E6\B1\BE: 1.03\r\
    \n# \BD\C5\B1\BE\D7\F7\D5\DF: Mxso\r\
    \n# Email: mxsogm@gmail.com\r\
    \n# QQ/TM: 84046811\r\
    \n# \B0\E6\B1\BE\C8\D5\C6\DA: 2011\C4\EA1\D4\C23\C8\D5\r\
    \n# \CA\CA\D3\C3\CF\B5\CD\B3: (\CA\B5\C0\FD\CE\AA PPPoE\B5\BD\C6\DA Web Pr\
    oxy \B4\ED\CE\F3\D2\B3\C3\E6\CD\A8\D6\AA,\CC\E1\C7\B03\CC\EC\CD\A8\D6\AA\
    \D3\C3\BB\A7,\B5\BD\C6\DA\CD\A3\D6\B9\D3\C3\BB\A7,3.30\B2\E2\CA\D4\CD\A8\
    \B9\FD,\C6\E4\CB\FB\B0\E6\B1\BE\CE\B4\B2\E2\CA\D4)\r\
    \n# \BD\C5\B1\BE\B9\A6\C4\DC: \B6\D4PPP\BC\B0Hotspot\D3\C3\BB\A7\C6\DA\CF\
    \DE\B2\D9\D7\F7;\B4\CB\BD\C5\B1\BE\B5\C4\CA\B5\C0\FD\B6\D4\D3\C3\BB\A7\D7\
    \B4\CC\AC(\BD\FB\D3\C3/\C6\F4\D3\C3)\BD\F8\D0\D0\C9\E8\D6\C3\BC\B0\CC\DE\
    \B3\FD\B5\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B\AB\D2\FD\BA\C5\C0\
    \EF\C3\E6\CE\AA\D7\A2\CA\CD\C4\DA\C8\DD,[]\C0\EF\C3\E6\CE\AA\C8\D5\C6\DA\
    \B0\CB\CE\BB\CA\FD\D7\D6),\r\
    \n# \C0\FD2:\"\C0\EE\CB\C4[+365]\B5\BD\C6\DA\",[+365]\D6\B8\B5\B1\C7\B0\C8\
    \D5\C6\DA\BC\D3365\CC\EC,\D4\DA\CF\C2\B4\CE\B5\F7\D3\C3\BD\C5\B1\BE\CA\B1\
    \D7\A2\CA\CD\BD\AB\D7\D4\B6\AF\B1\E4\CE\AA\"\C0\EE\CB\C4[\B0\CB\CE\BB\B5\
    \B1\C7\B0\C8\D5\C6\DA+365]\B5\BD\C6\DA\",\r\
    \n# \BC\D9\C9\E8\B5\B1\C7\B0\C8\D5\C6\DA\CE\AA2010\C4\EA4\D4\C24\C8\D5\C1\
    \A2\BC\B4\B5\F7\D3\C3\BD\C5\B1\BE\D7\A2\CA\CD\C4\DA\C8\DD\BD\AB\B1\E4\CE\
    \AA\"\C0\EE\CB\C4\B5\BD\C6\DA\",\D2\B2\BE\CD\CA\C72010\C4\EA\
    4\D4\C24\C8\D5\B5\C4365\CC\EC\BA\F3\B5\BD\C6\DA\r\
    \n# \C0\FD3:\D6\A7\B3\D6\C0\DB\BC\D3\D4\CB\CB\E3,\BC\D9\C9\E8[20090501+365\
    ]\BD\AB\BD\FC\B5\BD\C6\DA,\D3\C3\BB\A7\D0\F8\B7\D1\BF\C9\D2\D4\D4\DA\BA\F3\
    \C3\E6\CC\ED\BC\D3+X\CC\EC,\D5\E2\C0\EF\BC\D3180\CC\EC\r\
    \n\r\
    \n#\BB\F1\C8\A1\B9\AB\D4\AA\D6\C1\BD\F1\C8\D5( \$Today \B1\E4\C1\BF\CE\AA\
    \B9\AB\D4\AA\D6\C1\BD\F1\D2\D1\B9\FD\B5\C4\CC\EC\CA\FD)\r\
    \n:local Date ;:local Year ([:pick \$Date 7 11]-1)\
    \r\
    \n:local Month ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:p\
    ick \$Date 0 3]])\r\
    \n:local Day [:pick \$Date 4 6];:if ([:pick \$Date 4 5] = 0) do={:set Day \
    [:pick \$Date 5 6]};:set Day (\$Day-1)\r\
    \n:local leapyear 0,31,59,90,120,151,181,212,243,273,304,334,0,31,60,91,12\
    1,152,182,213,244,274,305,335\r\
    \n:global Today (\$Year*365+\$Year/4);:if ((\$Year-\$Year/4*4) != 3) do={:\
    set Today (\$Today+[:pick \$leapyear \$Month]+\$Day)} else={:set Today (\$\
    Today+[:pick \$leapyear (\$Month+12)]+\$Day)}\r\
    \n:local usname;:local uspfl;:local Ccomment;:local lc;:local rc;:local Ex\
    p;:local js;:local pcl;:local CYear;:local CMonth;:local CDay;:local CToda\
    y\r\
    \n\r\
    \n#\C0\FB\D3\C3\B9\AB\D4\AA\CC\EC\CA\FD\BC\C6\CB\E3\BD\F1\CC\EC\CA\C7\D0\
    \C7\C6\DA\BC\B8,0\B4\FA\B1\ED\D0\C7\C6\DA\C8\D5\r\
    \n:global Week (\$Today-\$Today/7*7)\r\
    \n#:log info (\"\BD\F1\CC\EC\CA\C7\D0\C7\C6\DA\" . \$Week)\r\
    \n\r\
    \n#scheduler\B4\A6\C0\ED\BF\AA\CA\BC\r\
    \n/system scheduler\r\
    \n:foreach i in= do={\r\
    \n:set Ccomment ;:set lc [:find \$Ccomment \"[\"];:set rc\
    \_[:find \$Ccomment \"]\"]\r\
    \n:if ([:typeof \$lc]=\"num\" && [:typeof \$rc]=\"num\" && (\$lc+1+\$Week)\
    <\$rc) do={\r\
    \n:set Exp [:pick \$Ccomment (\$lc+1+\$Week)]\r\
    \n:if (\$Exp=\"e\"||\$Exp=\"E\"||\$Exp=\"1\") do={:if (\
    ) do={enable \$i}}\r\
    \n:if (\$Exp=\"d\"||\$Exp=\"D\"||\$Exp=\"0\") do={:if (![get \$i disabled \
    ]) do={disable \$i}}\r\
    \n}}\r\
    \n#scheduler\B4\A6\C0\ED\BD\E1\CA\F8\r\
    \n\r\
    \n\r\
    \n#PPP\B4\A6\C0\ED\BF\AA\CA\BC\r\
    \n/ppp secret\r\
    \n:foreach i in= do={\r\
    \n:set Ccomment ;:set lc [:find \$Ccomment \"[\"];:set rc\
    \_[:find \$Ccomment \"]\"]\r\
    \n:if ([:typeof \$lc]=\"num\" && [:typeof \$rc]=\"num\" && \$lc<\$rc) do={\
    \r\
    \n:set Exp [:pick \$Ccomment (\$lc+1) \$rc];:set js 0;:set CToday 0\r\
    \n:if ([:pick \$Exp 0 1]!=\"+\" && [:len \$Exp]>7 && [:typeof [:tonum [:pi\
    ck \$Exp 0 8]]]=\"num\") do={\r\
    \n:set usname ;:set uspfl ;:set CYear ([:pi\
    ck \$Exp 0 4]-1);:set CToday (\$CYear*365+\$CYear /4)\r\
    \n:set CMonth [:pick \$Exp 4 6];:if ([:pick \$Exp 4 5] = 0) do={ :set CMon\
    th [:pick \$Exp 5 6]};:set CMonth (\$CMonth-1)\r\
    \n:set CDay [:pick \$Exp 6 8];:if ([:pick \$Exp 6 7] = 0) do={ :set CDay [\
    :pick \$Exp 7 8]};:set CDay (\$CDay-1)\r\
    \n:if ((\$CYear-\$CYear/4*4) != 3) do={:set CToday (\$CToday+[:pick \$leap\
    year \$CMonth]+\$CDay)} else={:set CToday (\$CToday+[:pick \$leapyear (\$C\
    Month+12)])}}\r\
    \n:set pcl [:find \$Exp \"+\"];:if ([:typeof \$pcl]=\"num\" && (\$pcl>7 ||\
    \_\$pcl=0) && ([:len \$Exp]-1)>\$pcl) do={\r\
    \n:if (\$pcl = 0) do={:set CToday \$Today;:set CYear (\$Year+1);:set CMont\
    h (\$Month+1);:set CDay (\$Day+1)\r\
    \n:if ([:len \$CMonth]<2) do={:set CMonth (\"0\" . \$CMonth)};:if ([:len \
    \$CDay]<2) do={:set CDay (\"0\" . \$CDay)}\r\
    \nset \$i comment=([:pick \$Ccomment 0 \$lc] . \"[\" .(\$CYear . \$CMonth \
    . \$CDay) . [:pick \$Exp \$pcl [:len \$Exp]] . \"]\" . [:pick \$Ccomment (\
    \$rc+1) [:len \$Ccomment]])}\r\
    \n:while ([:typeof [:find \$Exp \"+\"]]=\"num\") do={\r\
    \n:set Exp [:pick \$Exp (\$pcl+1) [:len \$Exp]];:set pcl [:find \$Exp \"+\
    \"];:if ([:typeof \$pcl]!=\"num\") do={:set pcl [:len \$Exp]}\r\
    \n:set js (\$js+[:tonum [:pick \$Exp 0 \$pcl]])};:set CToday (\$CToday+\$j\
    s)}\r\
    \n#\C0\FD\D7\D31:\BD\FB\D3\C3\B2\A2\CC\DE\B3\F6\B5\BD\C6\DAPPP\D3\C3\BB\A7\
    \r\
    \n:if (\$CToday < \$Today) do={:if (!) do={disable \$i;\
    /ppp active remove }} else={:if () \
    do={enable \$i}}\r\
    \n#\C0\FD\D7\D32:\CC\E1\C7\B03\CC\EC\CC\DF\B3\F6\B5\BD\C6\DA\D3\C3\BB\A7\
    \B2\A2\B8\F8\D3\E8\C9\E8\D6\C3\B5\BD\C6\DA\B9\E6\D4\F2\r\
    \n:if ((\$CToday-3) < \$Today) do={:if (! && [:pick \$u\
    spfl 0 8]!=\"ExpAuto_\") do={\r\
    \n:if ([:len [..profile find name=\"ExpAuto_\" . \$uspfl]]=0) do={..profil\
    e add name=(\"ExpAuto_\" . \$uspfl) copy-from=\$uspfl address-list=ExpAuto\
    _expired}\r\
    \nset \$i profile=(\"ExpAuto_\" . \$uspfl);/ppp active remove [find name=\
    \$usname]}} else={:if ([:pick \$uspfl 0 8]=\"ExpAuto_\") do={\r\
    \n:if ([:len [..profile find name=[:pick \$uspfl 8 [:len \$uspfl]]]]=0) do\
    ={..profile add name=[:pick \$uspfl 8 [:len \$uspfl]] copy-from=\$uspfl ad\
    dress-list=\"\"}\r\
    \nset \$i profile=[:pick \$uspfl 8 [:len \$uspfl]];:foreach acus in=[/ppp \
    active find name=\$usname] do={:local tempipaddr [/ppp active get \$acus a\
    ddress]\r\
    \n/ip firewall address-list remove [find list=ExpAuto_expired address=\$tempi\
    paddr];/ip firewall address-list remove [find list=ExpAuto_allow address\
    =\$tempipaddr]}}}\r\
    \n#\B8\F9\BE\DD\D0\E8\D2\AA\BF\C9\CC\ED\BC\D3\BB\F2\CC\E6\BB\BB\B6\D4\D3\
    \C3\BB\A7\B5\C4\B2\D9\D7\F7\C0\FD\D7\D3,\BC\D9\C9\E8\CC\E1\C7\B05\CC\EC\A3\
    \AC\D4\F2\D4\DA\CC\F5\BC\FE:if ((\$CToday-5) < \$Today) do={\D6\B4\D0\D0\
    \CD\A8\D6\AA\B2\D9\D7\F7\A1\AD}\r\
    \n#:if ((\$CToday-5) < \$Today) do={\D6\B4\D0\D0\CD\A8\D6\AA\B2\D9\D7\F7\
    \A1\AD}\r\
    \n\r\
    \n}}\r\
    \n#PPP\B4\A6\C0\ED\BD\E1\CA\F8\r\
    \n\r\
    \n\r\
    \n\r\
    \n#Hotspot\B4\A6\C0\ED\BF\AA\CA\BC\r\
    \n/ip hotspot user\r\
    \n:foreach i in= do={\r\
    \n:set Ccomment ;:set lc [:find \$Ccomment \"[\"];:set rc\
    \_[:find \$Ccomment \"]\"]\r\
    \n:if ([:typeof \$lc]=\"num\" && [:typeof \$rc]=\"num\" && \$lc<\$rc) do={\
    \r\
    \n:set Exp [:pick \$Ccomment (\$lc+1) \$rc];:set js 0;:set CToday 0\r\
    \n:if ([:pick \$Exp 0 1]!=\"+\" && [:len \$Exp]>7 && [:typeof [:tonum [:pi\
    ck \$Exp 0 8]]]=\"num\") do={\r\
    \n:set usname ;:set uspfl ;:set CYear ([:pi\
    ck \$Exp 0 4]-1);:set CToday (\$CYear*365+\$CYear /4)\r\
    \n:set CMonth [:pick \$Exp 4 6];:if ([:pick \$Exp 4 5] = 0) do={ :set CMon\
    th [:pick \$Exp 5 6]};:set CMonth (\$CMonth-1)\r\
    \n:set CDay [:pick \$Exp 6 8];:if ([:pick \$Exp 6 7] = 0) do={ :set CDay [\
    :pick \$Exp 7 8]};:set CDay (\$CDay-1)\r\
    \n:if ((\$CYear-\$CYear/4*4) != 3) do={:set CToday (\$CToday+[:pick \$leap\
    year \$CMonth]+\$CDay)} else={:set CToday (\$CToday+[:pick \$leapyear (\$C\
    Month+12)])}}\r\
    \n:set pcl [:find \$Exp \"+\"];:if ([:typeof \$pcl]=\"num\" && (\$pcl>7 ||\
    \_\$pcl=0) && ([:len \$Exp]-1)>\$pcl) do={\r\
    \n:if (\$pcl = 0) do={:set CToday \$Today;:set CYear (\$Year+1);:set CMont\
    h (\$Month+1);:set CDay (\$Day+1)\r\
    \n:if ([:len \$CMonth]<2) do={:set CMonth (\"0\" . \$CMonth)};:if ([:len \
    \$CDay]<2) do={:set CDay (\"0\" . \$CDay)}\r\
    \nset \$i comment=([:pick \$Ccomment 0 \$lc] . \"[\" .(\$CYear . \$CMonth \
    . \$CDay) . [:pick \$Exp \$pcl [:len \$Exp]] . \"]\" . [:pick \$Ccomment (\
    \$rc+1) [:len \$Ccomment]])}\r\
    \n:while ([:typeof [:find \$Exp \"+\"]]=\"num\") do={\r\
    \n:set Exp [:pick \$Exp (\$pcl+1) [:len \$Exp]];:set pcl [:find \$Exp \"+\
    \"];:if ([:typeof \$pcl]!=\"num\") do={:set pcl [:len \$Exp]}\r\
    \n:set js (\$js+[:tonum [:pick \$Exp 0 \$pcl]])};:set CToday (\$CToday+\$j\
    s)}\r\
    \n#\C0\FD\D7\D31:\C9\E8\D6\C3Hotspot\D3\C3\BB\A7\D7\B4\CC\AC(\BD\FB\D3\C3\
    \B2\A2\CC\DE\B3\FD\BA\CD\C6\F4\D3\C3)\r\
    \n:if (\$CToday < \$Today) do={:if (!) do={disable \$i;\
    /ip hotspot active remove }} else={:if ([get \$i disab\
    led ]) do={enable \$i}}\r\
    \n#:if ((\$CToday-5) < \$Today) do={\D6\B4\D0\D0\B5\C4\B2\D9\D7\F7\A1\AD}\
    \r\
    \n\r\
    \n}}\r\
    \n#Hotspot\B4\A6\C0\ED\BD\E1\CA\F8\r\
    \n"




/system scheduler
remove
add comment="" disabled=no interval=1d name=ExpAuto on-event=Exp_Auto policy=\
    reboot,read,write,policy,test,password,sniff,sensitive start-date=\
    jan/01/1970 start-time=00:00:00

/system clock set time-zone-name=Asia/Hong_Kong
/system ntp client set enabled=yes mode=unicast primary-ntp=129.6.15.28 secondary-ntp=129.6.15.29

/ppp profile remove
/ip pool remove

/ip firewall filter
remove


/ip firewall nat
remove
add action=accept chain=dstnat comment="ExpAuto allow list 80 port access" disabled=no dst-port=80 protocol=tcp src-address-list=ExpAuto_allow
add action=redirect chain=dstnat comment="ExpAuto redirect 80 port" disabled=no dst-port=80 protocol=tcp src-address-list=ExpAuto_expired to-ports=9797
move 0

/ip firewall mangle
remove
add action=add-src-to-address-list address-list=ExpAuto_allow address-list-timeout=3h chain=prerouting comment="ExpAuto touch to allow list & Timeout" disabled=no dst-port=20189 protocol=tcp src-address-list=ExpAuto_expired
add action=accept chain=prerouting comment="ExpAuto allow expired notice" disabled=no dst-port=80 protocol=tcp src-address-list=ExpAuto_expired
move 0

/ip proxy
:if ([:len ]>0) do={set enabled=yes port=9797}
:local proxyport
:if (=no) do={
:if ([:typeof [:find $proxyport 9797]]="nil") do={set enabled=yes port=9797}
} else={
:if ([:typeof [:find $proxyport 9797]]="nil") do={set enabled=yes port=([:tostr $proxyport] . ",9797")}
}
/ip proxy access
remove
add action=deny comment="ExpAuto drop access" disabled=no local-port=9797




/ppp profile
:foreach cl in= do={set $cl address-list=ExpAuto_expired}

kingkongli 发表于 2011-12-27 02:05:14

自己的问题,脚本是完美的脚本,设置一下自动执行的时间,到期后会自动关闭账号,在线的用户会自动断开

47771885 发表于 2011-12-27 09:21:25

。。。。这是 mxso 大虾的杰作。。。。。

kzyfl 发表于 2011-12-27 09:29:53

本帖最后由 kzyfl 于 2011-12-27 09:48 编辑

kingkongli 发表于 2011-12-27 02:05 static/image/common/back.gif
自己的问题,脚本是完美的脚本,设置一下自动执行的时间,到期后会自动关闭账号,在线的用户会自动断开

你可能没听明白啥意思,我说的不是脚本自动执行的问题,我问的是到期提醒""宽带连接""断开后再连接只有第一次连接时才有到期提醒,有没有办法让每次宽带连接第一次打开网页都有提醒.

kzyfl 发表于 2011-12-27 09:45:42

本帖最后由 kzyfl 于 2011-12-27 10:05 编辑

47771885 发表于 2011-12-27 09:21 static/image/common/back.gif
。。。。这是 mxso 大虾的杰作。。。。。

不好意思,给弄混了,我这边两个到期脚本,一个是到期"ting",一个是到期提醒,一个是灰太狼大侠的脚本,一个是 mxso 大虾的脚本.我想把两个脚本配合起来做到期提前提醒,和到期后通知续费.两个给弄混了.

lrdilu 发表于 2011-12-27 09:54:46

:(好深奥.看不懂

hui21894558 发表于 2011-12-27 10:00:35

加个脚本检查src2的地址列表,把如果active connection里没有的IP删掉就可以实现楼主的要求了。

839551876 发表于 2011-12-27 11:24:16

kzyfl 发表于 2011-12-27 09:45 不好意思,给弄混了,我这边两个到期脚本,一个是到期"ting",一个是到期提醒,一个是灰太狼大侠的脚本,一个 ...

不知2.927能不能使用这脚本。
页: [1]
查看完整版本: 求助灰太狼版主的ExpAuto的到期提醒的问题.