pwn 0.5.481 → 0.5.483
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/README.md +3 -3
- data/lib/pwn/plugins/repl.rb +27 -23
- 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: d9089cde1713e79574b561791fc9e52331efdd9d4401f92f84a3cd78d3e9baa5
|
|
4
|
+
data.tar.gz: 810569d7a49f6ce75871431eafd90d5ba6377c8c0f8ba3031e82b07e1233264b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fcb0e4057e72824d1c18a3af03dc9826733ccb34d5e8153b1085850a3ce119915dedcb70d5bd172b91358c65d2e273d3086cccead5a1fe0c20acd98f9947b5f
|
|
7
|
+
data.tar.gz: c4543ab1b1ec9db5841b85f283353da453c971001b7f6a013a239afde1cdc715f07b80f54000b18c3faa207dfa73c7ba929c5f5d4ca89f61620669ebafb0a356
|
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.483]: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.483]: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.483]: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
|
@@ -522,11 +522,11 @@ module PWN
|
|
|
522
522
|
rx_win.addstr(rx_header)
|
|
523
523
|
rx_win.attroff(Curses.color_pair(green) | Curses::A_BOLD)
|
|
524
524
|
# Jump two lines below header before messages begin
|
|
525
|
-
rx_win.setpos(2,
|
|
525
|
+
rx_win.setpos(2, 0)
|
|
526
526
|
rx_win.attron(Curses.color_pair(cyan) | Curses::A_BOLD)
|
|
527
|
-
|
|
528
|
-
rx_header_bottom_line_pos = (Curses.cols / 2) - (
|
|
529
|
-
rx_win.addstr(
|
|
527
|
+
header_line = "\u2014" * Curses.cols
|
|
528
|
+
rx_header_bottom_line_pos = (Curses.cols / 2) - (header_line.length / 2)
|
|
529
|
+
rx_win.addstr(header_line)
|
|
530
530
|
rx_win.attroff(Curses.color_pair(cyan) | Curses::A_BOLD)
|
|
531
531
|
|
|
532
532
|
rx_win.refresh
|
|
@@ -552,29 +552,27 @@ module PWN
|
|
|
552
552
|
mutex = PWN.const_get(:MeshMutex)
|
|
553
553
|
msg_input = pi.input.line_buffer.to_s
|
|
554
554
|
ts = Time.now.strftime('%H:%M:%S%z')
|
|
555
|
-
cursor_pos =
|
|
555
|
+
cursor_pos = Readline.point
|
|
556
556
|
prefix = "[#{ts}] [TX] #{tx_prompt} "
|
|
557
557
|
base_line = "#{prefix}#{msg_input}"
|
|
558
558
|
cursor_abs_index = prefix.length + cursor_pos
|
|
559
559
|
current_line = base_line
|
|
560
560
|
if current_line != last_drawn
|
|
561
561
|
mutex.synchronize do
|
|
562
|
-
# Only show draft if after_read hook hasn't just written final TX (heuristic)
|
|
563
562
|
tx_win.clear
|
|
564
563
|
tx_win.attron(Curses.color_pair(red) | Curses::A_BOLD)
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
tx_win.addstr(rx_header_bottom_line)
|
|
564
|
+
tx_header_line_pos = (Curses.cols / 2) - (header_line.length / 2)
|
|
565
|
+
tx_win.addstr(header_line)
|
|
568
566
|
tx_win.attroff(Curses.color_pair(red) | Curses::A_BOLD)
|
|
569
|
-
tx_win.attron(Curses.color_pair(yellow) | Curses::A_BOLD)
|
|
570
567
|
|
|
571
|
-
|
|
568
|
+
tx_win.attron(Curses.color_pair(yellow) | Curses::A_BOLD)
|
|
569
|
+
inner_width = Curses.cols
|
|
572
570
|
segments = current_line.chars.each_slice(inner_width).map(&:join)
|
|
573
|
-
available_rows = tx_win.maxy -
|
|
571
|
+
available_rows = tx_win.maxy - 1
|
|
574
572
|
segments.first(available_rows).each_with_index do |seg, idx|
|
|
575
|
-
tx_win.setpos(1 + idx,
|
|
573
|
+
tx_win.setpos(1 + idx, 0)
|
|
576
574
|
start_index = idx * inner_width
|
|
577
|
-
end_index = start_index + inner_width
|
|
575
|
+
end_index = start_index + inner_width
|
|
578
576
|
if cursor_abs_index.between?(start_index, end_index)
|
|
579
577
|
cursor_col = cursor_abs_index - start_index
|
|
580
578
|
(0..inner_width).each do |col|
|
|
@@ -596,7 +594,7 @@ module PWN
|
|
|
596
594
|
end
|
|
597
595
|
last_drawn = current_line
|
|
598
596
|
end
|
|
599
|
-
sleep 0.
|
|
597
|
+
sleep 0.0001
|
|
600
598
|
end
|
|
601
599
|
end
|
|
602
600
|
echo_thread.abort_on_exception = false
|
|
@@ -609,6 +607,7 @@ module PWN
|
|
|
609
607
|
max_threads: 1,
|
|
610
608
|
detach: true
|
|
611
609
|
) do |_|
|
|
610
|
+
last_from = nil
|
|
612
611
|
Meshtastic::MQTT.subscribe(
|
|
613
612
|
mqtt_obj: mqtt_obj,
|
|
614
613
|
region: region,
|
|
@@ -625,7 +624,7 @@ module PWN
|
|
|
625
624
|
rx_win = PWN.const_get(:MeshRxWin)
|
|
626
625
|
mutex = PWN.const_get(:MeshMutex)
|
|
627
626
|
|
|
628
|
-
from = packet[:node_id_from]
|
|
627
|
+
from = packet[:node_id_from].to_s.ljust(9, ' ')
|
|
629
628
|
absolute_topic = "#{region}/#{topic.gsub('#', from)}"
|
|
630
629
|
to = packet[:node_id_to]
|
|
631
630
|
rx_text = decoded[:payload]
|
|
@@ -634,28 +633,33 @@ module PWN
|
|
|
634
633
|
# Select a random color pair different from the last used one
|
|
635
634
|
colors_arr = PWN.const_get(:MeshColors)
|
|
636
635
|
last_pair = PWN.const_get(:MeshLastPair)
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
636
|
+
pair = last_pair
|
|
637
|
+
unless last_from == from
|
|
638
|
+
PWN.send(:remove_const, :MeshLastPair)
|
|
639
|
+
pair_choices = colors_arr.reject { |c| c == last_pair }
|
|
640
|
+
pair = pair_choices.sample
|
|
641
|
+
PWN.const_set(:MeshLastPair, pair)
|
|
642
|
+
end
|
|
641
643
|
rx_win.attron(Curses.color_pair(pair) | Curses::A_REVERSE)
|
|
642
644
|
|
|
643
645
|
current_line = "\n[#{ts}] [RX] #{absolute_topic} >>> #{rx_text}"
|
|
644
646
|
current_line = "\n[#{ts}] [RX][DM INTERCEPTED] #{absolute_topic} to: #{to} >>> #{rx_text}" unless to == '!ffffffff'
|
|
645
647
|
|
|
646
648
|
mutex.synchronize do
|
|
647
|
-
inner_width = Curses.cols
|
|
649
|
+
inner_width = Curses.cols
|
|
648
650
|
content = current_line.sub(/\A\n/, '')
|
|
649
651
|
segments = content.scan(/.{1,#{inner_width}}/)
|
|
650
652
|
segments.each do |seg|
|
|
651
|
-
rx_win.addstr("\n")
|
|
652
|
-
rx_win.setpos(rx_win.cury,
|
|
653
|
+
# rx_win.addstr("\n")
|
|
654
|
+
rx_win.setpos(rx_win.cury, 0)
|
|
653
655
|
line = seg.ljust(inner_width)
|
|
654
656
|
rx_win.addstr(line)
|
|
655
657
|
end
|
|
656
658
|
rx_win.refresh
|
|
657
659
|
end
|
|
658
660
|
rx_win.attroff(Curses.color_pair(pair) | Curses::A_REVERSE)
|
|
661
|
+
|
|
662
|
+
last_from = from
|
|
659
663
|
end
|
|
660
664
|
end
|
|
661
665
|
rescue StandardError => e
|
data/lib/pwn/version.rb
CHANGED