Skip to content

Commit

Permalink
Merge pull request #314 from jjnicola/reverse-lookup
Browse files Browse the repository at this point in the history
Extend osp with target's reverse_lookup_* options.
  • Loading branch information
mattmundell authored Jan 28, 2020
2 parents db57328 + d3c6258 commit b378b41
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add nvti_get_tag() [#285](https://github.com/greenbone/gvm-libs/pull/285)
- Add nvti_solution_method() and nvti_set_solution_method() [#283](https://github.com/greenbone/gvm-libs/pull/283)
- Extend osp with target's alive test option.[#312](https://github.com/greenbone/gvm-libs/pull/312)
- Extend osp with target's reverse_lookup_* options.[#314](https://github.com/greenbone/gvm-libs/pull/314)

[20.4]: https://github.com/greenbone/gvm-libs/compare/gvm-libs-11.0...master

Expand Down
30 changes: 23 additions & 7 deletions osp/osp.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ struct osp_credential
*/
struct osp_target
{
GSList *credentials; /** Credentials to use in the scan */
gchar *exclude_hosts; /** String defining one or many hosts to exclude */
gchar *hosts; /** String defining one or many hosts to scan */
gchar *ports; /** String defining the ports to scan */
gchar *finished_hosts; /** String defining hosts to exclude as finished */
int alive_test; /** Value defining an alive test method */
GSList *credentials; /** Credentials to use in the scan */
gchar *exclude_hosts; /** String defining one or many hosts to exclude */
gchar *hosts; /** String defining one or many hosts to scan */
gchar *ports; /** String defining the ports to scan */
gchar *finished_hosts; /** String defining hosts to exclude as finished */
int alive_test; /** Value defining an alive test method */
int reverse_lookup_unify; /** Value defining reverse_lookup_unify opt */
int reverse_lookup_only; /** Value defining reverse_lookup_only opt */
};

/**
Expand Down Expand Up @@ -871,6 +873,14 @@ target_append_as_xml (osp_target_t *target, GString *xml_string)
xml_string_append (xml_string,
"<alive_test>%d</alive_test>",
target->alive_test);
if (target->reverse_lookup_unify == 1)
xml_string_append (xml_string,
"<reverse_lookup_unify>%d</reverse_lookup_unify>",
target->reverse_lookup_unify);
if (target->reverse_lookup_only == 1)
xml_string_append (xml_string,
"<reverse_lookup_only>%d</reverse_lookup_only>",
target->reverse_lookup_only);

if (target->credentials)
{
Expand Down Expand Up @@ -1402,7 +1412,9 @@ osp_target_t *
osp_target_new (const char *hosts,
const char *ports,
const char *exclude_hosts,
int alive_test)
int alive_test,
int reverse_lookup_unify,
int reverse_lookup_only)
{
osp_target_t *new_target;
new_target = g_malloc0 (sizeof (osp_target_t));
Expand All @@ -1412,6 +1424,10 @@ osp_target_new (const char *hosts,
new_target->ports = ports ? g_strdup (ports) : NULL;
new_target->finished_hosts = NULL;
new_target->alive_test = alive_test ? alive_test : 0;
new_target->reverse_lookup_unify =
reverse_lookup_unify ? reverse_lookup_unify : 0;
new_target->reverse_lookup_only =
reverse_lookup_only ? reverse_lookup_only : 0;

return new_target;
}
Expand Down
2 changes: 1 addition & 1 deletion osp/osp.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ osp_credential_set_auth_data (osp_credential_t *, const char*, const char*);
/* OSP targets handling */

osp_target_t *
osp_target_new (const char *, const char *, const char *, int);
osp_target_new (const char *, const char *, const char *, int, int, int);

void
osp_target_set_finished_hosts (osp_target_t *, const char *);
Expand Down

0 comments on commit b378b41

Please sign in to comment.