pwn 0.5.308 → 0.5.310

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: 8cf8d3e6c50a8caa34200e9dee3323ac1c689ff2381db4a8b39a8cc51eb7f245
4
- data.tar.gz: 82fd38322306d70277792942ed664bef3a03e0704a30fddbf54fcfc3a82c5a24
3
+ metadata.gz: 285a68a2cda6bbdd1ae33ec4a3fd37f5831f27780eb55b1b405ac3d01c14cf9d
4
+ data.tar.gz: 145f7a73a322bd700cd0852c1e35349413ab45ff1e2e71e3895f43c8c0e457a1
5
5
  SHA512:
6
- metadata.gz: e4e48ca74897cd2cbfe03f961b2922ad1c9d66cadb8c2ce831945e1a935cc227b81c6898991c9bea8b38a3218f14a892699f1766ed566949a99a4de8a8dfe167
7
- data.tar.gz: d7a13a43336ed4bb3301f1c52faa60d771552078521036c8e1090843b3ec70b88c8b16b802ec2eca63fd06f56d4a5dae000d8df19bafed5040cdead98a48b851
6
+ metadata.gz: 212678e418bcf5fe6c4c5d2c6ed9c5ef0ebf31ed526ec72b52a81dacab60d53eff8637631259f0e267c4eb870dbda6de891fa31cf1ed8aca44d44585ec27ac07
7
+ data.tar.gz: e7bbae0e1600fa8f712c663eb787cc93edfeced5c8324617d616cb6981d881ac0aad6d41f2510ec340891f46d717c8dcb9ac39317512fa1cf28e37c1f389f8fa
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.308]:001 >>> PWN.help
40
+ pwn[v0.5.310]: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.4.4@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.5.308]:001 >>> PWN.help
55
+ pwn[v0.5.310]: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.4.4@pwn
62
62
  $ rvmsudo gem uninstall --all --executables pwn
63
63
  $ rvmsudo gem install --verbose pwn
64
64
  $ pwn
65
- pwn[v0.5.308]:001 >>> PWN.help
65
+ pwn[v0.5.310]: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:
@@ -461,7 +461,8 @@ module PWN
461
461
  # Supported Method Parameters::
462
462
  # console_resp = PWN::Plugins::TransparentBrowser.console(
463
463
  # browser_obj: browser_obj1,
464
- # js: 'required - JavaScript expression to evaluate'
464
+ # js: 'required - JavaScript expression to evaluate',
465
+ # return_to: 'optional - return to :console or :stdout (defaults to :console)'
465
466
  # )
466
467
 
467
468
  public_class_method def self.console(opts = {})
@@ -469,13 +470,20 @@ module PWN
469
470
  verify_devtools_browser(browser_obj: browser_obj)
470
471
 
471
472
  js = opts[:js] ||= "alert('ACK from => #{self}')"
473
+ return_to = opts[:return_to] ||= :console
474
+ raise 'ERROR: return_to parameter must be :console or :stdout' unless %i[console stdout].include?(return_to.to_s.downcase.to_sym)
472
475
 
473
476
  browser = browser_obj[:browser]
474
477
  case js
475
478
  when 'clear', 'clear;', 'clear()', 'clear();'
476
479
  script = 'console.clear()'
477
480
  else
478
- script = "console.log(#{js})"
481
+ case return_to.to_s.downcase.to_sym
482
+ when :stdout
483
+ script = "return #{js}"
484
+ when :console
485
+ script = "console.log(#{js})"
486
+ end
479
487
  end
480
488
 
481
489
  console_resp = nil
@@ -494,12 +502,12 @@ module PWN
494
502
  end
495
503
 
496
504
  # Supported Method Parameters::
497
- # console_resp = PWN::Plugins::TransparentBrowser.enable_dom_mutations(
505
+ # console_resp = PWN::Plugins::TransparentBrowser.view_dom_mutations(
498
506
  # browser_obj: browser_obj1,
499
507
  # target: 'optional - target JavaScript node to observe (defaults to document.body)'
500
508
  # )
501
509
 
502
- public_class_method def self.enable_dom_mutations(opts = {})
510
+ public_class_method def self.view_dom_mutations(opts = {})
503
511
  browser_obj = opts[:browser_obj]
504
512
  verify_devtools_browser(browser_obj: browser_obj)
505
513
 
@@ -511,29 +519,117 @@ module PWN
511
519
  )
512
520
 
513
521
  js = <<~JAVASCRIPT
