Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alvaber-DVWA2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alvaber
alvaber-DVWA2
Commits
cf8884ee
Unverified
Commit
cf8884ee
authored
Aug 15, 2018
by
Ryan Dewhurst
Committed by
GitHub
Aug 15, 2018
Browse files
Options
Downloads
Plain Diff
Merge pull request #255 from digininja/help_external_script
moved from onclick to adding event handlers
parents
d008bf7b
6d2d199d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
dvwa/includes/dvwaPage.inc.php
+4
-3
4 additions, 3 deletions
dvwa/includes/dvwaPage.inc.php
dvwa/js/add_event_listeners.js
+24
-0
24 additions, 0 deletions
dvwa/js/add_event_listeners.js
dvwa/js/dvwaPage.js
+2
-1
2 additions, 1 deletion
dvwa/js/dvwaPage.js
with
30 additions
and
4 deletions
dvwa/includes/dvwaPage.inc.php
+
4
−
3
View file @
cf8884ee
...
...
@@ -230,7 +230,7 @@ function dvwaHtmlEcho( $pPage ) {
foreach
(
$menuBlock
as
$menuItem
)
{
$selectedClass
=
(
$menuItem
[
'id'
]
==
$pPage
[
'page_id'
]
)
?
'selected'
:
''
;
$fixedUrl
=
DVWA_WEB_PAGE_TO_ROOT
.
$menuItem
[
'url'
];
$menuBlockHtml
.
=
"<li
onclick=
\"
window.location='
{
$fixedUrl
}
'
\"
class=
\"
{
$selectedClass
}
\"
><a href=
\"
{
$fixedUrl
}
\"
>
{
$menuItem
[
'name'
]
}
</a></li>
\n
"
;
$menuBlockHtml
.
=
"<li class=
\"
{
$selectedClass
}
\"
><a href=
\"
{
$fixedUrl
}
\"
>
{
$menuItem
[
'name'
]
}
</a></li>
\n
"
;
}
$menuHtml
.
=
"<ul class=
\"
menuBlocks
\"
>
{
$menuBlockHtml
}
</ul>"
;
}
...
...
@@ -329,6 +329,7 @@ function dvwaHtmlEcho( $pPage ) {
<div id=
\"
footer
\"
>
<p>Damn Vulnerable Web Application (DVWA) v"
.
dvwaVersionGet
()
.
"</p>
<script src='/dvwa/js/add_event_listeners.js'></script>
</div>
...
...
@@ -426,13 +427,13 @@ function dvwaExternalLinkUrlGet( $pLink,$text=null ) {
function
dvwaButtonHelpHtmlGet
(
$pId
)
{
$security
=
dvwaSecurityLevelGet
();
return
"<input type=
\"
button
\"
value=
\"
View Help
\"
class=
\"
popup_button
\"
onclick=
\"
javascript:popUp(
'"
.
DVWA_WEB_PAGE_TO_ROOT
.
"vulnerabilities/view_help.php?id=
{
$pId
}
&security=
{
$security
}
' )
\"
>"
;
return
"<input type=
\"
button
\"
value=
\"
View Help
\"
class=
\"
popup_button
\"
id='help_button' data-help-url=
'"
.
DVWA_WEB_PAGE_TO_ROOT
.
"vulnerabilities/view_help.php?id=
{
$pId
}
&security=
{
$security
}
' )
\"
>"
;
}
function
dvwaButtonSourceHtmlGet
(
$pId
)
{
$security
=
dvwaSecurityLevelGet
();
return
"<input type=
\"
button
\"
value=
\"
View Source
\"
class=
\"
popup_button
\"
onclick=
\"
javascript:popUp(
'"
.
DVWA_WEB_PAGE_TO_ROOT
.
"vulnerabilities/view_source.php?id=
{
$pId
}
&security=
{
$security
}
' )
\"
>"
;
return
"<input type=
\"
button
\"
value=
\"
View Source
\"
class=
\"
popup_button
\"
id='source_button' data-source-url=
'"
.
DVWA_WEB_PAGE_TO_ROOT
.
"vulnerabilities/view_source.php?id=
{
$pId
}
&security=
{
$security
}
' )
\"
>"
;
}
...
...
...
...
This diff is collapsed.
Click to expand it.
dvwa/js/add_event_listeners.js
0 → 100644
+
24
−
0
View file @
cf8884ee
// These functions need to be called after the content they reference
// has been added to the page otherwise they will fail.
function
addEventListeners
()
{
var
source_button
=
document
.
getElementById
(
"
source_button
"
);
if
(
source_button
)
{
source_button
.
addEventListener
(
"
click
"
,
function
()
{
var
url
=
source_button
.
dataset
.
sourceUrl
;
popUp
(
url
);
});
}
var
help_button
=
document
.
getElementById
(
"
help_button
"
);
if
(
help_button
)
{
help_button
.
addEventListener
(
"
click
"
,
function
()
{
var
url
=
help_button
.
dataset
.
helpUrl
;
popUp
(
url
);
});
}
}
addEventListeners
();
This diff is collapsed.
Click to expand it.
dvwa/js/dvwaPage.js
+
2
−
1
View file @
cf8884ee
...
...
@@ -3,7 +3,8 @@
function
popUp
(
URL
)
{
day
=
new
Date
();
id
=
day
.
getTime
();
eval
(
"
page
"
+
id
+
"
= window.open(URL, '
"
+
id
+
"
', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=300,left = 540,top = 250');
"
);
window
.
open
(
URL
,
'
" + id + "
'
,
'
toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=300,left=540,top=250
'
);
//eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=300,left=540,top=250');");
}
/* Form validation */
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment