Escape shell commands

This commit is contained in:
Pierre Rudloff 2016-01-13 19:06:33 +01:00
parent 7f8a36fc0b
commit 4e0f61f3f3

View file

@ -33,7 +33,7 @@ Class VideoDownload
{ {
$config = Config::getInstance(); $config = Config::getInstance();
exec( exec(
$config->python.' '.$config->youtubedl.' --dump-user-agent', escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --dump-user-agent',
$version $version
); );
return $version[0]; return $version[0];
@ -48,7 +48,7 @@ Class VideoDownload
{ {
$config = Config::getInstance(); $config = Config::getInstance();
exec( exec(
$config->python.' '.$config->youtubedl.' --list-extractors', escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl).' --list-extractors',
$extractors $extractors
); );
return $extractors; return $extractors;
@ -65,7 +65,7 @@ Class VideoDownload
static function getFilename($url, $format=null) static function getFilename($url, $format=null)
{ {
$config = Config::getInstance(); $config = Config::getInstance();
$cmd=$config->python.' '.$config->youtubedl; $cmd = escapeshellcmd($config->python).' '.escapeshellarg($config->youtubedl);
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }
@ -88,7 +88,7 @@ Class VideoDownload
static function getJSON($url, $format=null) static function getJSON($url, $format=null)
{ {
$config = Config::getInstance(); $config = Config::getInstance();
$cmd=$config->python.' '.$config->youtubedl.' '.$config->params; $cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params);
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }
@ -114,7 +114,7 @@ Class VideoDownload
static function getURL($url, $format=null) static function getURL($url, $format=null)
{ {
$config = Config::getInstance(); $config = Config::getInstance();
$cmd=$config->python.' '.$config->youtubedl.' '.$config->params; $cmd = escapeshellcmd($config->python.' '.escapeshellarg($config->youtubedl).' '.$config->params);
if (isset($format)) { if (isset($format)) {
$cmd .= ' -f '.escapeshellarg($format); $cmd .= ' -f '.escapeshellarg($format);
} }