Tidied up 'Play Media' operation

master
n1474335 2018-12-19 17:58:38 +00:00
parent 8c6c3a1c01
commit 01c4cfdc8d
3 changed files with 16 additions and 9 deletions

View File

@ -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]
@ -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
@ -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
@ -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

View File

@ -342,8 +342,12 @@
]
},
{
"name": "Multimedia",
"name": "Forensics",
"ops": [
"Detect File Type",
"Scan for Embedded Files",
"Remove EXIF",
"Extract EXIF",
"Render Image",
"Play Media"
]
@ -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"
]

View File

@ -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";
@ -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 [];
@ -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;
@ -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.
*/