Skip to content

Commit

Permalink
Tidied up 'Play Media' operation
Browse files Browse the repository at this point in the history
  • Loading branch information
n1474335 committed Dec 19, 2018
1 parent 8c6c3a1 commit 01c4cfd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
All major and minor version changes will be documented in this file. Details of patch-level version changes can be found in [commit messages](https://github.com/gchq/CyberChef/commits/master).


### [8.16.0] - 2018-12-19
- 'Play Media' operation added [@anthony-arnold] | [#446]

### [8.15.0] - 2018-12-18
- 'Text Encoding Brute Force' operation added [@Cynser] | [#439]

Expand Down Expand Up @@ -76,6 +79,7 @@ All major and minor version changes will be documented in this file. Details of



[8.16.0]: https://github.com/gchq/CyberChef/releases/tag/v8.16.0
[8.15.0]: https://github.com/gchq/CyberChef/releases/tag/v8.15.0
[8.14.0]: https://github.com/gchq/CyberChef/releases/tag/v8.14.0
[8.13.0]: https://github.com/gchq/CyberChef/releases/tag/v8.13.0
Expand Down Expand Up @@ -112,6 +116,7 @@ All major and minor version changes will be documented in this file. Details of
[@jarmovanlenthe]: https://github.com/jarmovanlenthe
[@tcode2k16]: https://github.com/tcode2k16
[@Cynser]: https://github.com/Cynser
[@anthony-arnold]: https://github.com/anthony-arnold

[#95]: https://github.com/gchq/CyberChef/pull/299
[#173]: https://github.com/gchq/CyberChef/pull/173
Expand All @@ -138,3 +143,4 @@ All major and minor version changes will be documented in this file. Details of
[#439]: https://github.com/gchq/CyberChef/pull/439
[#441]: https://github.com/gchq/CyberChef/pull/441
[#443]: https://github.com/gchq/CyberChef/pull/443
[#446]: https://github.com/gchq/CyberChef/pull/446
10 changes: 5 additions & 5 deletions src/core/config/Categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,12 @@
]
},
{
"name": "Multimedia",
"name": "Forensics",
"ops": [
"Detect File Type",
"Scan for Embedded Files",
"Remove EXIF",
"Extract EXIF",
"Render Image",
"Play Media"
]
Expand All @@ -354,16 +358,12 @@
"Entropy",
"Frequency distribution",
"Chi Square",
"Detect File Type",
"Scan for Embedded Files",
"Disassemble x86",
"Pseudo-Random Number Generator",
"Generate UUID",
"Generate TOTP",
"Generate HOTP",
"Haversine distance",
"Remove EXIF",
"Extract EXIF",
"Numberwang",
"XKCD Random Number"
]
Expand Down
9 changes: 5 additions & 4 deletions src/core/operations/PlayMedia.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class PlayMedia extends Operation {
super();

this.name = "Play Media";
this.module = "Media";
this.description = "Plays the input as sound or video depending on the type.";
this.module = "Default";
this.description = "Plays the input as audio or video depending on the type.<br><br>Tags: sound, movie, mp3, mp4, mov, webm, wav, ogg";
this.infoURL = "";
this.inputType = "string";
this.outputType = "byteArray";
Expand All @@ -44,7 +44,7 @@ class PlayMedia extends Operation {
* @returns {byteArray} The multimedia data as bytes.
*/
run(input, args) {
const inputFormat = args[0];
const [inputFormat] = args;

if (!input.length) return [];

Expand All @@ -68,7 +68,7 @@ class PlayMedia extends Operation {
// Determine file type
const type = Magic.magicFileType(input);
if (!(type && /^audio|video/.test(type.mime))) {
throw new OperationError("Invalid file type");
throw new OperationError("Invalid or unrecognised file type");
}

return input;
Expand All @@ -77,6 +77,7 @@ class PlayMedia extends Operation {
/**
* Displays an audio or video element that may be able to play the media
* file.
*
* @param data {byteArray} Data containing an audio or video file.
* @returns {string} Markup to display a media player.
*/
Expand Down

0 comments on commit 01c4cfd

Please sign in to comment.