htb 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e6caea0b99b8c05235a7d882577af1a106b5313efdbe8e8034bdd18a18f1c83
4
- data.tar.gz: d8e9addfbe08acc7acaaf30d5a033871b93b9271bcc93a0d85dd2bd33c914da5
3
+ metadata.gz: ad35da07fd9b2867d488dbf3559f26f7a4d892accd93f7787ef318e0c6ab4d6d
4
+ data.tar.gz: 77ae561b2b972ca331fe42b1dacfda49909bbd177d6f92406b659f19079974e2
5
5
  SHA512:
6
- metadata.gz: 053eb8609fd604dd1921c30279a686bc86d4362f9e4756e518168a505deeb720210d75aea4e2d84ddedf8510da71e49a036e7076560f304ab19076a2a96f3787
7
- data.tar.gz: 853a12f640c67d268078cbf8fbf540bf5d7875d186ee8c1b0896d58db2b3f1f0f64b5c58bfcc3d4702fae675a2b902c401d631bdbd9c53cc71be2b2d94294e81
6
+ metadata.gz: 8af38c52092bf0738dc64d9752624bd4b996389e730561a6a4c54809e3752350847aabb8a16a4ff120e8e6132ea9fd8ea15b95518b7ef4fc8f5cfa02bebe2ba1
7
+ data.tar.gz: dc43a9683115267a1d0e9f2370cf69ed0c7d329ad2d09bafd50487a33a8fdb7f479484dad4f2e2404198bdd6c7ad03c2a7e6fac46a08da8c40c1cdd0acc6b948
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.1] - 2026-01-17
9
+
10
+ ### Fixed
11
+
12
+ - Fixed VPN status endpoint from `/connections/status` to `/connection/status`
13
+ - Fixed VPN status response handling to properly parse Array response
14
+ - Fixed VM active endpoint from `/vm/active` to `/machine/active`
15
+ - Fixed config file YAML parsing to handle non-Hash responses gracefully
16
+ - Changed "Machine" label to "Challenge" in status output
17
+
8
18
  ## [0.1.0] - 2025-01-17
9
19
 
10
20
  ### Added
data/htb.gemspec CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "lib/htb/version"
4
+
3
5
  Gem::Specification.new do |spec|
4
6
  spec.name = "htb"
5
- spec.version = "0.1.0"
7
+ spec.version = HTB::VERSION
6
8
  spec.authors = ["usiegj00"]
7
9
  spec.email = ["usiegj00@users.noreply.github.com"]
8
10
 
data/lib/htb/cli/main.rb CHANGED
@@ -44,7 +44,7 @@ module HTB
44
44
  CLI.print_table(
45
45
  ["Field", "Value"],
46
46
  [
47
- ["Machine", info["name"] || "N/A"],
47
+ ["Challenge", info["name"] || "N/A"],
48
48
  ["IP", info["ip"] || "N/A"],
49
49
  ["Type", info["type"] || "N/A"],
50
50
  ["Expires", info["expires_at"] || "N/A"]
@@ -60,18 +60,26 @@ module HTB
60
60
  puts CLI.pastel.bold("\n=== VPN Status ===")
61
61
  begin
62
62
  vpn_status = CLI.spinner("Fetching VPN status...") { client.vpn.status }
63
- if vpn_status && vpn_status["data"]
64
- data = vpn_status["data"]
65
- CLI.print_table(
66
- ["Field", "Value"],
67
- [
68
- ["Connected", data["connection"] ? "Yes" : "No"],
69
- ["Server", data["server"] || "N/A"],
70
- ["IP", data["ip"] || "N/A"]
71
- ]
72
- )
63
+ if vpn_status.is_a?(Array) && !vpn_status.empty?
64
+ vpn_status.each do |conn|
65
+ server = conn["server"] || {}
66
+ connection = conn["connection"] || {}
67
+ CLI.print_table(
68
+ ["Field", "Value"],
69
+ [
70
+ ["Type", conn["type"] || "N/A"],
71
+ ["Location", conn["location_type_friendly"] || "N/A"],
72
+ ["Server", server["friendly_name"] || "N/A"],
73
+ ["Connected", connection["name"] ? "Yes" : "No"],
74
+ ["IPv4", connection["ip4"] || "N/A"],
75
+ ["IPv6", connection["ip6"] || "N/A"],
76
+ ["Down", connection["down"] ? "#{connection['down']} KB/s" : "N/A"],
77
+ ["Up", connection["up"] ? "#{connection['up']} KB/s" : "N/A"]
78
+ ]
79
+ )
80
+ end
73
81
  else
74
- CLI.print_info("VPN status unavailable")
82
+ CLI.print_info("No active VPN connections")
75
83
  end
76
84
  rescue HTB::Error => e
77
85
  CLI.print_error(e.message)
data/lib/htb/cli.rb CHANGED
@@ -6,12 +6,12 @@ require "tty-spinner"
6
6
  require "tty-prompt"
7
7
  require "pastel"
8
8
 
9
- require_relative "cli/main"
10
9
  require_relative "cli/machines"
11
10
  require_relative "cli/vm"
12
11
  require_relative "cli/users"
13
12
  require_relative "cli/challenges"
14
13
  require_relative "cli/vpn"
14
+ require_relative "cli/main"
15
15
 
16
16
  module HTB
17
17
  module CLI
data/lib/htb/config.rb CHANGED
@@ -12,7 +12,8 @@ module HTB
12
12
  return {} unless File.exist?(CONFIG_FILE)
13
13
 
14
14
  content = File.read(CONFIG_FILE)
15
- YAML.safe_load(content, symbolize_names: true) || {}
15
+ result = YAML.safe_load(content, symbolize_names: true)
16
+ result.is_a?(Hash) ? result : {}
16
17
  rescue StandardError
17
18
  {}
18
19
  end
data/lib/htb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTB
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/htb/vm.rb CHANGED
@@ -49,9 +49,9 @@ module HTB
49
49
  end
50
50
 
51
51
  # Get active VM
52
- # GET /api/v4/vm/active
52
+ # GET /api/v4/machine/active
53
53
  def active
54
- @client.get("/vm/active")
54
+ @client.get("/machine/active")
55
55
  end
56
56
 
57
57
  # Transfer VM to another lab
data/lib/htb/vpn.rb CHANGED
@@ -13,9 +13,9 @@ module HTB
13
13
  end
14
14
 
15
15
  # Get current VPN connection status
16
- # GET /api/v4/connections/status
16
+ # GET /api/v4/connection/status
17
17
  def status
18
- @client.get("/connections/status")
18
+ @client.get("/connection/status")
19
19
  end
20
20
 
21
21
  # Switch VPN server
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - usiegj00
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
11
  date: 2026-01-17 00:00:00.000000000 Z
@@ -203,7 +203,7 @@ metadata:
203
203
  homepage_uri: https://github.com/aluminumio/htb-ruby
204
204
  source_code_uri: https://github.com/aluminumio/htb-ruby
205
205
  changelog_uri: https://github.com/aluminumio/htb-ruby/blob/main/CHANGELOG.md
206
- post_install_message:
206
+ post_install_message:
207
207
  rdoc_options: []
208
208
  require_paths:
209
209
  - lib
@@ -218,8 +218,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  - !ruby/object:Gem::Version
219
219
  version: '0'
220
220
  requirements: []
221
- rubygems_version: 3.0.3.1
222
- signing_key:
221
+ rubygems_version: 3.5.22
222
+ signing_key:
223
223
  specification_version: 4
224
224
  summary: Ruby client for the Hack The Box API v4
225
225
  test_files: []