Skip to content
main
Switch branches/tags
Code

Latest commit

* Split nasl_send_frame()

Sending the frame is done in a static function to make it reusable

* Move nasl_get_local_mac_address_from_ip() to another file.

The file nasl_frame_forgery.c is the right file for this function

* Split nasl_get_local_mac_address_from_ip to reuse code

* Split nasl_forge_frame to allow reusing code

* Define struct pseudo_eth_arp

* Improve nasl_send_arp_request(). It uses the frame forgery functions and libnet is not requiered anymore.

* Some small code improvements. Use u_char instead of unsigned char. Adjust format with clang-format.

* Fix check of answer size

* Remove member from structure which is not necessary

* Update docker files and cmake. Libnet1 is not necessary anymore.

* Check that all nasl params are satisfied.

* Set message as debug and remove duplicated code line

* Close socket, bpf, and return -1 if no frame was received as answer.

* Improve error handling.

Differentiate no answer and sendmsg error

* Add support for IPv6

run the following script:

`sudo openvas-nasl -X -B -d -i /home/juan/install/var/lib/openvas/plugins -t 192.168.9.141 send_frame_arp_request.nasl`

```
if(description) {
  script_oid("1.2.3");
  exit(0);
}

include("misc_func.inc");

dstip = get_host_ip();
display(send_arp_request(host: dstip));
```

Also, another test, since I added IPv6 support for forge/send frames.

```
if(description) {
  script_oid("1.2.3");
  exit(0);
}

include("misc_func.inc");

myhost = this_host();
port = 22022;
srcport= 35000;
dstip = get_host_ip();

src_mac = raw_string (0x08, 0x00, 0x27, 0x8f, 0x69, 0xbb); # get_local_mac_address can be used
dst_mac = raw_string (0x54, 0xe1, 0xad, 0xd4, 0xed, 0x74); # send_arp_request() can be used

filter = string("src port ", 22022);

ether_proto = 0x86dd;

IP6_v = 0x06;
IP6_P = IPPROTO_TCP;
IP6_HLIM = 0x40;

ip6_packet = forge_ipv6_packet( ip6_v:IP6_v,
                                ip6_p:IP6_P,
                                ip6_hlim:IP6_HLIM,
                                ip6_src:myhost,
                                ip6_dst:dstip );

tcp6 = forge_tcp_v6_packet(ip6 : ip6_packet,
                           th_dport : port,
                           th_flags : TH_SYN,
                           th_sport : srcport,
                           th_x2    : 0,
                           th_win   : 1024,
                           data: "hola mundo");

dump_tcp_v6_packet(tcp6);

display ("Sent");
frame = forge_frame (src_haddr: src_mac, dst_haddr: dst_mac, ether_proto: ether_proto, payload: tcp6);
dump_frame (frame:frame);

display ("Received");
r = send_frame (frame: frame, pcap_filter: filter, timeout: 10);
dump_frame (frame:r);

display ("finished");

```
6d3a797

Git stats

Files

Permalink
Failed to load latest commit information.

Greenbone Logo

OpenVAS

GitHub releases Code Documentation Coverage Docker Pulls Docker Image Size Build and test

This is the Open Vulnerability Assessment Scanner (OpenVAS) of the Greenbone Vulnerability Management (GVM) Solution.

It is used for the Greenbone Security Manager appliances and is a full-featured scan engine that executes a continuously updated and extended feed of Network Vulnerability Tests (NVTs).

Releases

 All release files are signed with the Greenbone Community Feed integrity key. This gpg key can be downloaded at https://www.greenbone.net/GBCommunitySigningKey.asc and the fingerprint is 8AE4 BE42 9B60 A59B 311C 2E73 9823 FAA6 0ED1 E580.

Installation

This module can be configured, built and installed with following commands:

cmake .
make install

For detailed installation requirements and instructions, please see the file INSTALL.md. The file also contains instructions for setting up openvas and for making the scanner available to other GVM modules.

If you are not familiar or comfortable building from source code, we recommend that you use the Greenbone Security Manager TRIAL (GSM TRIAL), a prepared virtual machine with a readily available setup. Information regarding the virtual machine is available at https://www.greenbone.net/en/testnow.

Support

For any question on the usage of openvas please use the Greenbone Community Portal. If you found a problem with the software, please create an issue on GitHub. If you are a Greenbone customer you may alternatively or additionally forward your issue to the Greenbone Support Portal.

Maintainer

This project is maintained by Greenbone Networks GmbH.

Contributing

Your contributions are highly appreciated. Please create a pull request on GitHub. Bigger changes need to be discussed with the development team via the issues section at GitHub first.

License

This module is licensed under the GNU General Public License v2.0 only. Single files, however, are licensed either the GNU General Public License v2.0 only or under GNU General Public License v2.0 or later, please see the COPYING file for details.