Class: Unibanner::Functions

Inherits:
Object
  • Object
show all
Defined in:
lib/unibanner/functions.rb

Overview

A group of functions to help with unibanner

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#keyString

DNSBL.im key file contents

Returns:

  • (String)

    the current value of key



7
8
9
# File 'lib/unibanner/functions.rb', line 7

def key
  @key
end

Class Method Details

.send2BL(ip) ⇒ Object

Send an IP to the blacklist

A bit longer description.

Parameters:

  • ip (String)

    IP sending to blacklist



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/unibanner/functions.rb', line 13

def self.send2BL(ip)
  url = 'https://api.dnsbl.im/import'
  payload = {
    key: File.open('/home/ken/.dnsblim-key', 'r').read.chomp!,
    addresses: [
      {type: '5,6', ip: ip, reason: 'fngate and/or unicode spam'}
   ]
  }
  r = Unirest.post(url, parameters: payload.to_json)
  return r.body
end