Write-up to CyberChef #
I use the online tool CyberChef, that can send http requests and contains modules to quickly evaluate something. The following examples should illustrate the functionality.
Task 1 - Extract email address #
The email addresses of a web page are to be extracted.
The target website has not relaxed the SOP with CORS, which is why the browser does not get the response from mcs.unibnf.ch. However, this can easily be circumvented if we put a proxy in between and set the access-control-allow-origin header to *. Alternatively the browser can also disable certain security mechanisms.
The proxy setup in ZAP is set up under Tools/Replacer Options:
We create web requests with the URLs:
- https://mcs.unibnf.ch/lecturers-list/page/$R0/ where $R0 goes from 2 - 5.
So the tool has to make 5 requests with one condition included because the first URL is different.
So the flow is like this:
- start 5 threads
- check if I am the first
- if yes, then jump to the first request type
- if no, then jump to the second request type
- merge all threads
- extract all emails from the result
- remove duplicates
The Recipe for CyberChef can be used with input 1, 2, 3, 4, 5.
Task 2 - Forking #
An input is to be taken as a list and then transformed into a list of hashes.
The output is as follows:
- ===== NEXT ======
The process is like this:
- generate all hashes
- search & replace with regex replace last character with ===== NEXT
- implicit merge
Task 3 - Forking & Web Requests #
- The fork, merge, register building blocks are to be explained.
- Number of unique email addresses of pages 2 - 5 of https://mcs.unibnf.ch/lecturers-list/page/XXX/
- Fork: Similar to C, the following code is executed per input “group”. The group can be a simple line or selected with regex.
- Merge: Similar to C, all branches are merged again, and the following code is on a “path”.
- Register: Stores an input “group” in a register. The first group is stored in $RO. Together with Fork, a for_each loop can be built this way. The register is used as input for other blocks (example at the bottom of the recipe).
The procedure to find the email addresses is like this:
- send a web request
- extract email
- make list unique
- read number in output window