Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
tamiatag
New Contributor

Import IP address file

Hello,
I have to block hundreds of IP addresses because of the flaw we all know.
However, I have a version of my fortigate 200D that is in 6.0, the latest version supported by my hardware.
When I import my file with the ips, there is no problem, I see it perfectly. Except that I can't, when I create a rule, find the famous import file to block the ips. Indeed, I have followed dozens of tutorials, but nothing works.
I would need a little help to explain me how to block the ips with my imported file.
Thank you for your help

 

Best regards
Best regards
22 REPLIES 22
tamiatag

Thank you for your answers gentlemen.
Indeed, your script can potentially help me but your link leads to nowhere.
Are you sure that the page exists on your forum?

Best regards
Best regards
tamiatag

Thank you both. I am waiting for the script to come back that could potentially help me.
Waiting for your return

Best regards
Best regards
ede_pfau
Esteemed Contributor III

I've fixed it a couple of minutes ago, sorry. The lighter side of it is, it's in English.


Ede

"Kernel panic: Aiee, killing interrupt handler!"
Ede"Kernel panic: Aiee, killing interrupt handler!"
tamiatag

Thank you for your feedback, I'll let you know soon.

Best regards
Best regards
tamiatag

Hello,

It seems to me that your script is some difficulties to launch, unless I do it wrong.
Here is the answer of the latter by taking exactly your tutorial :error.PNG

Best regards
Best regards
ede_pfau
Esteemed Contributor III

I am sorry for this. I've updated the script for Python 3, fixed syntax errors and tested it (in v3.8). I have removed the executable as well, as it was the old version.


Ede

"Kernel panic: Aiee, killing interrupt handler!"
Ede"Kernel panic: Aiee, killing interrupt handler!"
tamiatag

Okay, I'll download again and let you know.

Best regards
Best regards
tamiatag

I re-tested your script.
There are some problems with the brackets but nothing too bad. On the other hand, when all the small errors are corrected, the script returns the same error. I run it with "py".
Do you have the same problem ?
Yours faithfully,

Best regards
Best regards
tamiatag

the error returns a file problem on "hosts.deny

Best regards
Best regards
ede_pfau
Esteemed Contributor III

After some re-working on my script, it's now more robust to invalid inputs and fully supports the hosts.deny syntax, as well as a plain text file with one line per IP as input.

 

I thought of attaching the script here but at 520 lines length it would not really fit in here. I have republished it on my website.


Ede

"Kernel panic: Aiee, killing interrupt handler!"
Ede"Kernel panic: Aiee, killing interrupt handler!"
Labels
Top Kudoed Authors