pwn 0.5.184 → 0.5.186

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9503d9d61acf12e65e98a43f39a436e7b8ee536b366e8e41a30ab549a4b3cf68
4
- data.tar.gz: 348b098b00fc505b4ad1e02ab90c29b1e30ecfcd6f45ee36ccf8a3907933b774
3
+ metadata.gz: 2ff25e4be2c1f9ef0475858c8d712b2fed42595a90c64f607172d6c53ef2d3ca
4
+ data.tar.gz: 320d9f7ababc3d72a10568f8ccf88dcc53408202fedd859e1d633f9f552d16d9
5
5
  SHA512:
6
- metadata.gz: 7488056e30f9e6ca9b14501cad819da3e429ae9b403c663182350e662717822bb2f00e3480b571acac5fcacf5438b5e72b1dc0e6054b455c0b49c3fa68f3c647
7
- data.tar.gz: 2b35e01ca7cd9839a6e49aae4addcc1073027d93d0ded6ad73eaaa80a221c1d25f6b0cbad393b81fcdddaf9cf35153a7db73cf13b9ff1f2d5f1ac7008034cb2b
6
+ metadata.gz: 3e09bf1806d28938bfd208a1188db648e2b2501d00d23292e4471351576d3538f63b576b16bea919d14dfddc6cb73f4a1d25192b196caf191656db13e78af832
7
+ data.tar.gz: be94d3161a65b1c9b5c04885a95971384c32d341c38feec4f414c18e96af1146ddd473c2301dfd9f51e671881f09c9695f4e81c8455f2ea0066ee44be6357a9a
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.184]:001 >>> PWN.help
40
+ pwn[v0.5.186]: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.184]:001 >>> PWN.help
55
+ pwn[v0.5.186]: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.184]:001 >>> PWN.help
65
+ pwn[v0.5.186]: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:
@@ -307,6 +307,8 @@ module PWN
307
307
  end
308
308
 
309
309
  browser_obj[:bidi] = driver.bidi
310
+
311
+ browser_obj[:browser].body.send_keys(:escape)
310
312
  end
311
313
  end
312
314
 
@@ -452,12 +454,12 @@ module PWN
452
454
  end
453
455
 
454
456
  # Supported Method Parameters::
455
- # browser_obj1 = PWN::Plugins::TransparentBrowser.switch_tab(
457
+ # tab = PWN::Plugins::TransparentBrowser.jmp_tab(
456
458
  # browser_obj: 'required - browser_obj returned from #open method)',
457
459
  # keyword: 'required - keyword in title or url used to switch tabs'
458
460
  # )
459
461
 
460
- public_class_method def self.switch_tab(opts = {})
462
+ public_class_method def self.jmp_tab(opts = {})
461
463
  browser_obj = opts[:browser_obj]
462
464
  verify_devtools_browser(browser_obj: browser_obj)
463
465
 
@@ -473,7 +475,7 @@ module PWN
473
475
  end
474
476
 
475
477
  # Supported Method Parameters::
476
- # browser_obj1 = PWN::Plugins::TransparentBrowser.new_tab(
478
+ # tab = PWN::Plugins::TransparentBrowser.new_tab(
477
479
  # browser_obj: 'required - browser_obj returned from #open method)',
478
480
  # url: 'optional - URL to navigate to after opening new tab (Defaults to nil)'
479
481
  # )
@@ -484,12 +486,19 @@ module PWN
484
486
 
485
487
  url = opts[:url]
486
488
 
489
+ firefox_types = %i[firefox headless_firefox]
487
490
  browser = browser_obj[:browser]
491
+ browser_type = browser_obj[:type]
492
+ devtools = browser_obj[:devtools]
488
493
  browser.execute_script('window.open()')
489
- switch_tab(browser_obj: browser_obj, keyword: 'about:blank')
494
+ jmp_tab(browser_obj: browser_obj, keyword: 'about:blank')
490
495
  browser.goto('about:about') if url.nil?
491
496
  rand_tab = SecureRandom.hex(8)
492
497
  browser.execute_script("document.title = '#{rand_tab}'")
