From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id CCB274356C for ; Sun, 18 Dec 2022 01:07:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE3A168B7F1; Sun, 18 Dec 2022 03:07:26 +0200 (EET) Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6BFE68B263 for ; Sun, 18 Dec 2022 03:07:19 +0200 (EET) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 0EDA327D5EE for ; Sun, 18 Dec 2022 02:07:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1671325639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ThwS/L6In6IUKl3C5n/8JeKxdlgLHGKYRhON85I3C/Y=; b=DrI/6wqK5HRIMkTcaFbdcyT87yChSqMz5qoOJP+KpJ1fNya9E4ecktyIdUpCUkVA6X9WE6 onOz/38kkxfIlv50QDPHjvweRdLhXLGeCEpaRVvOFUbtHiPngoJPaRn1rgUjTk5XJIccVq 3aN+a4m0JxCe6RQfPau8sA2rYvOkCNmx2f34fi5PIXvqUNxs4yJdpaAe9XLcEFPvX1O7ee 97Jvd9A6CPt5vPDCeaNvPNotywI36xmPlsoRXw9GtW+D19A5BcB2MrXdiuKCu8Z/++62+M HcIaRyL/NXa9SomUxWFF+gMeHbK6oLS7ILlFZdST8ypvUpq+yy8C1eCMdTxodg== Message-ID: <0bc70706-31f3-9807-aebf-ccf648261c06@rothenpieler.org> Date: Sun, 18 Dec 2022 02:07:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 To: ffmpeg-devel@ffmpeg.org References: <1f01a2a041ba4e809ec8d9175fde8d8e@huawei.com> Content-Language: en-US From: Timo Rothenpieler In-Reply-To: <1f01a2a041ba4e809ec8d9175fde8d8e@huawei.com> Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg_ffplay_ffprobe_cmdutils: add -safe to replace the user name and password in the protocol address X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 17.12.2022 08:36, Wujian(Chin) wrote: > The Protocol address may contain the user name and password. The ps -ef command may expose the plaintext. > The -safe parameter option is added to replace the user name and password in the command line with the asterisk (*). > > Signed-off-by: wujian_nanjing > --- > doc/ffmpeg.texi | 7 +++++++ > doc/ffplay.texi | 8 ++++++++ > doc/ffprobe.texi | 7 +++++++ > fftools/cmdutils.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- > fftools/cmdutils.h | 15 +++++++++++++++ > fftools/ffmpeg.c | 16 +++++++++++++--- > fftools/ffplay.c | 15 +++++++++++++-- > fftools/ffprobe.c | 18 ++++++++++++++---- > 8 files changed, 120 insertions(+), 13 deletions(-) > > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi > index 0367930..e905542 100644 > --- a/doc/ffmpeg.texi > +++ b/doc/ffmpeg.texi > @@ -50,6 +50,13 @@ output files. Also do not mix options which belong to different files. All > options apply ONLY to the next input or output file and are reset between files. > > @itemize > +@item -safe > +The Protocol address may contain the user name and password. The ps -ef command may expose the plaintext. > +The -safe parameter option is added to replace the user name and password in the command line with the asterisk (*). > +@example > +ffmpeg -safe -i rtsp://username@password.xxxx.com > +@end example > + > @item > To set the video bitrate of the output file to 64 kbit/s: > @example > diff --git a/doc/ffplay.texi b/doc/ffplay.texi > index 5dd860b..f46ca91 100644 > --- a/doc/ffplay.texi > +++ b/doc/ffplay.texi > @@ -122,6 +122,14 @@ Read @var{input_url}. > > @section Advanced options > @table @option > + > +@item -safe > +The Protocol address may contain the user name and password. The ps -ef command may expose the plaintext. > +The -safe parameter option is added to replace the user name and password in the command line with the asterisk (*). > +@example > +ffplay -safe -i rtsp://username@password.xxxx.com > +@end example > + > @item -stats > Print several playback statistics, in particular show the stream > duration, the codec parameters, the current position in the stream and > diff --git a/doc/ffprobe.texi b/doc/ffprobe.texi > index 4dc9f57..92b13cf 100644 > --- a/doc/ffprobe.texi > +++ b/doc/ffprobe.texi > @@ -89,6 +89,13 @@ Set the output printing format. > @var{writer_name} specifies the name of the writer, and > @var{writer_options} specifies the options to be passed to the writer. > > +@item -safe > +The Protocol address may contain the user name and password. The ps -ef command may expose the plaintext. > +The -safe parameter option is added to replace the user name and password in the command line with the asterisk (*). > +@example > +ffprobe -safe -i rtsp://username@password.xxxx.com > +@end example > + > For example for printing the output in JSON format, specify: > @example > -print_format json > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index a1de621..22407f8 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -61,6 +61,40 @@ AVDictionary *format_opts, *codec_opts; > > int hide_banner = 0; > > +void param_masking(int argc, char **argv) { > + int i, j; > + for (i = 1; i < argc; i++) { > + char *match = strstr(argv[i], "://"); > + if (match) { > + int total = strlen(argv[i]); > + for (j = 0; j < total; j++) { > + argv[i][j] = '*'; > + } > + } > + } > +} Won't that replace the entire parameter, as in, the full URL, with ***? While the documentation claims only the username/password will be replaced. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".