pwn 0.5.193 → 0.5.194
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/transparent_browser.rb +39 -13
- 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: d8e2618c43661322179b1ea623b1dc19c5fc079373197c1ba64d78e63e17d68f
|
4
|
+
data.tar.gz: 7c36ee8c5c48c6c181a7a4204911bdb6c9079f945b1814daafa5ccf433e71bd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8449c2bfcc574dab0613478ac7f9cc249f039c7fc8ea3d27fd14045ce399377f2be3fdcdd760ffeb93f2812c0157e8c6daa99645d965e59835e35d5bf40b8f0b
|
7
|
+
data.tar.gz: a5018bad53afa6a41bcf41c9b9c3abc0508ab2430f4905ab0368fd2beb479706c2f117bb48cb2414e641e5f39efe3cc28fd05bd7e5ad74ec165f2f9884ed615b
|
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.194]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.3.3@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.194]: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.3.3@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.194]: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:
|
@@ -149,7 +149,7 @@ module PWN
|
|
149
149
|
end
|
150
150
|
|
151
151
|
if devtools
|
152
|
-
|
152
|
+
args.push('--auto-open-devtools-for-tabs')
|
153
153
|
args.push('--disable-hang-monitor')
|
154
154
|
end
|
155
155
|
|
@@ -158,7 +158,8 @@ module PWN
|
|
158
158
|
accept_insecure_certs: true
|
159
159
|
)
|
160
160
|
|
161
|
-
|
161
|
+
# This is for bidi, once it's ready
|
162
|
+
# options.web_socket_url = true
|
162
163
|
options.profile = this_profile
|
163
164
|
driver = Selenium::WebDriver.for(:chrome, options: options)
|
164
165
|
browser_obj[:browser] = Watir::Browser.new(driver)
|
@@ -218,7 +219,8 @@ module PWN
|
|
218
219
|
accept_insecure_certs: true
|
219
220
|
)
|
220
221
|
|
221
|
-
|
222
|
+
# This is for bidi, once it's ready
|
223
|
+
# options.web_socket_url = true
|
222
224
|
options.profile = this_profile
|
223
225
|
driver = Selenium::WebDriver.for(:firefox, options: options)
|
224
226
|
browser_obj[:browser] = Watir::Browser.new(driver)
|
@@ -240,7 +242,8 @@ module PWN
|
|
240
242
|
accept_insecure_certs: true
|
241
243
|
)
|
242
244
|
|
243
|
-
|
245
|
+
# This is for bidi, once it's ready
|
246
|
+
# options.web_socket_url = true
|
244
247
|
options.profile = this_profile
|
245
248
|
driver = Selenium::WebDriver.for(:chrome, options: options)
|
246
249
|
browser_obj[:browser] = Watir::Browser.new(driver)
|
@@ -299,10 +302,12 @@ module PWN
|
|
299
302
|
browser_obj[:devtools].send_cmd('DOMSnapshot.enable')
|
300
303
|
end
|
301
304
|
|
302
|
-
|
305
|
+
# Future BiDi API that's more universally supported across browsers
|
306
|
+
# browser_obj[:bidi] = driver.bidi
|
303
307
|
|
304
308
|
jmp_devtools_panel(browser_obj: browser_obj, panel: :elements)
|
305
309
|
end
|
310
|
+
|
306
311
|
new_tab(browser_obj: browser_obj, first_tab: true)
|
307
312
|
end
|
308
313
|
|
@@ -450,7 +455,8 @@ module PWN
|
|
450
455
|
# Supported Method Parameters::
|
451
456
|
# tab = PWN::Plugins::TransparentBrowser.jmp_tab(
|
452
457
|
# browser_obj: 'required - browser_obj returned from #open method)',
|
453
|
-
# keyword: 'required - keyword in title or url used to switch tabs'
|
458
|
+
# keyword: 'required - keyword in title or url used to switch tabs',
|
459
|
+
# explicit: 'optional - boolean to indicate if the keyword is an exact match (Defaults to false)'
|
454
460
|
# )
|
455
461
|
|
456
462
|
public_class_method def self.jmp_tab(opts = {})
|
@@ -460,9 +466,16 @@ module PWN
|
|
460
466
|
keyword = opts[:keyword]
|
461
467
|
raise 'ERROR: keyword parameter is required' if keyword.nil?
|
462
468
|
|
469
|
+
explicit = opts[:explicit] ||= false
|
470
|
+
|
463
471
|
browser = browser_obj[:browser]
|
464
472
|
all_tabs = browser.windows
|
465
|
-
|
473
|
+
if explicit
|
474
|
+
tab_sel = all_tabs.select { |tab| tab.use if tab.title == keyword || tab.url == keyword }
|
475
|
+
else
|
476
|
+
tab_sel = all_tabs.select { |tab| tab.use if tab.title.include?(keyword) || tab.url.include?(keyword) }
|
477
|
+
end
|
478
|
+
|
466
479
|
{ title: tab_sel.last.title, url: tab_sel.last.url, state: :active } if tab_sel.any?
|
467
480
|
rescue StandardError => e
|
468
481
|
raise e
|
@@ -478,6 +491,8 @@ module PWN
|
|
478
491
|
browser_obj = opts[:browser_obj]
|
479
492
|
verify_devtools_browser(browser_obj: browser_obj)
|
480
493
|
|
494
|
+
chrome_types = %i[chrome headless_chrome]
|
495
|
+
|
481
496
|
first_tab = opts[:first_tab] ||= false
|
482
497
|
|
483
498
|
browser = browser_obj[:browser]
|
@@ -489,10 +504,13 @@ module PWN
|
|
489
504
|
end
|
490
505
|
|
491
506
|
rand_tab = SecureRandom.hex(8)
|
492
|
-
url =
|
507
|
+
url = 'about:about'
|
508
|
+
url = 'chrome://chrome-urls/' if chrome_types.include?(browser_type)
|
493
509
|
browser.goto(url)
|
494
|
-
|
495
|
-
|
510
|
+
# TODO: replace sleep with something more reliable like an event listener
|
511
|
+
sleep 1
|
512
|
+
browser.execute_script("document.title = 'about:about-#{rand_tab}'")
|
513
|
+
toggle_devtools(browser_obj: browser_obj, first_tab: first_tab) if devtools
|
496
514
|
|
497
515
|
{ title: browser.title, url: browser.url, state: :active }
|
498
516
|
rescue StandardError => e
|
@@ -642,21 +660,29 @@ module PWN
|
|
642
660
|
|
643
661
|
# Supported Method Parameters::
|
644
662
|
# PWN::Plugins::TransparentBrowser.toggle_devtools(
|
645
|
-
# browser_obj: 'required - browser_obj returned from #open method)'
|
663
|
+
# browser_obj: 'required - browser_obj returned from #open method)',
|
664
|
+
# first_tab: 'optional - boolean to indicate if this is the first tab (Defaults to false)',
|
646
665
|
# )
|
647
666
|
|
648
667
|
public_class_method def self.toggle_devtools(opts = {})
|
649
668
|
browser_obj = opts[:browser_obj]
|
650
669
|
verify_devtools_browser(browser_obj: browser_obj)
|
651
670
|
|
652
|
-
|
671
|
+
first_tab = opts[:first_tab] ||= false
|
653
672
|
|
654
673
|
browser = browser_obj[:browser]
|
674
|
+
tab_id = browser.title.split('-').last.strip
|
675
|
+
devtools_tab_title = "DevTools-#{tab_id}"
|
676
|
+
jmp_tab(browser_obj: browser_obj, keyword: 'DevTools', explicit: true)
|
677
|
+
browser.execute_script("document.title = '#{devtools_tab_title}'")
|
655
678
|
browser.send_keys(:f12)
|
656
|
-
if
|
679
|
+
if first_tab
|
680
|
+
# TODO: replace sleep with something more reliable like an event listener
|
657
681
|
sleep 1
|
658
682
|
browser.send_keys(:escape)
|
659
683
|
end
|
684
|
+
tab_tied_to_devtools = "about:about-#{devtools_tab_title.split('-').last.strip}"
|
685
|
+
jmp_tab(browser_obj: browser_obj, keyword: tab_tied_to_devtools, explicit: true)
|
660
686
|
rescue StandardError => e
|
661
687
|
raise e
|
662
688
|
end
|
data/lib/pwn/version.rb
CHANGED