Community discussions

MikroTik App
 
1001001
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 70
Joined: Mon Sep 24, 2012 12:46 pm

PayPal with hotspot and walled garden bypass

Fri Feb 26, 2016 12:18 pm

Hi,

I'm currently trying to get the following script to work
: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";
}
: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;
}
The Problem is that the second script only work until :resolve www.paypal.com everything after that is not really executed. Has anyone any idea why that should be or if we have to certain changes to get the last part of the second script to work under 6.3x.x?

Best regards

1001001
 
1001001
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 70
Joined: Mon Sep 24, 2012 12:46 pm

Re: PayPal with hotspot and walled garden bypass

Fri Feb 26, 2016 1:47 pm

Hello again,

I did a little debugging, found the problem and changed the scripts to make them work.
Tehy now look like this:
: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";
}

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

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

:if ($noip) do={
    :log info "paypal script adding $ppjip";
    /ip hotspot walled-garden ip add dst-address=$ppjip comment="pp $today";
}
:local today [/system clock get date];
:local old [/ip hotspot walled-garden ip find comment~"ppobj*"];
:global thisrem none;
:global 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;
    }
}

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

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

    :if ($thisrem != ("pp $today")) do={
        /ip hotspot walled-garden ip remove $i;
    }
}
The first one resolves www.paypal.com and www.paypalobjects.com to its IP at akamai it runs every 15 seconds.
The second one does a cleanup and runs once a day.
Could someone add this as an update to the wiki?

Best regards

1001001

Who is online

Users browsing this forum: BigAlambic, erlinden and 30 guests