Skip to content

Commit 150cb9e

Browse files
committed
Ran tidy for #727
1 parent e9a33db commit 150cb9e

6 files changed

+63
-45
lines changed

program/plugins/nikto_auth.plugin

+6-4
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ sub nikto_auth {
132132
$save_auth = $response->{'www-authenticate'};
133133

134134
# Now we can try the passwords
135-
nprint("Testing creds for '$realm'", "v", ($mark->{'hostname'}, $mark->{'ip'}, $mark->{'displayname'}));
135+
nprint("Testing creds for '$realm'",
136+
"v", ($mark->{'hostname'}, $mark->{'ip'}, $mark->{'displayname'}));
136137
my $success = 0;
137138
foreach my $entry (@{$REALMS}) {
138139
return if $mark->{'terminate'};
@@ -164,7 +165,7 @@ sub nikto_auth {
164165
$mark->{'realms'}{$realm}{'password'} = $entry->{'password'};
165166
$mark->{'realms'}{$realm}{'authtype'} = $authtype;
166167

167-
if ($response->{'whisker'}->{'code'} !~ /40[13]/
168+
if ( $response->{'whisker'}->{'code'} !~ /40[13]/
168169
&& $response->{'whisker'}->{'code'} ne "500"
169170
&& !defined $response->{'whisker'}->{'error'}) {
170171
unless ($entry->{'checked'} == 1) {
@@ -180,7 +181,8 @@ sub nikto_auth {
180181
$ref = "CWE-16";
181182
}
182183
else {
183-
$message = $request->{'whisker'}->{'uri'} .": Default account found for '$realm' at (ID '$entry->{'id'}', PW '$entry->{'password'}'). $entry->{message}.";
184+
$message = $request->{'whisker'}->{'uri'}
185+
. ": Default account found for '$realm' at (ID '$entry->{'id'}', PW '$entry->{'password'}'). $entry->{message}.";
184186
$ref = "CWE-16";
185187
}
186188

@@ -189,7 +191,7 @@ sub nikto_auth {
189191
$request, $response);
190192

191193
# Mark it successful
192-
$success = 1;
194+
$success = 1;
193195
$entry->{'checked'} = 1;
194196
$mark->{'realms'}{$realm}{'status'} = 1;
195197
$mark->{'realms'}{'default'} = $mark->{'realms'}{$realm};

program/plugins/nikto_cookies.plugin

+6-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ sub nikto_cookies_postfetch {
5050
# secure flag
5151
if ($c !~ /secure/i && $mark->{ssl}) {
5252
add_vulnerability($mark,
53-
$request->{'whisker'}->{'uri'} . ": Cookie $cname created without the secure flag",
53+
$request->{'whisker'}->{'uri'}
54+
. ": Cookie $cname created without the secure flag",
5455
999961,
5556
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies",
5657
$request->{'whisker'}->{'method'},
@@ -63,7 +64,8 @@ sub nikto_cookies_postfetch {
6364
# httponly flag
6465
if ($c !~ /httponly/i) {
6566
add_vulnerability($mark,
66-
$request->{'whisker'}->{'uri'} . ": Cookie $cname created without the httponly flag",
67+
$request->{'whisker'}->{'uri'}
68+
. ": Cookie $cname created without the httponly flag",
6769
000137,
6870
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies",
6971
$request->{'whisker'}->{'method'},
@@ -96,7 +98,8 @@ sub nikto_cookies_postfetch {
9698
# is it an internal, or just different?
9799
my $int;
98100
if ($internal) { $int = "RFC-1918 "; }
99-
$msg = $request->{'whisker'}->{'uri'} . ": ${int}IP address found in the '$cname' cookie. The IP is \"$ip\".";
101+
$msg = $request->{'whisker'}->{'uri'}
102+
. ": ${int}IP address found in the '$cname' cookie. The IP is \"$ip\".";
100103
}
101104
add_vulnerability($mark, $msg, 999991, $refs,
102105
$request->{'whisker'}->{'method'},

program/plugins/nikto_core.plugin

+7-4
Original file line numberDiff line numberDiff line change
@@ -1544,13 +1544,13 @@ sub check_dbs {
15441544
nprint("\t+ ERROR: Possible \@CGIDIRS misspelling: $line");
15451545
}
15461546
if ($L[3] =~ /[\s]/) {
1547-
nprint("\t+ ERROR: space in file portion test #$L[0]: '$L[3]'");
1547+
nprint("\t+ ERROR: space in file portion test #$L[0]: '$L[3]'");
15481548
}
15491549
if ($line =~ /[^\\]"\s/) {
1550-
nprint("\t+ ERROR: space after quote #$L[0]: $line");
1550+
nprint("\t+ ERROR: space after quote #$L[0]: $line");
15511551
}
15521552
if ($line =~ /\s"/) {
1553-
nprint("\t+ ERROR: space before quote #$L[0]: $line");
1553+
nprint("\t+ ERROR: space before quote #$L[0]: $line");
15541554
}
15551555
$ENTRIES{"$L[3],$L[4],$L[5],$L[6],$L[7],$L[8],$L[9],$L[11],$L[12]"}++;
15561556
if ((count_fields($line, 1) ne 12) && (count_fields($line) ne '')) {
@@ -2476,7 +2476,10 @@ sub nfetch {
24762476

24772477
# Set auth
24782478
if ($mark->{'realms'}{'default'}{'authtype'} ne '') {
2479-
LW2::auth_set($mark->{'realms'}{'default'}{'authtype'}, $request, $mark->{'realms'}{'default'}{'id'}, $mark->{'realms'}{'default'}{'password'});
2479+
LW2::auth_set($mark->{'realms'}{'default'}{'authtype'},
2480+
$request,
2481+
$mark->{'realms'}{'default'}{'id'},
2482+
$mark->{'realms'}{'default'}{'password'});
24802483
}
24812484

24822485
# Set cookies

program/plugins/nikto_embedded.plugin

+9-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ sub nikto_embedded {
5959
$model =~ s/\+/ /g;
6060

6161
if ($model ne "") {
62-
add_vulnerability($mark, "$item->{'uri'}: $item->{'message'} $model",
63-
$item->{'nikto_id'}, "", "GET", $item->{'uri'}, $request,
64-
$response);
62+
add_vulnerability($mark,
63+
"$item->{'uri'}: $item->{'message'} $model",
64+
$item->{'nikto_id'},
65+
"",
66+
"GET",
67+
$item->{'uri'},
68+
$request,
69+
$response
70+
);
6571
}
6672
}
6773
}

program/plugins/nikto_headers.plugin

+17-17
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,16 @@ sub nikto_headers_postfetch {
245245
$HFOUND{'x-drupal-cache'} = 1;
246246
}
247247
if (defined $result->{'link'} && $HFOUND{'link'} != 1) {
248-
add_vulnerability($mark,
249-
$request->{'whisker'}{'uri'}
250-
. ": Link header found with value: $result->{'link'}.",
251-
"000427",
252-
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link",
253-
$request->{'whisker'}->{'method'},
254-
$request->{'whisker'}->{'uri'},
255-
$request,
256-
$result
257-
);
248+
add_vulnerability(
249+
$mark,
250+
$request->{'whisker'}{'uri'} . ": Link header found with value: $result->{'link'}.",
251+
"000427",
252+
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link",
253+
$request->{'whisker'}->{'method'},
254+
$request->{'whisker'}->{'uri'},
255+
$request,
256+
$result
257+
);
258258
$HFOUND{'link'} = 1;
259259
}
260260

@@ -372,19 +372,19 @@ sub nikto_headers_postfetch {
372372
my ($protocol, $msg);
373373
$result->{'alt-svc'} =~ /.*(h[23])="([^"]+)"/;
374374
my $endpoint = $2;
375-
if ($1 eq "h2") {
376-
$protocol = "HTTP/2 over TLS";
375+
if ($1 eq "h2") {
376+
$protocol = "HTTP/2 over TLS";
377377
}
378-
elsif ($1 eq "h2c") {
379-
$protocol = "HTTP/2 over TCP";
380-
$msg = " Unencrypted.";
378+
elsif ($1 eq "h2c") {
379+
$protocol = "HTTP/2 over TCP";
380+
$msg = " Unencrypted.";
381381
}
382382
elsif ($1 eq "h3") {
383383
$protocol = "HTTP/3";
384384
$msg = " Nikto cannot test HTTP/3 over QUIC.";
385385
}
386-
else {
387-
$protocol = $1;
386+
else {
387+
$protocol = $1;
388388
}
389389

390390
add_vulnerability(

program/plugins/nikto_put_del_test.plugin

+18-14
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ sub nikto_put_del_test {
4646
nfetch($mark, $uri, "GET", "", "", "", "put_del_test: GET");
4747
if ($content =~ /This was a Nikto test/) {
4848
add_vulnerability(
49-
$mark,
50-
"$uri: HTTP method 'PUT' allows clients to save files on the web server.",
51-
999995,
52-
"https://portswigger.net/kb/issues/00100900_http-put-method-is-enabled",
53-
"PUT",
54-
$uri,
55-
$request,
56-
$response
57-
);
49+
$mark,
50+
"$uri: HTTP method 'PUT' allows clients to save files on the web server.",
51+
999995,
52+
"https://portswigger.net/kb/issues/00100900_http-put-method-is-enabled",
53+
"PUT",
54+
$uri,
55+
$request,
56+
$response
57+
);
5858

5959
# we were able to put it there--can we delete it?
6060
($res, $content, $error, $request, $response) =
@@ -65,11 +65,15 @@ sub nikto_put_del_test {
6565
if ($content !~ /This was a Nikto test/) # gone now
6666
{
6767
add_vulnerability(
68-
$mark,
69-
"$uri: HTTP method 'DELETE' allows clients to delete files on the web server.",
70-
999994, "https://cwe.mitre.org/data/definitions/650.html",
71-
"DELETE", $uri, $request, $response
72-
);
68+
$mark,
69+
"$uri: HTTP method 'DELETE' allows clients to delete files on the web server.",
70+
999994,
71+
"https://cwe.mitre.org/data/definitions/650.html",
72+
"DELETE",
73+
$uri,
74+
$request,
75+
$response
76+
);
7377
}
7478
}
7579
}

0 commit comments

Comments
 (0)