vectra 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rock.yml +1 -1
- data/README.md +42 -1
- data/lib/vectra.rb +9 -0
- data/lib/vectra/detection_details.rb +27 -0
- data/lib/vectra/dns.rb +27 -0
- data/lib/vectra/relayed_comms.rb +27 -0
- data/lib/vectra/sqli.rb +27 -0
- data/lib/vectra/version.rb +1 -1
- metadata +5 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 80a30a2c4a8f5197d069da6bb592a3184a442a08
         | 
| 4 | 
            +
              data.tar.gz: cc1e73c9e4091afa26927ef76308e718586ff2e6
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9ab0eb156501023f4b4bdcda61e8ce1ccdbc170d88284f4a82ef2076ac0b2e4c487d4785283d987b910f4b7deecc1ee67389a3a550f174c58324aa9e6ee262ce
         | 
| 7 | 
            +
              data.tar.gz: 12c2d1f0dfe8875d314513d17a7e41c524ad75fa2829bf8986842bec4b4508035df472fd97188cfb6589ce2e0d357c21a75a888367b538053511e9640651909c
         | 
    
        data/.rock.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -38,7 +38,48 @@ You can also get a detection by ID or by referencing the detection URL: | |
| 38 38 | 
             
            Vectra::Detections.get(1)
         | 
| 39 39 | 
             
            Vectra::Detections.get('https://vectra/detection/1')
         | 
| 40 40 | 
             
            ```
         | 
| 41 | 
            -
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            ### Detection Details
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            Within the response of a detection, you may find Detection Details. You can get more details on these like so:
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            ```ruby
         | 
| 47 | 
            +
            Vectra::Detections.get(1)["detection_detail_set"].each do |d|
         | 
| 48 | 
            +
              details = Vectra::DetectionDetails.get(d)
         | 
| 49 | 
            +
              puts "--> #{details["destination"]}:#{details["dst_port"]}"
         | 
| 50 | 
            +
            end
         | 
| 51 | 
            +
            ```
         | 
| 52 | 
            +
            ### Relayed Comms
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            Another type of detection detail you may see is the following:
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            ```ruby
         | 
| 57 | 
            +
            Vectra::Detections.get(1)["relayed_comm_set"].each do |r|
         | 
| 58 | 
            +
              details = Vectra::RelayComms.get(r)
         | 
| 59 | 
            +
              puts "--> #{details['inbound_proto']} #{details["inbound_ip"]}:#{details["inbound_port"]} @ #{details['total_bytes_rcvd']} bytes"
         | 
| 60 | 
            +
            end
         | 
| 61 | 
            +
            ```  
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            ### DNS
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            There is also a DNS set:
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            ```ruby
         | 
| 68 | 
            +
            Vectra::Detections.get(1)["dns_set"].each do |d|
         | 
| 69 | 
            +
              details = Vectra::DNS.get(r)
         | 
| 70 | 
            +
              puts "--> DNS Server: #{details['dns_ip']} resolved #{details['dns_request']} to #{details['resp']}"
         | 
| 71 | 
            +
            end
         | 
| 72 | 
            +
            ```   
         | 
| 73 | 
            +
            ### SQL Injection
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            And lastly, an SQL Injection Set
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            ```ruby
         | 
| 78 | 
            +
            Vectra::Detections.get(1)["sqli_set"].each do |s|
         | 
| 79 | 
            +
              details = Vectra::SQLi.get(s)
         | 
| 80 | 
            +
              puts "Injection Attempted: #{details['ngram']} to #{details['destination']}"
         | 
| 81 | 
            +
            end
         | 
