33import  os 
44import  sys 
55import  argparse 
6+ import  textwrap 
67from  elasticsearch  import  Elasticsearch 
78from  ssl  import  create_default_context 
89from  lib .watcherimporter  import  WatcherImporter 
@@ -40,6 +41,8 @@ def _setup_cli_args():
4041    --watcher-dir=/home/bruce/vigilante/watchlist 
4142
4243""" )
44+ 
45+ 
4346    parser .add_argument ('--watcher-dir' , metavar = 'dirpath' , default = 'watchers' ,
4447                        help = 'Directory containing watch definitions' )
4548    parser .add_argument ('--dry-run' , default = False , action = 'store_true' ,
@@ -48,9 +51,14 @@ def _setup_cli_args():
4851                        help = 'A X509 trusted CA file to use for Elasticsearch HTTPS connections' )
4952    parser .add_argument ('--es-host' , metavar = 'host' , required = True , action = 'append' ,
5053                        help = 'Elasticsearch API hostname(s)' )
51-     parser .add_argument ('--es-user' , metavar = 'user' , help = 'Username for Elasticsearch authentication' , nargs = '?' ,
54+     parser .add_argument ('--es-user' , metavar = 'user' , help = 'Username for Elasticsearch authentication. ' , nargs = '?' ,
5255                        default = None )
53-     parser .add_argument ('--es-pass' , metavar = 'pass' , help = 'Password for Elasticsearch authentication' , nargs = '?' ,
56+     parser .add_argument ('--es-pass' , metavar = 'pass' ,
57+                         help = ''' 
58+                         Password for Elasticsearch authentication. 
59+                         Use - (hypen) for asking password during script execution. 
60+                         ''' ,
61+                         nargs = '?' ,
5462                        default = None )
5563    parser .add_argument ('--es-insecure' ,
5664                        help = ''' 
@@ -64,10 +72,16 @@ def _setup_cli_args():
6472    return  parser .parse_args ()
6573
6674
75+ 
76+ 
6777def  main ():
6878    args  =  _setup_cli_args ()
6979    logger  =  _logger_factory ()
7080
81+     if  args .es_pass  ==  "-" :
82+         es_pass  =  input ("Enter your Elasticsearch password or leave empty if you don't use password: " )
83+         args .es_pass  =  es_pass 
84+ 
7185    if  args .es_insecure :
7286        logger .critical ('I\' m sorry Dave, I\' m afraid I can\' t do that. '  + 
7387                        'I just prevented you from shooting your own foot with a '  + 
0 commit comments