gchq / gchq/CyberChef

Operation request: Prepend/append text

Open
#1,387 6 comments 1 reaction 0 assignees View on GitHub
feature operation
Dominant language
JavaScript
Stars
35.8k
Forks
4.1k
Avg merge
2d 26m
Merged PRs (30d)
33

Description

## Summary

Especially when using the fork or the subsection operation, it would be useful to be able to

1. Extract relevant parts
2. Modify them
3. Wrap them in surrounding text

The last step here is rather clunky at the moment, since it involves having to whip out find and replace regex which simply match everything

Up to step 2
![image](https://user-images.githubusercontent.com/10220080/180448119-b06b9c36-e09f-413f-aa26-2192703c5c79.png)

Current workaround for step 3, notice how the regex is quite odd since `.*` doesn't work as expected.

![image](https://user-images.githubusercontent.com/10220080/180448616-dfb3d20b-aec0-442a-9f2d-7e237270c2f7.png)

### Example

https://gchq.github.io/CyberChef/#recipe=Subsection('%20%5C%5Cd%2B',true,true,false)Find_/_Replace(%7B'option':'Regex','string':'(%5C%5Cd%2B)'%7D,'$1%201',true,false,true,false)Sum('Space')Find_/_Replace(%7B'option':'Regex','string':'%5B%5E%5D%2B'%7D,'%20$%26',true,false,true,true)&input=bWVzc2FnZSBHYW1lQWN0aW9uIHsKICAgIG9uZW9mIGFjdGlvbiB7CiAgICAgICAgQ2xpZW50UGxheWVyTW92ZSB1aW50MzIgY19wbGF5ZXJfbW92ZSA9IDA7CiAgICAgICAgU2VydmVyUGxheWVyTW92ZSBzX3BsYXllcl9tb3ZlID0gMTsKCiAgICAgICAgQ2xpZW50UGxheWVyVXBkYXRlIGNfcGxheWVyX3VwZGF0ZSA9IDI7CiAgICAgICAgU2VydmVyUGxheWVyVXBkYXRlIHNfcGxheWVyX3VwZGF0ZSA9IDM7CiAgICB9Cn0

Contributor guide

Open the contributing guide

Research direction

Start by examining the existing Fork and Subsection operations and the linked CyberChef recipe to understand how extracted text is currently modified and wrapped. Done means providing a way to prepend and append surrounding text without the workaround regex, with behavior covering the extraction and modification workflow described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.