forked from 0c34/govwa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
164 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
{{define "template.sqli"}} {{template "template.header" .}} {{template "template.sidebar" .}} | ||
{{define "template.sqli"}} | ||
{{template "template.header" .}} | ||
{{template "template.sidebar" .}} | ||
<div class="col-md-9"> | ||
<div class="panel panel-primary"> | ||
<div class="panel-heading">SQL Injection</div> | ||
<div class="panel-body"> | ||
<div class="pnl"> | ||
<span class="subheader">SQL Injection Vulnerability</span> | ||
<p> | ||
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has | ||
survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently | ||
with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. | ||
data : | ||
{{.error}} | ||
{{.name}} | ||
{{.city}} | ||
{{.number}} | ||
{{.uid}} | ||
|
||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{template "template.footer"}} {{ end }} | ||
{{template "template.footer"}} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package sqli | ||
|
||
import( | ||
"log" | ||
"fmt" | ||
"database/sql" | ||
|
||
"govwa/util/database" | ||
) | ||
|
||
var DB *sql.DB | ||
|
||
func init(){ | ||
DB, _ = database.Connect() | ||
/* if err != nil{ | ||
log.Println(err.Error()) | ||
} */ | ||
} | ||
|
||
type Profile struct{ | ||
Uid int | ||
Name string | ||
City string | ||
PhoneNumber string | ||
} | ||
|
||
func newProfile()*Profile{ | ||
return &Profile{} | ||
} | ||
|
||
func(p *Profile)unsafeQueryGetData(uid string)error{ | ||
|
||
/* this funciton use to get data Profile from database with vulnerable query */ | ||
|
||
getProfileSql := fmt.Sprintf(`SELECT p.user_id, p.full_name, p.city, p.phone_number | ||
FROM Profile as p,Users as u | ||
where p.user_id = u.id | ||
and u.id=%s`,uid) //here is the vulnerable query | ||
|
||
rows, err := DB.Query(getProfileSql) | ||
if err != nil{ | ||
log.Printf("query error :%s",err.Error()) | ||
return err //this will return error query to clien hmmmm. | ||
} | ||
defer rows.Close() | ||
//var profile = Profile{} | ||
for rows.Next(){ | ||
err = rows.Scan(&p.Uid,&p.Name,&p.City,&p.PhoneNumber) | ||
if err != nil{ | ||
log.Printf("Row scan error: %s", err.Error()) | ||
return err | ||
} | ||
} | ||
return nil | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters