Jump to content

Експорт скрипт


Recommended Posts

Здравейте,

Опитвам се да напиша скрипт, който да export-ва една от статичните ми address lists в .rsc файл, но не успявам. Пробах и с print и с find, но явно бъркам нещо:

/ip firewall address-list print where list="ssh_blacklist" ; export file=ssh_blasklist.rsc

- така не работи

/ip firewall address-list find ssh_blacklist ; export file=ssh_blasklist.rsc 

- и така също не става.

Някой сеща ли се как?

Link to post
Share on other sites
  • Administrator

С отдалечена сесия през SSH която да логнеш, грепнеш и запишеш

https://www.2daygeek.com/script-command-record-save-your-terminal-session-activity-linux/#

Харесай поста ^^^
acer.gif htc.gifsigpic4024_2.gif

Форумът е за взаимопомощ а не за свършване на чужда работа


ɹɐǝɥ uɐɔ noʎ ǝɹoɯ ǝɥʇ 'ǝɯoɔǝq noʎ ɹǝʇǝınb ǝɥʇ

Link to post
Share on other sites

Трябва ми routeros-a, да го прави автоматично на интервал от време. 

Edited by MikroX
Link to post
Share on other sites
  • Administrator

Модифицирай си го по твой вкус

:local emailip
:local spamip
:local keepflag 0
:foreach j in [/ip firewall address-list find list=email-log] do={
  :set emailip [/ip firewall address-list get $j address]
  :foreach i in [/ip firewall address-list find list=spammer] do={
    :set spamip [/ip firewall address-list get $i address]
    :if ($emailip=$spamip) do={:set keepflag 1}
  }
  :if ($keepflag=0) do={/ip firewall address-list remove $j} else= {:set keepflag 0}
}
:if ([:len [/ip firewall address-list find list=spammer]]>0) do={
  :local bodymsg ""
  :local emailflag 0
  :log error "---------- IP's detected as SPAMMERS ----------"
  :foreach i in [/ip firewall address-list find list=spammer] do={
    :set spamip [/ip firewall address-list get $i address]
    :log error $spamip
  }
  :foreach i in [/ip firewall address-list find list=spammer] do={
    :set spamip [/ip firewall address-list get $i address]
    :foreach j in [/ip firewall address-list find list=email-log] do={
      :set emailip [/ip firewall address-list get $j address]
      :if ($spamip=$emailip) do={:set emailflag 1}
    }
    :if ($emailflag=0) do={
      :set bodymsg ($bodymsg . $spamip . "\r\n")
      /ip firewall address-list add address=$spamip list=email-log
    } else= {:set emailflag 0}
  }
  :if ([:len $bodymsg]>0) do={
    /tool e-mail send from=MikroTik-XX@yourisp.com server=xxx.xxx.xxx.xxx to=youremail@yourisp.com subject="IP's detected as SPAMMERS" body=$bodymsg
    :set bodymsg ""
  }
}

После сподели резултата.

Харесай поста ^^^
acer.gif htc.gifsigpic4024_2.gif

Форумът е за взаимопомощ а не за свършване на чужда работа


ɹɐǝɥ uɐɔ noʎ ǝɹoɯ ǝɥʇ 'ǝɯoɔǝq noʎ ɹǝʇǝınb ǝɥʇ

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.