Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push input through postmessage #1992

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kenduguay1
Copy link

Feature to allow pushing the input value to chef via a postMessage. This allows other websites to integrate with CyberChef by loading CyberChef in an iframe and setting its input data.

The following html can be placed into a file in the public directory to demonstrate the intended use.

<!doctype html>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<iframe src="http://localhost:8080/", title="cyberchef", height="500px", width="70%", id="chefFrame"></iframe>
<br>
<button onclick="pushToChef()">Test</button>
<input type="text", id="dataInput">
<script>
    function pushToChef() {
        data = $("#dataInput")[0].value
        target = $("#chefFrame")[0]
        target.contentWindow.postMessage({
            "type": "dataSubmit",
            "value": data
        })
    }
</script>

@CLAassistant
Copy link

CLAassistant commented Feb 28, 2025

CLA assistant check
All committers have signed the CLA.

Add handler for message events
@kenduguay1 kenduguay1 force-pushed the push-input-through-postmessage branch from 3211a38 to 7710c5e Compare February 28, 2025 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants