File: ssh_test.nasl

package info (click to toggle)
openvas-scanner 23.35.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 22,416 kB
  • sloc: ansic: 41,615; xml: 6,251; pascal: 3,723; yacc: 1,250; sh: 1,068; makefile: 333; sql: 273; javascript: 12
file content (49 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# SPDX-FileCopyrightText: 2023 Greenbone AG
# Some text descriptions might be excerpted from (a) referenced
# source(s), and are Copyright (C) by the respective right holder(s).
#
# SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception

## This shows a simple use case of the nasl ssh functions.

session_id = ssh_connect(port: 22, keytype: "ssh-rsa,ssh-dss");
display(session_id);
#prompt = ssh_login_interactive(session_id, login: "user");
#display(prompt);
#auth = ssh_login_interactive_pass(session_id, pass: "pass");
#a = ssh_set_login(session_id, login: "admin");
auth = ssh_userauth(session_id, login: "user", password: "pass");
display(auth);

#banner = ssh_get_issue_banner(session_id);
#display(banner);
#banner = ssh_get_server_banner(session_id);
#display(banner);

res = ssh_request_exec(session_id, cmd:"ls", stdout: 1, stderr: 1);
display(res);

#m = ssh_get_auth_methods(session_id);
#display(m);

#Check SFTP
#ret = sftp_enabled_check (session_id);
#display("SFTP: ", ret);

# get server pub key
#k = ssh_get_host_key(session_id);
#display(k);
#display(hexstr(k));

#shell = ssh_shell_open(session_id);
#display (shell);
#res = ssh_shell_write(session_id, cmd: "ls -al");
#display(res);
#sleep(1);
#buf = ssh_shell_read (session_id);
#display(buf);
#c = ssh_shell_close(session_id);
#display(c);

d = ssh_disconnect(session_id);
display(d);