| 82 | 
            +
            ```    
         | 
| 42 83 | 
             
            ## Hosts
         | 
| 43 84 |  | 
| 44 85 | 
             
            Do not use `::Hosts.all` if you are in production. This will be very costly if you have more than 5,000 discovered hosts.
         | 
    
        data/lib/vectra.rb
    CHANGED
    
    | @@ -3,13 +3,22 @@ require 'json' | |
| 3 3 | 
             
            require 'fattr'
         | 
| 4 4 | 
             
            require 'cgi'
         | 
| 5 5 |  | 
| 6 | 
            +
            # Config
         | 
| 6 7 | 
             
            require 'vectra/config'
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # Core Functions
         | 
| 7 10 | 
             
            require 'vectra/api'
         | 
| 8 11 | 
             
            require 'vectra/hosts'
         | 
| 9 12 | 
             
            require 'vectra/detections'
         | 
| 10 13 | 
             
            require 'vectra/sensors'
         | 
| 11 14 | 
             
            require 'vectra/rules'
         | 
| 12 15 |  | 
| 16 | 
            +
            # Detection Sets
         | 
| 17 | 
            +
            require 'vectra/relayed_comms'
         | 
| 18 | 
            +
            require 'vectra/detection_details'
         | 
| 19 | 
            +
            require 'vectra/sqli'
         | 
| 20 | 
            +
            require 'vectra/dns'
         | 
| 21 | 
            +
             | 
| 13 22 | 
             
            module Vectra
         | 
| 14 23 |  | 
| 15 24 | 
             
              extend self
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            module Vectra
         | 
| 2 | 
            +
              class DetectionDetails
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                attr_accessor :target
         | 
| 5 | 
            +
                @target = "/detection_details"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def self.all
         | 
| 8 | 
            +
                  Vectra::API.pull(@target)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def each
         | 
| 12 | 
            +
                  self.all.each do |host|
         | 
| 13 | 
            +
                    yield host
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end 
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def self.get(id)
         | 
| 18 | 
            +
                  unless id.is_a? Integer
         | 
| 19 | 
            +
                    id = id.split("/").last
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  Vectra::API.pull("#{@target}/#{id}")
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
    
        data/lib/vectra/dns.rb
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            module Vectra
         | 
| 2 | 
            +
              class DNS
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                attr_accessor :target
         | 
| 5 | 
            +
                @target = "/dns"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def self.all
         | 
| 8 | 
            +
                  Vectra::API.pull(@target)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def each
         | 
| 12 | 
            +
                  self.all.each do |host|
         | 
| 13 | 
            +
                    yield host
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end 
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def self.get(id)
         | 
| 18 | 
            +
                  unless id.is_a? Integer
         | 
| 19 | 
            +
                    id = id.split("/").last
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  Vectra::API.pull("#{@target}/#{id}")
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            module Vectra
         | 
| 2 | 
            +
              class RelayedComms
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                attr_accessor :target
         | 
| 5 | 
            +
                @target = "/relayed_comm"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def self.all
         | 
| 8 | 
            +
                  Vectra::API.pull(@target)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def each
         | 
| 12 | 
            +
                  self.all.each do |host|
         | 
| 13 | 
            +
                    yield host
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end 
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def self.get(id)
         | 
| 18 | 
            +
                  unless id.is_a? Integer
         | 
| 19 | 
            +
                    id = id.split("/").last
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  Vectra::API.pull("#{@target}/#{id}")
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
    
        data/lib/vectra/sqli.rb
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            module Vectra
         | 
| 2 | 
            +
              class SQLi
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                attr_accessor :target
         | 
| 5 | 
            +
                @target = "/sqli"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def self.all
         | 
| 8 | 
            +
                  Vectra::API.pull(@target)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def each
         | 
| 12 | 
            +
                  self.all.each do |host|
         | 
| 13 | 
            +
                    yield host
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end 
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def self.get(id)
         | 
| 18 | 
            +
                  unless id.is_a? Integer
         | 
| 19 | 
            +
                    id = id.split("/").last
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  Vectra::API.pull("#{@target}/#{id}")
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
    
        data/lib/vectra/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vectra
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mike Mackintosh
         | 
| @@ -112,10 +112,14 @@ files: | |
| 112 112 | 
             
            - lib/vectra.rb
         | 
| 113 113 | 
             
            - lib/vectra/api.rb
         | 
| 114 114 | 
             
            - lib/vectra/config.rb
         | 
| 115 | 
            +
            - lib/vectra/detection_details.rb
         | 
| 115 116 | 
             
            - lib/vectra/detections.rb
         | 
| 117 | 
            +
            - lib/vectra/dns.rb
         | 
| 116 118 | 
             
            - lib/vectra/hosts.rb
         | 
| 119 | 
            +
            - lib/vectra/relayed_comms.rb
         | 
| 117 120 | 
             
            - lib/vectra/rules.rb
         | 
| 118 121 | 
             
            - lib/vectra/sensors.rb
         | 
| 122 | 
            +
            - lib/vectra/sqli.rb
         | 
| 119 123 | 
             
            - lib/vectra/version.rb
         | 
| 120 124 | 
             
            - spec/spec_helper.rb
         | 
| 121 125 | 
             
            - spec/vectra/vectra_spec.rb
         |