vtacfriendly 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd6588419610b86f3f05847761296e9225d767ac0c2839c77bcdb84a3f396ea7
4
- data.tar.gz: 48f611fa3d6a03bb5eb53fea2e6fcddf8375fbefd92064be73ae297f7fb14d6d
3
+ metadata.gz: feb1ec849f39686daecf874719aa75f5f6e74adfe13a865962668c6cafc0bab6
4
+ data.tar.gz: 0bbd46b063bff1441110bb9496917a6fe0104b02371db0a79cfff3b47dcfdee2
5
5
  SHA512:
6
- metadata.gz: 7b5b4932b18505710d2b4641d9c480374b70803c90be2ae038c08bcd36ce26d5560628c6eb353a6f40eac2075eda0d9f5487d2f1d31343d1f1f34299b2040655
7
- data.tar.gz: 0d988a8357b5f582f55cc9e29415f5879a4f70c76e71ecc785da20d225e4462ba83155668f8daaa6d633f3fbdb81f53c81aba515379ebf15228d2251e199b540
6
+ metadata.gz: 29a2db0516d05387fd291844d3da62f9a94edad4de47119e18ecf9c5d2ac7a13959454556f8e850b2182a0a3d0b303a041a5d2f601370b4b77c6a935df835023
7
+ data.tar.gz: b4c61186e221ff215cbc695cfdca896a576bb2ac4b7ef0636b7bf39e2a7783b9337b43170e6fb61ba25252c8023ed10e35cbde8ac2e0de303cae96c46d61da9c
data/bin/vtac-ui CHANGED
@@ -16,6 +16,8 @@ args = ArgsParser::Args.new(switches: switches, options: options)
16
16
  srv = VtacFriendly::Client.connect(args.data[0], args.switches[:p] ? args.switches[:p].to_i : 5582)
17
17
  server = srv[0]
18
18
  server_name = srv[1]
19
+ server_version = srv[2]
20
+ auth_required = srv[3]
19
21
  sock_domain, remote_port, remote_hostname, remote_ip = server.peeraddr
20
22
 
21
23
  bb = (R::C.color :blue) + (R::F.bold)
@@ -48,7 +50,7 @@ loop do
48
50
  print " "*(R::S.width-R::Cr.pos[0])
49
51
  elsif ctab == :system
50
52
  puts "_.cb:gray._AnalyticsConfig_.f:bold.__.cb:black._System".to_ftext
51
- VtacFriendly::SystemTab.show remote_ip, server_name
53
+ VtacFriendly::SystemTab.show remote_ip, server_name, server_version, auth_required
52
54
 
53
55
  R::Cr.go_to_pos(0, R::S.height)
54
56
  R::C.color :gray, type: :bg, mode: :set
@@ -1,9 +1,11 @@
1
1
  module VtacFriendly
2
2
  module SystemTab
3
- def show(ip, name)
3
+ def show(ip, name, version, password)
4
4
  puts "
5
5
  #{R::C.color :blue}#{R::F.bold}IP#{R::F.reset} #{ip}
6
6
  #{R::C.color :blue}#{R::F.bold}Server name#{R::F.reset} #{name}
7
+ #{R::C.color :blue}#{R::F.bold}Version#{R::F.reset} #{version}
8
+ #{R::C.color :blue}#{R::F.bold}Authentication#{R::F.reset} #{password ? "enabled" : "disabled"}
7
9
  "
8
10
  end
9
11
 
@@ -4,11 +4,27 @@ module VtacFriendly
4
4
  server = TCPSocket.open(host, port)
5
5
 
6
6
  init_pack = VtacPacket.new(from_packet: server.gets)
7
- server_name = init_pack[:contents]
7
+ server_id = init_pack[:contents].split("~")
8
+
9
+ server_name = server_id[0]
10
+ server_version = server_id[1]
11
+ auth_required = server_id[2] ? true : false
8
12
 
9
13
  server.puts VtacPacket.new(:id_client, "vtac_client")
10
14
 
11
- return [server, server_name]
15
+ if auth_required
16
+ print "Password: "
17
+ server.puts VtacPacket.new(:password, STDIN.gets.chomp)
18
+
19
+ response = VtacPacket.new(from_packet: server.gets)
20
+
21
+ if response[:type] == "error"
22
+ STDERR.puts "ERROR: " + response[:contents]
23
+ exit 1
24
+ end
25
+ end
26
+
27
+ return [server, server_name, server_version, auth_required]
12
28
  end
13
29
 
14
30
  module_function :connect
@@ -1,6 +1,6 @@
1
1
  module VtacFriendly
2
2
  class VtacPacket
3
- @@allowed_types = [:command, :response, :id_server, :id_client, :error, :disconnect]
3
+ @@allowed_types = [:command, :response, :id_server, :id_client, :error, :disconnect, :password]
4
4
 
5
5
  def initialize(type=:response, contents="", from_packet:nil)
6
6
  if !from_packet
data/lib/vtac_friendly.rb CHANGED
@@ -10,7 +10,7 @@ require "json"
10
10
  module VtacFriendly
11
11
  @ver_1 = 0
12
12
  @ver_2 = 0
13
- @ver_3 = 2
13
+ @ver_3 = 3
14
14
  @ver_4 = ""
15
15
 
16
16
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vtacfriendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-15 00:00:00.000000000 Z
11
+ date: 2023-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: argparse