vtacfriendly 0.0.1 → 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: c46638a042bcc01490a05eb4b0b91d51b93e50a288bd35fe205fa723dff374be
4
- data.tar.gz: 411b3df41a0db976bb19a39d4ccc0eb51257e2bae7e68b46718d3224e61eb0a7
3
+ metadata.gz: feb1ec849f39686daecf874719aa75f5f6e74adfe13a865962668c6cafc0bab6
4
+ data.tar.gz: 0bbd46b063bff1441110bb9496917a6fe0104b02371db0a79cfff3b47dcfdee2
5
5
  SHA512:
6
- metadata.gz: c144c9f1bbfd8dd7c6be8ee7891ac7bf9744ea2c362d237049882ebe1f98237c56b1a7f932a0587b7d47173ff0c488d19a2babdb06e7c946634d488098ef2292
7
- data.tar.gz: 6f0619deec5fc44ea5404c8d569f4acb0961617f9872b20917eaecd187963aeb5cec7a8dba01984b69e992ddf6f4b0f19146bcc47c942f31c79e53fdc15d86e2
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
 
@@ -22,6 +24,11 @@ module VtacFriendly
22
24
  end
23
25
 
24
26
  def update(server)
27
+ R::Cr.go_to_pos(0, R::S.height-1)
28
+ R::C.color :gray, type: :bg, mode: :set
29
+ print "Updating..."
30
+ R::C.color :reset, type: :bg, mode: :set
31
+
25
32
  server.puts VtacPacket.new(:command, "update")
26
33
  VtacPacket.new(from_packet: server.gets)[:contents]
27
34
  end
@@ -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 = 1
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.1
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