Skip to content

Commit 01c4cfd

Browse files
committed
Tidied up 'Play Media' operation
1 parent 8c6c3a1 commit 01c4cfd

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
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).
33

44

5+
### [8.16.0] - 2018-12-19
6+
- 'Play Media' operation added [@anthony-arnold] | [#446]
7+
58
### [8.15.0] - 2018-12-18
69
- 'Text Encoding Brute Force' operation added [@Cynser] | [#439]
710

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

7780

7881

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

116121
[#95]: https://github.com/gchq/CyberChef/pull/299
117122
[#173]: https://github.com/gchq/CyberChef/pull/173
@@ -138,3 +143,4 @@ All major and minor version changes will be documented in this file. Details of
138143
[#439]: https://github.com/gchq/CyberChef/pull/439
139144
[#441]: https://github.com/gchq/CyberChef/pull/441
140145
[#443]: https://github.com/gchq/CyberChef/pull/443
146+
[#446]: https://github.com/gchq/CyberChef/pull/446

src/core/config/Categories.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,12 @@
342342
]
343343
},
344344
{
345-
"name": "Multimedia",
345+
"name": "Forensics",
346346
"ops": [
347+
"Detect File Type",
348+
"Scan for Embedded Files",
349+
"Remove EXIF",
350+
"Extract EXIF",
347351
"Render Image",
348352
"Play Media"
349353
]
@@ -354,16 +358,12 @@
354358
"Entropy",
355359
"Frequency distribution",
356360
"Chi Square",
357-
"Detect File Type",
358-
"Scan for Embedded Files",
359361
"Disassemble x86",
360362
"Pseudo-Random Number Generator",
361363
"Generate UUID",
362364
"Generate TOTP",
363365
"Generate HOTP",
364366
"Haversine distance",
365-
"Remove EXIF",
366-
"Extract EXIF",
367367
"Numberwang",
368368
"XKCD Random Number"
369369
]

src/core/operations/PlayMedia.mjs

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class PlayMedia extends Operation {
2323
super();
2424

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

4949
if (!input.length) return [];
5050

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

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

0 commit comments

Comments
 (0)