Community discussions

MikroTik App
 
texmeshtexas
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Sat Oct 11, 2008 11:17 pm

Text encoding?

Fri Jun 17, 2022 5:08 am

I'm trying to load the IP list from this site with a script I use to load many other lists.

https://feodotracker.abuse.ch/downloads ... mended.txt

The script gets to the point where its adding the IP to the list but it fails.
I reproduced the issue on the command line.
There is a global variable called $Fline that has the first IP
[ssp@Tik] > :put $Fline
1.234.21.73

This works
[ssp@Tik] > /ip firewall address-list add address=1.234.21.73 list=FeodoC2

This fails
[ssp@Tik] > /ip firewall address-list add address=$Fline list=FeodoC2
is not a valid dns name

I have another variable that came from a different list and this one works fine
[ssp@Tik] > :put $Tline
185.242.113.224
[ssp@Tik] > /ip firewall address-list add address=$Tline list=FeodoC2
[ssp@Tik] >

only think I can figure is the source has some strange encoding but not sure how to see that in Mikrotik
any ideas what could cause this?
 
tangent
Forum Guru
Forum Guru
Posts: 1329
Joined: Thu Jul 01, 2021 3:15 pm
Contact:

Re: Text encoding?

Fri Jun 17, 2022 7:45 am

I'm trying to load the IP list from this site with a script I use to load many other lists.

Show the script.


Two ideas:

1. You aren't handling the comment lines, beginning with "#" characters.
2. Your script assumes Unix line endings ("\n"), whereas this file uses DOS line endings ("\r\n").
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Text encoding?

Fri Jun 17, 2022 12:34 pm

The problem is not the coding of the text, the problem is that you do not read or understand the reply.

I have already replied to you:
viewtopic.php?p=939973#p940001

and the problem still the same.

virtual terminal code

[test@matrix] >:put ">$Fline<"
>1.234.21.73
<
[test@matrix] >:put ">$Tline<"
>185.242.113.224<
[test@matrix] >

virtual terminal code

[test@matrix] > /system script add name=test source=$Fline
[test@matrix] > /system script export 
# jun/17/2022 11:40:21 by RouterOS 6.6.6
# software id = I4C6-66VX
#
# model = SXT 5SVHPaxT
# serial number = 45EFX2EAC666
/system script
add name=test owner=rex source="1.234.21.73\r"
[test@matrix] > 

Mmm... I just invent a method to convert a string to "RouterOS Escaped code and vice-versa..."
 
texmeshtexas
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Sat Oct 11, 2008 11:17 pm

Re: Text encoding?

Fri Jun 17, 2022 5:43 pm

ok. I did open the file in Notepad++ with end of line char turned on. I see it. was not sure if Notepad++ inserted that since I'm on a Windows machine but guess not.
I'll give that a try.
Thank you!!
 
texmeshtexas
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Sat Oct 11, 2008 11:17 pm

Re: Text encoding?

Fri Jun 17, 2022 5:45 pm

I'm trying to load the IP list from this site with a script I use to load many other lists.

Show the script.


Two ideas:

1. You aren't handling the comment lines, beginning with "#" characters.
2. Your script assumes Unix line endings ("\n"), whereas this file uses DOS line endings ("\r\n").
the script handles the "#" characters.
I think you are right about eol characters will try that.

Who is online

Users browsing this forum: No registered users and 15 guests