Skip to content

Commit 7d2eaa8

Browse files
authored
Merge pull request #651 from ninp0/master
PWN::Plugins::TransparentBrowser module - more bugfixes
2 parents 0e4c6b3 + a5f79ce commit 7d2eaa8

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ cd /opt/pwn
3737
$ ./install.sh
3838
$ ./install.sh ruby-gem
3939
$ pwn
40-
pwn[v0.5.187]:001 >>> PWN.help
40+
pwn[v0.5.188]:001 >>> PWN.help
4141
```
4242

4343
[![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
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.5.187]:001 >>> PWN.help
55+
pwn[v0.5.188]:001 >>> PWN.help
5656
```
5757

5858
If you're using a multi-user install of RVM do:
@@ -62,7 +62,7 @@ $ rvm use ruby-3.3.3@pwn
6262
$ rvmsudo gem uninstall --all --executables pwn
6363
$ rvmsudo gem install --verbose pwn
6464
$ pwn
65-
pwn[v0.5.187]:001 >>> PWN.help
65+
pwn[v0.5.188]:001 >>> PWN.help
6666
```
6767

6868
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:

lib/pwn/plugins/transparent_browser.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,14 @@ module TransparentBrowser
492492
browser.execute_script('window.open()')
493493
jmp_tab(browser_obj: browser_obj, keyword: 'about:blank')
494494
rand_tab = SecureRandom.hex(8)
495-
browser.goto("about:about##{rand_tab}") if url.nil?
495+
if url.nil?
496+
browser.goto("about:about##{rand_tab}")
497+
browser.execute_script("document.title = '#{rand_tab}'")
498+
end
496499
# Open the DevTools for Firefox, Chrome opens them automatically
497500
browser.body.send_keys(:f12) if firefox_types.include?(browser_type)
498501
# Open Console drawer if DevTools are open
499-
browser.body.send_keys(:escape) if devtools
502+
browser.body.send_keys(:escape) unless devtools.nil?
500503
browser.goto(url) unless url.nil?
501504

502505
{ title: browser.title, url: browser.url, state: :active }
@@ -519,10 +522,10 @@ module TransparentBrowser
519522

520523
browser = browser_obj[:browser]
521524
# Switch to an inactive tab before closing the active tab if it's currently active
522-
active_tab = list_tabs(browser_obj: browser_obj).find { |tab| tab[:state] == :active }
523-
if active_tab[:url] == browser.url
524-
invalid_tab = list_tabs(browser_obj: browser_obj).find { |tab| tab[:url] != browser.url }
525-
keyword = invalid_tab[:url]
525+
active_tab = list_tabs(browser_obj: browser_obj).select { |tab| tab[:state] == :active }
526+
if active_tab.last[:url] == browser.url
527+
invalid_tab = list_tabs(browser_obj: browser_obj).select { |tab| tab[:url] != browser.url }
528+
keyword = invalid_tab.last[:url]
526529
jmp_tab(browser_obj: browser_obj, keyword: keyword)
527530
end
528531
all_tabs = browser.windows
@@ -665,6 +668,7 @@ module TransparentBrowser
665668
firefox_types = %i[firefox headless_firefox]
666669
chrome_types = %i[chrome headless_chrome]
667670

671+
hotkey = []
668672
case PWN::Plugins::DetectOS.type
669673
when :linux, :openbsd, :windows
670674
hotkey = %i[control shift]

lib/pwn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PWN
4-
VERSION = '0.5.187'
4+
VERSION = '0.5.188'
55
end

0 commit comments

Comments
 (0)