BannerGrab 0.1.0
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 +7 -0
- data/lib/bannergrab/version.rb +5 -0
- data/lib/bannergrab.rb +41 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2689a0982b222fd60482dd0052153eeee491a32cbd2d2501fe9ff4bc78d150a2
|
|
4
|
+
data.tar.gz: e835fea8acd123ba891fbf48c2305c56d2139eeed110cf16dbc1d27523cf191a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8053b784121e4b151205dedeeddb67c1e36361f857a8e1550417f60f501abfd326011d95d86f4c6bcd17b49471c14ee3c1b4057011bac6fe0d63a41b5fdee978
|
|
7
|
+
data.tar.gz: ec0e042d1dd265272219574460e0a5c3ee20861fa5bd83197657ad0ce03d3967fdb7d1652eb080801795c6d8d3f834043697565fdba0687a61eda85d0ede5638
|
data/lib/bannergrab.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require "socket"
|
|
5
|
+
require_relative "bannergrab/version"
|
|
6
|
+
module Bannergrab
|
|
7
|
+
class Control
|
|
8
|
+
def initialize(ip, port)
|
|
9
|
+
@ip = ip
|
|
10
|
+
@port = port
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
class TCP < Control
|
|
14
|
+
def grab_banner
|
|
15
|
+
begin
|
|
16
|
+
puts TCPSocket.new(@ip, @port).recv(1024)
|
|
17
|
+
rescue => e
|
|
18
|
+
puts "ERROR OCCURRED\n#{e}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
def view_headers
|
|
22
|
+
unless @ip.match?("https://")
|
|
23
|
+
@ip = "https://#{@ip}"
|
|
24
|
+
end
|
|
25
|
+
uri = URI(@ip)
|
|
26
|
+
response = Net::HTTP.get_response(uri)
|
|
27
|
+
response.header.each_header { |h| puts "#{h}: #{response[h]}" }
|
|
28
|
+
end
|
|
29
|
+
def http
|
|
30
|
+
cmd = `curl -s -I #{@ip.gsub('https://', '')}`
|
|
31
|
+
# makes sure the Server header is present
|
|
32
|
+
if cmd.match?("Server")
|
|
33
|
+
# extracts the server header
|
|
34
|
+
version = cmd.split('Server: ')[1].split("\n")[0].strip
|
|
35
|
+
puts version
|
|
36
|
+
else
|
|
37
|
+
puts "No Server header found..."
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: BannerGrab
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mike
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-11-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Grab a banner from a service a couple different ways.
|
|
14
|
+
email:
|
|
15
|
+
- noway@lol.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/bannergrab.rb
|
|
21
|
+
- lib/bannergrab/version.rb
|
|
22
|
+
homepage:
|
|
23
|
+
licenses: []
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.4.20
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: Grab a banner from a service.
|
|
44
|
+
test_files: []
|