pwn 0.5.309 → 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: 04b9816658aabc56840644ad45c4ad7a7acb67f2115027eaabdb2745c6305571
4
- data.tar.gz: 2dfcea55bc83eefbb84e1bad2ee900d760acf8271a2ddac00badebe421411985
3
+ metadata.gz: 285a68a2cda6bbdd1ae33ec4a3fd37f5831f27780eb55b1b405ac3d01c14cf9d
4
+ data.tar.gz: 145f7a73a322bd700cd0852c1e35349413ab45ff1e2e71e3895f43c8c0e457a1
5
5
  SHA512:
6
- metadata.gz: dd2ef466bcb48f2110f569f25645213c9d3ab6e6d71dedbed6b465b46e3f85995d067f87708326009d14f23d8f84fbf28669d9114df3034afbd04a2495dc5fef
7
- data.tar.gz: e3111e88a91cc06a6ee9a950feda54527918ab27b5c2cfaa174128dfcd79185acc6d8eef9c0592fe1a30a5c4d5c83a273359be5246ff9be89b8dc761e5231ec3
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.309]: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.309]: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.309]: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
@@ -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
@@ -542,54 +638,33 @@ module PWN
542
638
 
543
639
  # Supported Method Parameters::
544
640
  # console_resp = PWN::Plugins::TransparentBrowser.hide_dom_mutations(
545
- # browser_obj: browser_obj1,
546
- # target: 'optional - target JavaScript node to observe (defaults to document.body)'
641
+ # browser_obj: browser_obj1
547
642
  # )
548
643
 
549
644
  public_class_method def self.hide_dom_mutations(opts = {})
550
645
  browser_obj = opts[:browser_obj]
551
646
  verify_devtools_browser(browser_obj: browser_obj)
552
647
 
553
- target = opts[:target] ||= 'undefined'
554
-
555
648
  jmp_devtools_panel(
556
649
  browser_obj: browser_obj,
557
650
  panel: :console
558
651
  )
559
652
 
560
653
  js = <<~JAVASCRIPT
561
- // Select the target node to observe
562
- const targetNode = document.getElementById(#{target}) || document.body;
563
-
564
- // Configuration for observer
565
- const config = { attributes: true, childList: true, subtree: true };
566
-
567
- // Callback for mutations
568
- const callback = (mutationList, observer) => {
569
- for (const mutation of mutationList) {
570
- if (mutation.type === 'childList') {
571
- console.log('Child node added/removed:', mutation);
572
- } else if (mutation.type === 'attributes') {
573
- console.log(`Attribute ${mutation.attributeName} modified:`, mutation);
574
- }
575
- }
576
- };
577
-
578
- // Create and start observer
579
- const observer = new MutationObserver(callback);
580
- observer.observe(targetNode, config);
581
-
582
- // Later, stop observing if needed
583
- 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
+ }
584
660
  JAVASCRIPT
585
661
 
586
- console(browser_obj: browser_obj, js: 'console.clear();')
662
+ console(browser_obj: browser_obj, js: 'clear();')
587
663
  browser = browser_obj[:browser]
588
664
  browser.execute_script(js)
589
665
  rescue StandardError => e
590
666
  raise e
591
667
  end
592
-
593
668
  # Supported Method Parameters::
594
669
  # PWN::Plugins::TransparentBrowser.update_about_config(
595
670
  # browser_obj: browser_obj1,
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.309'
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.309
4
+ version: 0.5.310
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.