Sha256: 47053d673eeef3a361156772f5c24c3c79028df602268a251ec03bc1cb985276
Contents?: true
Size: 919 Bytes
Versions: 1
Compression:
Stored size: 919 Bytes
Contents
module DespamilatorFilter class ObfuscatedURLs < Despamilator::Filter def name 'Obfuscated URLs' end def description 'Finds lame attempts at obfuscating urls.' end def parse subject text = subject.text.without_uris.downcase count = find_space_separated_parts text count += find_space_separated_characters text # weird maths below is due to some issue with ruby 1.9.2 multiplying floats by 3 (?!) subject.register_match!({score: (4.0 * count) / 10, filter: self}) if count > 0 end private def find_space_separated_parts text text.count(/www\s+\w+\s+com/) end def find_space_separated_characters text count = 0 text.split(/[a-z][a-z]/).each do |candidate| candidate.strip! candidate.gsub!(/\s+/, '') count += 1 if candidate =~ /\w{5,}\.\w{2,3}/ end count end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
despamilator-2.1 | lib/despamilator/filter/obfuscated_urls.rb |