498
+ # Open the DevTools for Firefox, Chrome opens them automatically
499
+ browser.body.send_keys(:f12) if firefox_types.include?(browser_type)
500
+ # Open Console drawer if DevTools are open
501
+ browser.body.send_keys(:escape) if devtools
493
502
  browser.goto(url) unless url.nil?
494
503
 
495
504
  { title: browser.title, url: browser.url, state: :active }
@@ -498,7 +507,7 @@ module PWN
498
507
  end
499
508
 
500
509
  # Supported Method Parameters::
501
- # browser_obj1 = PWN::Plugins::TransparentBrowser.close_tab(
510
+ # tab = PWN::Plugins::TransparentBrowser.close_tab(
502
511
  # browser_obj: 'required - browser_obj returned from #open method)'
503
512
  # keyword: 'required - keyword in title or url used to close tabs'
504
513
  # )
@@ -519,7 +528,7 @@ module PWN
519
528
  end
520
529
 
521
530
  # Supported Method Parameters::
522
- # browser_obj1 = PWN::Plugins::TransparentBrowser.debugger(
531
+ # PWN::Plugins::TransparentBrowser.debugger(
523
532
  # browser_obj: 'required - browser_obj returned from #open method)',
524
533
  # action: 'optional - action to take :pause|:resume (Defaults to :pause)',
525
534
  # url: 'optional - URL to navigate to after pausing debugger (Defaults to nil)'
@@ -573,7 +582,7 @@ module PWN
573
582
  end
574
583
 
575
584
  # Supported Method Parameters::
576
- # browser_obj1 = PWN::Plugins::TransparentBrowser.step_into(
585
+ # PWN::Plugins::TransparentBrowser.step_into(
577
586
  # browser_obj: 'required - browser_obj returned from #open method)'
578
587
  # )
579
588
 
@@ -589,7 +598,7 @@ module PWN
589
598
  end
590
599
 
591
600
  # Supported Method Parameters::
592
- # browser_obj1 = PWN::Plugins::TransparentBrowser.step_out(
601
+ # PWN::Plugins::TransparentBrowser.step_out(
593
602
  # browser_obj: 'required - browser_obj returned from #open method)'
594
603
  # )
595
604
 
@@ -605,7 +614,7 @@ module PWN
605
614
  end
606
615
 
607
616
  # Supported Method Parameters::
608
- # browser_obj1 = PWN::Plugins::TransparentBrowser.step_over(
617
+ # PWN::Plugins::TransparentBrowser.step_over(
609
618
  # browser_obj: 'required - browser_obj returned from #open method)'
610
619
  # )
611
620
 
@@ -620,6 +629,65 @@ module PWN
620
629
  raise e
621
630
  end
622
631
 
632
+ # Supported Method Parameters::
633
+ # PWN::Plugins::TransparentBrowser.toggle_devtools(
634
+ # browser_obj: 'required - browser_obj returned from #open method)'
635
+ # )
636
+
637
+ public_class_method def self.toggle_devtools(opts = {})
638
+ browser_obj = opts[:browser_obj]
639
+ verify_devtools_browser(browser_obj: browser_obj)
640
+
641
+ browser = browser_obj[:browser]
642
+ browser.body.send_keys(:f12)
643
+ rescue StandardError => e
644
+ raise e
645
+ end
646
+
647
+ # Supported Method Parameters::
648
+ # PWN::Plugins::TransparentBrowser.jmp_devtools_panel(
649
+ # browser_obj: 'required - browser_obj returned from #open method)',
650
+ # panel: 'optional - panel to switch to :elements|:inspector|:console|:debugger|:sources|:network
651
+ # )
652
+
653
+ public_class_method def self.jmp_devtools_panel(opts = {})
654
+ browser_obj = opts[:browser_obj]
655
+ verify_devtools_browser(browser_obj: browser_obj)
656
+
657
+ panel = opts[:panel] ||= :elements
658
+ browser = browser_obj[:browser]
659
+ browser_type = browser_obj[:type]
660
+ firefox_types = %i[firefox headless_firefox]
661
+ chrome_types = %i[chrome headless_chrome]
662
+
663
+ case PWN::Plugins::DetectOS.type
664
+ when :linux, :openbsd, :windows
665
+ hotkey = %i[control shift]
666
+ when :macos
667
+ hotkey = %i[command option]
668
+ end
669
+
670
+ case panel
671
+ when :elements, :inspector
672
+ hotkey.push('c') if firefox_types.include?(browser_type)
673
+ when :console
674
+ hotkey.push('j') if chrome_types.include?(browser_type)
675
+ hotkey.push('k') if firefox_types.include?(browser_type)
676
+ when :debugger, :sources
677
+ hotkey.push('z') if firefox_types.include?(browser_type)
678
+ when :network
679
+ hotkey.push('e') if firefox_types.include?(browser_type)
680
+ else
681
+ raise 'ERROR: panel parameter must be :elements|:inspector|:console|:debugger|:sources|:network'
682
+ end
683
+
684
+ # Have to call twice for Chrome, otherwise devtools stays closed
685
+ browser.body.send_keys(hotkey)
686
+ browser.body.send_keys(hotkey) if chrome_types.include?(browser_type)
687
+ rescue StandardError => e
688
+ raise e
689
+ end
690
+
623
691
  # Supported Method Parameters::
