pwn 0.5.488 → 0.5.489
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/.rubocop.yml +1 -1
- data/README.md +3 -3
- data/lib/pwn/plugins/repl.rb +34 -31
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bd30ef667258a8c6d6f5b2f64b7a5d39791b79b2f70e874c15ea2f846cfc543
|
|
4
|
+
data.tar.gz: 43d46bd61ce79485b22640c37ede4e67ac44462d8f03c31c6bdeae40433fcd49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61f58c0a487e678a1a33c9df4f75b5bf5b5360845fb5ab9a16acaa629c678df17430e1d99c75a0d6c94126b3aa3711de1f4d247af22789aed073570fcb63e1d2
|
|
7
|
+
data.tar.gz: 1c46a44f7590948fe513e063836a9b82db47ba455e05e0fab7b47c2d19cf58b394dc337d92c5edeb247d280c70ed198fce385c6fb9b23408df8387653dbd5b4d
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
|
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
|
37
37
|
$ ./install.sh
|
|
38
38
|
$ ./install.sh ruby-gem
|
|
39
39
|
$ pwn
|
|
40
|
-
pwn[v0.5.
|
|
40
|
+
pwn[v0.5.489]:001 >>> PWN.help
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
|
53
53
|
$ gem install --verbose pwn
|
|
54
54
|
$ pwn
|
|
55
|
-
pwn[v0.5.
|
|
55
|
+
pwn[v0.5.489]:001 >>> PWN.help
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
|
64
64
|
$ pwn
|
|
65
|
-
pwn[v0.5.
|
|
65
|
+
pwn[v0.5.489]:001 >>> PWN.help
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
data/lib/pwn/plugins/repl.rb
CHANGED
|
@@ -487,7 +487,7 @@ module PWN
|
|
|
487
487
|
Curses.init_pair(color_id, color_fg, color_bg)
|
|
488
488
|
end
|
|
489
489
|
PWN.const_set(:MeshColors, (1..mesh_highlight_colors.length).to_a)
|
|
490
|
-
PWN.const_set(:
|
|
490
|
+
PWN.const_set(:MeshLastColor, PWN::MeshColors.sample)
|
|
491
491
|
|
|
492
492
|
mesh_ui_colors = []
|
|
493
493
|
mesh_highlight_colors.each_with_index do |hl_hash, idx|
|
|
@@ -553,7 +553,7 @@ module PWN
|
|
|
553
553
|
# Live typing echo thread (idempotent)
|
|
554
554
|
tx_prompt = "#{region}/#{topic} >>>"
|
|
555
555
|
echo_thread = Thread.new do
|
|
556
|
-
|
|
556
|
+
last_line = nil
|
|
557
557
|
loop do
|
|
558
558
|
break unless pi.config.pwn_mesh
|
|
559
559
|
|
|
@@ -566,7 +566,7 @@ module PWN
|
|
|
566
566
|
base_line = "#{prefix}#{msg_input}"
|
|
567
567
|
cursor_abs_index = prefix.length + cursor_pos
|
|
568
568
|
current_line = base_line
|
|
569
|
-
if
|
|
569
|
+
if last_line != current_line
|
|
570
570
|
mutex.synchronize do
|
|
571
571
|
tx_win.clear
|
|
572
572
|
tx_win.attron(Curses.color_pair(red) | Curses::A_BOLD)
|
|
@@ -601,9 +601,9 @@ module PWN
|
|
|
601
601
|
tx_win.attroff(Curses.color_pair(yellow) | Curses::A_BOLD)
|
|
602
602
|
tx_win.refresh
|
|
603
603
|
end
|
|
604
|
-
|
|
604
|
+
last_line = current_line
|
|
605
605
|
end
|
|
606
|
-
sleep 0.
|
|
606
|
+
sleep 0.00001
|
|
607
607
|
end
|
|
608
608
|
end
|
|
609
609
|
echo_thread.abort_on_exception = false
|
|
@@ -617,6 +617,7 @@ module PWN
|
|
|
617
617
|
detach: true
|
|
618
618
|
) do |_|
|
|
619
619
|
last_from = nil
|
|
620
|
+
last_line = nil
|
|
620
621
|
Meshtastic::MQTT.subscribe(
|
|
621
622
|
mqtt_obj: mqtt_obj,
|
|
622
623
|
region: region,
|
|
@@ -639,41 +640,43 @@ module PWN
|
|
|
639
640
|
rx_text = decoded[:payload]
|
|
640
641
|
ts = Time.now.strftime('%Y-%m-%d %H:%M:%S%z')
|
|
641
642
|
|
|
642
|
-
# Select a random color
|
|
643
|
+
# Select a random color different from the last used one
|
|
643
644
|
colors_arr = PWN.const_get(:MeshColors)
|
|
644
|
-
|
|
645
|
-
|
|
645
|
+
last_color = PWN.const_get(:MeshLastColor)
|
|
646
|
+
color = last_color
|
|
646
647
|
unless last_from == from
|
|
647
|
-
PWN.send(:remove_const, :
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
PWN.const_set(:
|
|
648
|
+
PWN.send(:remove_const, :MeshLastColor)
|
|
649
|
+
color_choices = colors_arr.reject { |c| c == last_color }
|
|
650
|
+
color = color_choices.sample
|
|
651
|
+
PWN.const_set(:MeshLastColor, color)
|
|
651
652
|
end
|
|
652
653
|
|
|
653
654
|
to_label = 'To'
|
|
654
655
|
to_label = 'DM' unless to == '!ffffffff'
|
|
655
656
|
current_line = "\nDate: #{ts}\nFrom: #{from}\n#{to_label}: #{to}\nTopic: #{absolute_topic}\n> #{rx_text}"
|
|
656
657
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
658
|
+
if last_line != current_line
|
|
659
|
+
rx_body_win = PWN.const_get(:MeshRxBodyWin)
|
|
660
|
+
mutex.synchronize do
|
|
661
|
+
inner_height = rx_body_win.maxy - 5
|
|
662
|
+
inner_width = rx_body_win.maxx
|
|
663
|
+
segments = current_line.scan(/.{1,#{inner_width}}/)
|
|
664
|
+
rx_body_win.attron(Curses.color_pair(color) | Curses::A_REVERSE)
|
|
665
|
+
segments.each do |seg|
|
|
666
|
+
rx_body_win.setpos(rx_body_win.cury, 0)
|
|
667
|
+
# Handle wide Unicode characters for proper alignment
|
|
668
|
+
display_width = Unicode::DisplayWidth.of(seg)
|
|
669
|
+
width_diff = seg.length - display_width
|
|
670
|
+
shift_width = inner_width + width_diff
|
|
671
|
+
line = seg.ljust(shift_width)
|
|
672
|
+
rx_body_win.addstr(line)
|
|
673
|
+
end
|
|
674
|
+
rx_body_win.attroff(Curses.color_pair(color) | Curses::A_REVERSE)
|
|
675
|
+
rx_body_win.refresh
|
|
671
676
|
end
|
|
672
|
-
|
|
677
|
+
last_line = current_line
|
|
678
|
+
last_from = from
|
|
673
679
|
end
|
|
674
|
-
rx_body_win.attroff(Curses.color_pair(pair) | Curses::A_REVERSE)
|
|
675
|
-
|
|
676
|
-
last_from = from
|
|
677
680
|
end
|
|
678
681
|
end
|
|
679
682
|
rescue StandardError => e
|
|
@@ -770,7 +773,7 @@ module PWN
|
|
|
770
773
|
PWN.send(:remove_const, :MeshTxWin)
|
|
771
774
|
end
|
|
772
775
|
PWN.send(:remove_const, :MeshColors) if PWN.const_defined?(:MeshColors)
|
|
773
|
-
PWN.send(:remove_const, :
|
|
776
|
+
PWN.send(:remove_const, :MeshLastColor) if PWN.const_defined?(:MeshLastColor)
|
|
774
777
|
PWN.send(:remove_const, :MeshMutex) if PWN.const_defined?(:MeshMutex)
|
|
775
778
|
PWN.send(:remove_const, :MqttSubThread) if PWN.const_defined?(:MqttSubThread)
|
|
776
779
|
Curses.close_screen
|
data/lib/pwn/version.rb
CHANGED