"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gvmtools/cli.py" between
gvm-tools-21.6.0.tar.gz and gvm-tools-21.6.1.tar.gz

About: GVM-Tools is a collection of tools that help with remote controlling a Greenbone Security Manager (GSM) appliance and its underlying Greenbone Vulnerability Manager (GVM). Series 21.x.

cli.py  (gvm-tools-21.6.0):cli.py  (gvm-tools-21.6.1)
skipping to change at line 34 skipping to change at line 34
from gvm.protocols.latest import Osp from gvm.protocols.latest import Osp
from gvm.protocols.gmp import Gmp from gvm.protocols.gmp import Gmp
from gvm.transforms import CheckCommandTransform from gvm.transforms import CheckCommandTransform
from gvm.xml import validate_xml_string, pretty_print from gvm.xml import validate_xml_string, pretty_print
from gvmtools.helper import authenticate, do_not_run_as_root from gvmtools.helper import authenticate, do_not_run_as_root
from gvmtools.parser import ( from gvmtools.parser import (
create_parser, create_parser,
create_connection, create_connection,
PROTOCOL_OSP, PROTOCOL_OSP,
PROTOCOL_GMP,
) )
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
HELP_TEXT = """ HELP_TEXT = """
Command line tool to access services via GMP (Greenbone Management Protocol) and OSP (Open Scanner Protocol) Command line tool to access services via GMP (Greenbone Management Protocol) and OSP (Open Scanner Protocol)
Examples: Examples:
gvm-cli socket --help gvm-cli socket --help
gvm-cli tls --help gvm-cli tls --help
skipping to change at line 124 skipping to change at line 125
transform = CheckCommandTransform() transform = CheckCommandTransform()
if args.protocol == PROTOCOL_OSP: if args.protocol == PROTOCOL_OSP:
protocol_class = Osp protocol_class = Osp
else: else:
protocol_class = Gmp protocol_class = Gmp
try: try:
with protocol_class(connection, transform=transform) as protocol: with protocol_class(connection, transform=transform) as protocol:
if isinstance(protocol, Gmp): if args.protocol == PROTOCOL_GMP:
if args.gmp_username: # Ask for password if none are given
# Ask for password if none are given authenticate(protocol, args.gmp_username, args.gmp_password)
authenticate(protocol, args.gmp_username, args.gmp_password)
if args.duration: if args.duration:
starttime = time.time() starttime = time.time()
result = protocol.send_command(xml) result = protocol.send_command(xml)
if args.duration: if args.duration:
duration = time.time() - starttime duration = time.time() - starttime
print(f'Elapsed time: {duration} seconds') print(f'Elapsed time: {duration} seconds')
elif args.pretty: elif args.pretty:
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)