624
692
  # browser_obj1 = PWN::Plugins::TransparentBrowser.close(
625
693
  # browser_obj: 'required - browser_obj returned from #open method)'
@@ -768,38 +836,48 @@ module PWN
768
836
  browser_obj: 'required - browser_obj returned from #open method)'
769
837
  )
770
838
 
771
- browser_obj1 = #{self}.switch_tab(
839
+ tab = #{self}.jmp_tab(
772
840
  browser_obj: 'required - browser_obj returned from #open method)',
773
841
  keyword: 'required - keyword in title or url used to switch tabs'
774
842
  )
775
843
 
776
- browser_obj1 = #{self}.new_tab(
777
- browser_obj: 'required - browser_obj returned from #open method)'
844
+ tab = #{self}.new_tab(
845
+ browser_obj: 'required - browser_obj returned from #open method)',
846
+ url: 'optional - URL to navigate to after opening new tab (Defaults to nil)'
778
847
  )
779
848
 
780
- browser_obj1 = #{self}.close_tab(
849
+ tab = #{self}.close_tab(
781
850
  browser_obj: 'required - browser_obj returned from #open method)',
782
851
  keyword: 'required - keyword in title or url used to close tabs'
783
852
  )
784
853
 
785
- browser_obj1 = #{self}.debugger(
854
+ #{self}.debugger(
786
855
  browser_obj: 'required - browser_obj returned from #open method)',
787
856
  action: 'optional - action to take :pause|:resume (Defaults to :pause)',
788
857
  url: 'optional - URL to navigate to after pausing debugger (Defaults to nil)'
789
858
  )
790
859
 
791
- browser_obj1 = #{self}.step_into(
860
+ #{self}.step_into(
861
+ browser_obj: 'required - browser_obj returned from #open method)'
862
+ )
863
+
864
+ #{self}.step_out(
792
865
  browser_obj: 'required - browser_obj returned from #open method)'
793
866
  )
794
867
 
795
- browser_obj1 = #{self}.step_out(
868
+ #{self}.step_over(
796
869
  browser_obj: 'required - browser_obj returned from #open method)'
797
870
  )
798
871
 
799
- browser_obj1 = #{self}.step_over(
872
+ #{self}.toggle_devtools(
800
873
  browser_obj: 'required - browser_obj returned from #open method)'
801
874
  )
802
875
 
876
+ #{self}.jmp_devtools_panel(
877
+ browser_obj: 'required - browser_obj returned from #open method)',
878
+ panel: 'optional - panel to switch to :elements|:inspector|:console|:debugger|:sources|:network'
879
+ )
880
+
803
881
  browser_obj1 = #{self}.close(
804
882
  browser_obj: 'required - browser_obj returned from #open method)'
805
883
  )
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.184'
4
+ VERSION = '0.5.186'
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.184
4
+ version: 0.5.186
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.