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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45b078b3f53dc5344594ebeb0a8e0121fa76d6161019e4ff6918ce1741d1e4f4
4
- data.tar.gz: 6e066b6544dd185e3497cedacb72fc1250b519f04cdcf1fad8366cc6db777ab6
3
+ metadata.gz: d8e2618c43661322179b1ea623b1dc19c5fc079373197c1ba64d78e63e17d68f
4
+ data.tar.gz: 7c36ee8c5c48c6c181a7a4204911bdb6c9079f945b1814daafa5ccf433e71bd6
5
5
  SHA512:
6
- metadata.gz: de6837d334d503f2052e7ac8401a993466e003ff03abc83e656f27c2b84bd95d56b1e3ba616d36d4c04c96efc759258077bb55c355d7a8f967ba05e7c1d737b4
7
- data.tar.gz: 19b1550c8b1202312322a8ec5c0cc167b8273362bc9ef2eda046e825e2c336c4a4ae75145b1f4d593df61219fc8a0ba36fdd2d4ce54656d5965e81ec57e0ca03
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.193]:001 >>> PWN.help
40
+ pwn[v0.5.194]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](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.193]:001 >>> PWN.help
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.193]:001 >>> PWN.help
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
- # args.push('--auto-open-devtools-for-tabs')
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
- options.web_socket_url = true
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
- options.web_socket_url = true
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
- options.web_socket_url = true
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
- browser_obj[:bidi] = driver.bidi
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
- tab_sel = all_tabs.select { |tab| tab.use if tab.title.include?(keyword) || tab.url.include?(keyword) }
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 = "about:about##{rand_tab}"
507
+ url = 'about:about'
508
+ url = 'chrome://chrome-urls/' if chrome_types.include?(browser_type)
493
509
  browser.goto(url)
494
- browser.execute_script("document.title = '#{rand_tab}'")
495
- toggle_devtools(browser_obj: browser_obj) if devtools
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
- total_tabs = list_tabs(browser_obj: browser_obj).length
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 total_tabs < 2
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.193'
4
+ VERSION = '0.5.194'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.193
4
+ version: 0.5.194
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.