514
- // Select the target node to observe
522
+ // Select the target node to observe (replace 'target-id' with your element's ID or use document.body)
515
523
  const targetNode = document.getElementById(#{target}) || document.body;
516
524
 
517
- // Configuration for observer
518
- const config = { attributes: true, childList: true, subtree: true };
525
+ // Configuration for MutationObserver
526
+ const config = {
527
+ attributes: true, // Observe attribute changes
528
+ childList: true, // Observe additions/removals of child nodes
529
+ subtree: true, // Observe descendants
530
+ characterData: true, // Observe text content changes
531
+ };
519
532
 
520
- // Callback for mutations
533
+ // Callback function to handle mutations
521
534
  const callback = (mutationList, observer) => {
522
- for (const mutation of mutationList) {
535
+ console.group('DOM Mutation Detected');
536
+ mutationList.forEach((mutation, index) => {
537
+ console.log(`Mutation ${index + 1}:`, mutation.type);
538
+
523
539
  if (mutation.type === 'childList') {
524
- console.log('Child node added/removed:', mutation);
540
+ // Log added or removed nodes
541
+ if (mutation.addedNodes.length) {
542
+ mutation.addedNodes.forEach((node) => {
543
+ if (node.nodeType === Node.ELEMENT_NODE) {
544
+ console.log('Added Element:', {
545
+ tagName: node.tagName,
546
+ id: node.id || 'N/A',
547
+ classList: node.className || 'N/A',
548
+ outerHTML: node.outerHTML,
549
+ });
550
+ } else if (node.nodeType === Node.TEXT_NODE) {
551
+ console.log('Added Text Node:', {
552
+ textContent: node.textContent,
553
+ parentTag: node.parentElement?.tagName || 'N/A',
554
+ });
555
+ }
556
+ });
557
+ }
558
+ if (mutation.removedNodes.length) {
559
+ mutation.removedNodes.forEach((node) => {
560
+ if (node.nodeType === Node.ELEMENT_NODE) {
561
+ console.log('Removed Element:', {
562
+ tagName: node.tagName,
563
+ id: node.id || 'N/A',
564
+ classList: node.className || 'N/A',
565
+ outerHTML: node.outerHTML,
566
+ });
567
+ } else if (node.nodeType === Node.TEXT_NODE) {
568
+ console.log('Removed Text Node:', {
569
+ textContent: node.textContent,
570
+ parentTag: node.parentElement?.tagName || 'N/A',
571
+ });
572
+ }
573
+ });
574
+ }
525
575
  } else if (mutation.type === 'attributes') {
526
- console.log(`Attribute ${mutation.attributeName} modified:`, mutation);
576
+ // Log attribute changes
577
+ console.log(`Attribute "${mutation.attributeName}" modified on`, {
578
+ element: mutation.target.tagName,
579
+ id: mutation.target.id || 'N/A',
580
+ oldValue: mutation.oldValue,
581
+ newValue: mutation.target.getAttribute(mutation.attributeName),
582
+ outerHTML: mutation.target.outerHTML,
583
+ });
584
+ } else if (mutation.type === 'characterData') {
585
+ // Log text content changes (e.g., from user input in contenteditable or form fields)
586
+ console.log('Text Content Changed:', {
587
+ element: mutation.target.parentElement?.tagName || 'N/A',
588
+ id: mutation.target.parentElement?.id || 'N/A',
589
+ oldValue: mutation.oldValue,
590
+ newValue: mutation.target.textContent,
591
+ innerHTML: mutation.target.parentElement?.innerHTML || 'N/A',
592
+ });
527
593
  }
528
- }
594
+ });
595
+ console.groupEnd();
529
596
  };
530
597
 
531
- // Create and start observer
598
+ // Create and start the MutationObserver
532
599
  const observer = new MutationObserver(callback);
533
600
  observer.observe(targetNode, config);
601
+
602
+ // Optional: Add event listeners to capture user interactions
603
+ const logUserInteraction = (event) => {
604
+ console.group('User Interaction Detected');
605
+ console.log('Event Type:', event.type);
606
+ console.log('Target:', {
607
+ tagName: event.target.tagName,
608
+ id: event.target.id || 'N/A',
609
+ classList: event.target.className || 'N/A',
610
+ value: 'value' in event.target ? event.target.value : 'N/A',
611
+ innerHTML: event.target.innerHTML || 'N/A',
612
+ });
613
+ console.groupEnd();
614
+ };
615
+
616
+ // Attach listeners for keyboard and click events
617
+ document.addEventListener('input', logUserInteraction); // For form inputs, contenteditable
618
+ document.addEventListener('click', logUserInteraction); // For clicks
619
+
620
+ // Function to stop the observer (run in console when needed)
621
+ window.stopObserving = () => {
622
+ observer.disconnect();
623
+ document.removeEventListener('input', logUserInteraction);
624
+ document.removeEventListener('click', logUserInteraction);
625
+ console.log('MutationObserver and event listeners stopped.');
626
+ };
627
+
628
+ // Log instructions to console
629
+ console.log('MutationObserver started. To stop, run: stopObserving()');
534
630
  JAVASCRIPT
535
631
 
536
- console(browser_obj: browser_obj, js: 'console.clear();')
632
+ console(browser_obj: browser_obj, js: 'clear();')
537
633
  browser = browser_obj[:browser]
538
634
  browser.execute_script(js)
539
635
  rescue StandardError => e
@@ -541,11 +637,11 @@ module PWN
541
637
  end
542
638
 
543
639
  # Supported Method Parameters::
544
- # console_resp = PWN::Plugins::TransparentBrowser.disable_dom_mutations(
640
+ # console_resp = PWN::Plugins::TransparentBrowser.hide_dom_mutations(
545
641
  # browser_obj: browser_obj1
546
642
  # )
547
643
 
548
- public_class_method def self.disable_dom_mutations(opts = {})
644
+ public_class_method def self.hide_dom_mutations(opts = {})
549
645
  browser_obj = opts[:browser_obj]
550
646
  verify_devtools_browser(browser_obj: browser_obj)
551
647
 
@@ -555,38 +651,20 @@ module PWN
555
651
  )
