pwn 0.5.189 → 0.5.190

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: 23209b3ae230ac7903981327315c626571dabf4ddb74d3864ca2bd625c3651da
4
- data.tar.gz: e2a378c4ed79978d0a6dd80a761d3dcedb9cbfa5926d0d926b1d248cbeebc974
3
+ metadata.gz: 8f5fb6d75564102eb7ed819f4c3833eefb9c8874fd78a0d0f588e07c74d00b62
4
+ data.tar.gz: 3fd6332778c90183ea364e2ee899a72beb79a3c8863c855ba669349fedbf2a65
5
5
  SHA512:
6
- metadata.gz: dcfd61071ac2d1f858cb55c23754ba53deae089f828ce0d9f552b6a37e060e90476d5df80c88bcf32b9ecf63bf54b760fe3281cce17ed1a97545563522a21357
7
- data.tar.gz: 67b6242126b03a7ea82c2e002c133b62f93a5f87561549355d27da94a9dbfca9afbec3eaf5256840215e45cdcb6c2077055fd5a4d140ed5fc99dd268f1414d3d
6
+ metadata.gz: 76cfc601b26f1aa5b095f7b0d12bd32186bcc7ed606738ee2b9aa5890820b254d8496c7814a6228771cd1112dc7628c2bca773438964a6ad5e7a8fe0c0efa2e1
7
+ data.tar.gz: 823c40899d1f2d899f21f490737138f7870348ef6d7f03e121056024a97c2059b68bb27985b01c40eb4ad89db96a8126ab3b371af34a095b855f0c60800ef28e
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.189]:001 >>> PWN.help
40
+ pwn[v0.5.190]: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.189]:001 >>> PWN.help
55
+ pwn[v0.5.190]: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.189]:001 >>> PWN.help
65
+ pwn[v0.5.190]: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:
@@ -41,7 +41,8 @@ module PWN
41
41
  # browser_obj1 = PWN::Plugins::TransparentBrowser.open(
42
42
  # browser_type: 'optional - :firefox|:chrome|:headless|:rest|:websocket (defaults to :chrome)',
43
43
  # proxy: 'optional - scheme://proxy_host:port || tor (defaults to nil)',
44
- # with_devtools: 'optional - boolean (defaults to true)'
44
+ # with_devtools: 'optional - boolean (defaults to true)',
45
+ # url: 'optional - URL to navigate to after opening browser (Defaults to about:about#RANDID)'
45
46
  # )
46
47
 
47
48
  public_class_method def self.open(opts = {})
@@ -62,6 +63,8 @@ module PWN
62
63
  with_devtools = opts[:with_devtools] ||= false
63
64
  with_devtools = true if devtools_supported.include?(browser_type) && with_devtools
64
65
 
66
+ url = opts[:url] ||= "about:about##{SecureRandom.hex(8)}"
67
+
65
68
  # Let's crank up the default timeout from 30 seconds to 15 min for slow sites
66
69
  Watir.default_timeout = 900
67
70
 
@@ -286,6 +289,7 @@ module PWN
286
289
  if devtools_supported.include?(browser_type)
287
290
  rand_tab = SecureRandom.hex(8)
288
291
  browser_obj[:browser].goto("about:about##{rand_tab}")
292
+ browser_obj[:browser].execute_script("document.title = '#{rand_tab}'")
289
293
 
290
294
  if with_devtools
291
295
  driver = browser_obj[:browser].driver
@@ -307,7 +311,7 @@ module PWN
307
311
 
308
312
  browser_obj[:bidi] = driver.bidi
309
313
 
310
- browser_obj[:browser].body.send_keys(:escape)
314
+ browser_obj[:browser].send_keys(:escape)
311
315
  end
312
316
  end
313
317
 
@@ -497,9 +501,9 @@ module PWN
497
501
  browser.execute_script("document.title = '#{rand_tab}'")
498
502
  end
499
503
  # Open the DevTools for Firefox, Chrome opens them automatically
500
- browser.body.send_keys(:f12) if firefox_types.include?(browser_type)
504
+ browser.send_keys(:f12) if firefox_types.include?(browser_type)
501
505
  # Open Console drawer if DevTools are open
502
- browser.body.send_keys(:escape) unless devtools.nil?
506
+ browser.send_keys(:escape) unless devtools.nil?
503
507
  browser.goto(url) unless url.nil?
504
508
 
505
509
  { title: browser.title, url: browser.url, state: :active }
@@ -522,11 +526,13 @@ module PWN
522
526
 
523
527
  browser = browser_obj[:browser]
524
528
  # Switch to an inactive tab before closing the active tab if it's currently active
525
- active_tab = list_tabs(browser_obj: browser_obj).select { |tab| tab[:state] == :active }
526
- if active_tab.last[:url] == browser.url
527
- inactive_tabs = list_tabs(browser_obj: browser_obj).reject { |tab| tab[:url] == browser.url }
528
- keyword = inactive_tabs.last[:url]
529
- jmp_tab(browser_obj: browser_obj, keyword: keyword)
529
+ active_tab = list_tabs(browser_obj: browser_obj).find { |tab| tab[:state] == :active }
530
+ if active_tab[:url] == browser.url
531
+ inactive_tabs = list_tabs(browser_obj: browser_obj).reject { |tab| tab[:state] == :active }
532
+ if inactive_tabs.any?
533
+ keyword = inactive_tabs.last[:url]
534
+ jmp_tab(browser_obj: browser_obj, keyword: keyword)
535
+ end
530
536
  end
531
537
  all_tabs = browser.windows
532
538
  tab_sel = all_tabs.select { |tab| tab.close if tab.title.include?(keyword) || tab.url.include?(keyword) }
@@ -647,7 +653,7 @@ module PWN
647
653
  verify_devtools_browser(browser_obj: browser_obj)
648
654
 
649
655
  browser = browser_obj[:browser]
650
- browser.body.send_keys(:f12)
656
+ browser.send_keys(:f12)
651
657
  rescue StandardError => e
652
658
  raise e
653
659
  end
@@ -691,8 +697,8 @@ module PWN
691
697
  end
692
698
 
693
699
  # Have to call twice for Chrome, otherwise devtools stays closed
694
- browser.body.send_keys(hotkey)
695
- browser.body.send_keys(hotkey) if chrome_types.include?(browser_type)
700
+ browser.send_keys(hotkey)
701
+ browser.send_keys(hotkey) if chrome_types.include?(browser_type)
696
702
  rescue StandardError => e
697
703
  raise e
698
704
  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.189'
4
+ VERSION = '0.5.190'
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.189
4
+ version: 0.5.190
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.