Hi
At me it is automatically generated address lists.
But it turns out that one IP is added 50 times.
How it is possible to clean duplicates of records from the list?
You have to write a script which checks duplicate entries and removes them.
can you help with this script ?
Something like this
{
/ip firewall address-list
:global alist [find];
:global blist {};
:for i from=0 to=([:len $alist ]-2) do= {
:for j from=($i+1) to=([:len $alist ]-1) do={
:if ([get [:pick $alist $i] address ] = [get [:pick $alist $j] address ]) do={
:local bAdd 1;
:for k from=0 to=([:len $blist]-1) do={
:if ( [:pick $alist $j] = [:pick $blist $k]) do={
:set bAdd 0;
}
}
:if ($bAdd = 1) do={
:set blist ($blist , [:pick $alist $j]);
}
}
}
}
remove $blist;
}
Next time just add one line in your script that adds entries in address list to check whether such entry already exist.
in this script CPU Load - 100%
but double records not cleaning
as he sed something like this
change the script to soute
How many entries you have in address list and on how fast device?
8247 addresses in one list
one ip has 40 records
CPU: 1800Mhz
Memory: 256Mb
with PPOE Servers + PPTP // Access Router
see example

Well then it will take days to run three :for loops through 8000 entries ![]()
Faster and easier is to remove all entries.
but if remove all entries, then clients disconected…
try this =)
DoubleCleaner.rar (191 KB)
Delphi source files included, it uses my RouterOS API client
its worked ![]()
but programm is too slow in 8000 entries
external script added copies of ip faster then soft cleaned yet ))
wt.. are you doing on that router?
Stop executing script which adds duplicate entries.
Cleaning list is completely useless if another script is adding new duplicate entries at the same time.
Mariz, +1 ![]()
stimels, kill the reason of duplication!
I can’t stop external script, because he generated by billing.
then fix it, so that it do not add duplicates =)
Perl script, i badly know perl ![]()
sub HW_set_ip_list
{
my($list_id,$list_name,$action,$p)=@{$[0]}{‘list_id’,‘list_name’,‘action’,‘list_ptr’};
my($ip,$id);
my(@cmd);
&hw_debug(“[HW_set_ip_list] list_name: $list_name, act: $action”);
$sock or &HW_connect() or return 0;
$action=$action eq ‘add’;
foreach $ip (keys %$p)
{
&HW_set_tag();
$id=$list_id;
map{ $id=$id*256 + $ } split /./,$ip;
@cmd=$action? (
“/ip/firewall/address-list/add”,
“=list=$list_name”,
“=address=$ip”,
“=comment=$id”,
“=disabled=no”,
“.tag=$HW_tag”
) : (
“/ip/firewall/address-list/remove”,
“=.id=$id”,
“.tag=$HW_tag”
);
&hw_send_all($sock,@cmd);
}
return 1;
}
full script in attack
not zip
mikrotik.zip (7.96 KB)
i need Chupaka help with delphi i know its off topic
but i need a way to read from a tcp connection
so i conect to xxx.xxx.xxx:5000
and save everyline it reads into a acsess databasec can you help me please the line will look like this
http://www.gpsinformation.org/dale/nmea.htm
$GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M3C
$GPXTE,A,A,0.67,L,N6F
etc so i can read any gps then ill use that data from a gps
can you help me how can i link this with delphi
if it’s about Synapse, then
var
FSock: TTCPBlockSocket;
Data: String;
begin
FSock := TTCPBlockSocket.Create;
FSock.Connect(Hostname, Port);
if (FSock.LastError = 0) then
begin
repeat
Data := FSock.RecvString(1000);
ProcessData(Data);
until False;
end;
FSock.Free;
end;
my SkypeID is ‘pavel.skuratovich’