556
652
 
557
653
  js = <<~JAVASCRIPT
558
- // Select the target node to observe
559
- const targetNode = document.getElementById(#{target}) || document.body;
560
-
561
- // Configuration for observer
562
- const config = { attributes: true, childList: true, subtree: true };
563
-
564
- // Callback for mutations
565
- const callback = (mutationList, observer) => {
566
- for (const mutation of mutationList) {
567
- if (mutation.type === 'childList') {
568
- console.log('Child node added/removed:', mutation);
569
- } else if (mutation.type === 'attributes') {
570
- console.log(`Attribute ${mutation.attributeName} modified:`, mutation);
571
- }
572
- }
573
- };
574
-
575
- // Create and start observer
576
- const observer = new MutationObserver(callback);
577
- observer.observe(targetNode, config);
578
-
579
- // Later, stop observing if needed
580
- observer.disconnect();
654
+ if (typeof stopObserving === 'function') {
655
+ stopObserving();
656
+ console.log('DOM mutation observer and event listeners disabled.');
657
+ } else {
658
+ console.log('Error: stopObserving function not found. DOM mutation observer was not active.');
659
+ }
581
660
  JAVASCRIPT
582
661
 
583
- console(browser_obj: browser_obj, js: 'console.clear();')
662
+ console(browser_obj: browser_obj, js: 'clear();')
584
663
  browser = browser_obj[:browser]
585
664
  browser.execute_script(js)
586
665
  rescue StandardError => e
587
666
  raise e
588
667
  end
589
-
590
668
  # Supported Method Parameters::
591
669
  # PWN::Plugins::TransparentBrowser.update_about_config(
592
670
  # browser_obj: browser_obj1,
@@ -1175,12 +1253,14 @@ module PWN
1175
1253
  js: 'required - JavaScript expression to evaluate'
1176
1254
  )
1177
1255
 
1178
- console_resp = #{self}.enable_dom_mutations(
1179
- browser_obj: 'required - browser_obj returned from #open method)'
1256
+ console_resp = #{self}.view_dom_mutations(
1257
+ browser_obj: 'required - browser_obj returned from #open method)',
1258
+ target: 'optional - target JavaScript node to observe (defaults to document.body)'
1180
1259
  )
1181
1260
 
1182
- console_resp = #{self}.disable_dom_mutations(
1183
- browser_obj: 'required - browser_obj returned from #open method)'
1261
+ console_resp = #{self}.hide_dom_mutations(
1262
+ browser_obj: 'required - browser_obj returned from #open method)',
1263
+ target: 'optional - target JavaScript node to observe (defaults to document.body)'
1184
1264
  )
1185
1265
 
1186
1266
  #{self}.update_about_config(
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.308'
4
+ VERSION = '0.5.310'
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.308
4
+ version: 0.5.310
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.