On Saturday 15 July 2017 at 11:19:54, mastered wrote:

> Hi Nicola,
> 
> I'm not good at SHELL script language, but this might be fine:
> 
> 1 - Save file into lista.txt
> 
> 2 - trasform lista.txt in spamassassin rules:
> 
> cat lista.txt | sed s'/http:\/\///' | sed s'/\/.*//' | sed s'/\./\\./g' |
> sed s'/^/\//' | sed s'/$/\\b\/i/' | nl | awk '{print "uri;RULE_NR_"$1";"$2"
> describe;RULE_NR_"$1";Url;presente;nella;Blacklist;Ramsonware
> score;RULE_NR_"$1";5.0" }' > listone.txt ;for i in $(sed -n p listone.txt)
> ; do echo "$i" ; done | sed s'/;/ /g' > blacklist.cf
> 
> 
> If anyone can optimize it, i'm happy.

My first comment would be "useless use of cat" :)

My second comment would be that you can combine sed commands into a single 
string, separated by ; so that you only have to call sed itself once at the 
start of all that:

sed "s'/http:\/\///'; s'/\/.*//'; s'/\./\\./g'; s'/^/\//'; s'/$/\\b\/i/'" 
lista.txt | nl .....

My only other comment is that you might want to adjust the spelling of 
Ransomware :)

Maybe other people have further optimisations.


Antony.

-- 
The gravitational attraction exerted by a single doctor at a distance of 6 
inches is roughly twice that of Jupiter at its closest point to the Earth.

                                                   Please reply to the list;
                                                         please *don't* CC me.

Reply via email to