PayPal with hotspot and walled garden bypass

From MikroTik Wiki
Revision as of 16:27, 25 October 2010 by SurferTim (talk | contribs) (Removed unused $thisip variable)
Jump to: navigation, search

These scripts maintain a current list of PayPal ips in the walled garden.

These two domains should be entered in "/ip hotspot walled-garden":
www.paypal.com
www.paypalobjects.com

This script is paypal. It should be scheduled to run every 15 seconds.

:local ppobjip [:resolve www.paypalobjects.com];
:local today [/system clock get date];
:local paypalobject [/ip hotspot walled-garden ip find dst-address=$ppobjip];
:local thisdate none;
:local noip true;

:foreach i in=$paypalobject do={
        :set noip false;
        :set thisdate [/ip hotspot walled-garden ip get $i comment];
        :if ($thisdate != ("ppobj $today")) do={
                /ip hotspot walled-garden ip set $i comment="ppobj $today";
        }
}

:if ($noip) do={
    :log info "paypal script adding $ppobjip";
    /ip hotspot walled-garden ip add dst-address=$ppobjip comment="ppobj $today";
}

This script is ppupdate. It should be run manually once before use, and then scheduled to run once a day at 23:30:00.

:local today [/system clock get date];
:local old [/ip hotspot walled-garden ip find comment~"ppobj*"];
:local thisrem none;
:local thisip none;

:foreach i in=$old do={
    :set thisrem [/ip hotspot walled-garden ip get $i comment];

    :if ($thisrem != ("ppobj $today")) do={
        /ip hotspot walled-garden ip remove $i;
    }
}

:resolve www.paypal.com;

:global paypalips [/ip dns cache find name="www.paypal.com"];
:global oldips [/ip hotspot walled-garden ip find comment="paypal"];

:foreach x in=$oldips do={
    /ip hotspot walled-garden ip remove $x;
}

:foreach i in=$paypalips do={
    :set thisip [/ip dns cache get $i address];
    /ip hotspot walled-garden ip add comment="paypal" dst-address=$thisip;
}