mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Tidied up 'Play Media' operation
This commit is contained in:
parent
8c6c3a1c01
commit
01c4cfdc8d
3 changed files with 16 additions and 9 deletions
|
@ -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"
|
||||
]
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue