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 +4 -4
- data/README.md +3 -3
- data/lib/pwn/plugins/transparent_browser.rb +116 -41
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 285a68a2cda6bbdd1ae33ec4a3fd37f5831f27780eb55b1b405ac3d01c14cf9d
|
4
|
+
data.tar.gz: 145f7a73a322bd700cd0852c1e35349413ab45ff1e2e71e3895f43c8c0e457a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
40
|
+
pwn[v0.5.310]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](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.
|
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.
|
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
|
-
|
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
|
518
|
-
const config = {
|
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
|
533
|
+
// Callback function to handle mutations
|
521
534
|
const callback = (mutationList, observer) => {
|
522
|
-
|
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
|
-
|
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
|
-
|
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
|
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: '
|
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
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
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: '
|
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