Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
71333c2
major update
silvareal Apr 2, 2019
cdbbbc7
typo djago==1.11
silvareal Apr 2, 2019
f3eae33
remove redundant style
silvareal Apr 2, 2019
56b0f82
DRY template
silvareal Apr 3, 2019
6a38481
new layout �
silvareal Apr 9, 2019
dd2e211
del screenshots
silvareal Apr 9, 2019
35da1fb
made contactform fry
silvareal Apr 10, 2019
62d676b
console message sever for contactforms
silvareal Apr 10, 2019
796e37a
typo
silvareal Apr 10, 2019
9862cb9
message style
silvareal Apr 10, 2019
94b08c0
typo
silvareal Apr 10, 2019
bc76794
error messege added
silvareal Apr 10, 2019
d4843fd
mssg background
silvareal Apr 10, 2019
b055799
refracture
silvareal Apr 10, 2019
e99d7bf
request.post() to request_data
silvareal Apr 12, 2019
998e103
update
silvareal Apr 12, 2019
265d7fc
heroku
silvareal May 14, 2019
3fbf3e8
runtime to py v 3.2.1
silvareal May 14, 2019
296252f
runtime to 2.7.3
silvareal May 14, 2019
d9b61e0
typo
silvareal May 14, 2019
c1997ca
crispy-form set as requirement
silvareal May 14, 2019
51ae389
django==2
silvareal May 15, 2019
8760d7b
whitenoise middleware
silvareal May 15, 2019
6dd3e4a
from whitenoise.django to whitenoise
silvareal May 15, 2019
3601e01
del
silvareal May 15, 2019
8887ee5
whitenoise
silvareal May 15, 2019
ef1d5d4
meta tag
silvareal May 15, 2019
42d2208
Update README.md
silvareal May 15, 2019
07a53cb
contribution link
silvareal May 15, 2019
a2ad04e
typo
silvareal May 15, 2019
f3ca5ed
contribution documentation
silvareal May 15, 2019
8519288
contrib link update
silvareal May 15, 2019
acc21cb
update
silvareal Aug 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
./db.sqlite3

# Flask stuff:
instance/
Expand Down Expand Up @@ -103,3 +103,7 @@ venv.bak/

# mypy
.mypy_cache/
!media/**/init.txt
**/migrations/**
!**/migrations
!**/migrations/__init__.py
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn projectwork.wsgi
22 changes: 7 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
# SQLDex
SQLDex is a nice tools that help you detect **SQL injection** in your Websites, it automate the process of scanning for **SQLi** vulnerability in a websites.
The tool, as some features like Parameter ID, Form Parameter, HTTP header and Cross site scriping (XSS). when supplied the necessary parameters it scan and printed out some Suggested Remediation, this tools is a web based which can be hosted locally or on a cloud server


# Screnshots
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/home.JPG)
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/sql-vuln.JPG)
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/sql-notvuln.JPG)
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/form-vuln.JPG)
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/form-notvuln.JPG)
![sqldex](https://github.com/abdulgaphy/sql-dex/blob/master/screenshots/httphead.JPG)

SQLDex is a nice tools that help you detect **SQL injection** in your Websites, it automate the process of scanning for **SQLi** vulnerability in a websites.
The tool, as some features like Parameter ID, Form Parameter, HTTP header and Cross site scriping (XSS). when supplied the necessary parameters it scan and printed out some Suggested Remediation, this tools is a web based which can be hosted locally or on a cloud server

# Installation

- $ git clone
- $ cd sql-dex
- $ pip install -r requirements.txt or pip3 install -r requirements.txt
- \$ git clone
- \$ cd sql-dex
- \$ pip install -r requirements.txt or pip3 install -r requirements.txt

# Contributions
This project is open Bug reports and pull requests are welcome on GitHub at
Contributions are always welcome! Please read the <a href='https://github.com/silvareal/sql-dex/blob/master/docs/CONTRIBUTING.md'>Contribution guidelines for this project</a>.

# Thanks

Special thanks to [Moses Ayomide Aleji](https://github.com/mosesayo) for his great contributions to the success of the project
Empty file added dbdex/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions dbdex/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions dbdex/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class DbdexConfig(AppConfig):
name = 'dbdex'
8 changes: 6 additions & 2 deletions projectwork/forms.py → dbdex/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from django import forms
from . validation import validate_dot_com, validate_url

class urlForm(forms.Form):
url = forms.URLField(widget =forms.TextInput(
url = forms.URLField(label='',
validators=[validate_url, validate_dot_com],
widget =forms.TextInput(
attrs ={
"class":"form-control mr-sm-2 ",
"placeholder":"Enter URL"
"placeholder":"Enter URL",
"autocomplete": "off",
}
)
)
Expand Down
Empty file added dbdex/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions dbdex/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
74 changes: 74 additions & 0 deletions dbdex/templates/dbdex/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta property="og:title" content="Test for Sql Vulnarability">
<meta property="og:description" content="Test your website for Sql Vulnarability'>'
<meta property="og:image" content="{% static 'img/xss.png' %}">
<meta property="og:url" content="https://sqldex.herokuapp.com/">
<meta name="twitter:card" content="summary">
<meta property="og:site_name" content="sqldex">
<meta name="twitter:image:alt" content="Alt text for image">

<title>{% block title %}{% endblock title %} || SQL-DEX</title>
<!-- Bootstrap link -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Google font link -->
<link href="https://fonts.googleapis.com/css?family=Arvo" rel="stylesheet">

<!-- Fa icon link -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- local css -->
<link rel="stylesheet" href="{% static 'css' %}" >
<link rel="stylesheet" href="{% static 'css/new-index.css' %}" >
</head>

<body>
{% include 'dbdex/nav/header.html' %}

{% include 'dbdex/nav/validation_header.html' %}
{% block content %}
<main class='container'>
</main>
{% endblock content %}


<!-- FOOTER section -->
<footer id="myFooter">
<div class="container">
<div class="main-footer">
<div class="social-networks">
<a href="https://github.com/abdulgaphy/sql-dex" class="google"><i class="fa fa-github"></i></a>
</div>
<a href='https://github.com/abdulgaphy/sql-dex/pulls'><button type="button" class="btn btn-primary">Contribute</button></a>
</div>
</div>
<div class="footer-copyright" >
<p>All rights reserved © <script type="text/javascript">document.write("2018 - "+ new Date().getFullYear());</script></p>
</div>
</footer>


<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
// Add active class to the current button (highlight it)
var header = document.getElementById("tabbar");
var btns = header.getElementsByClassName("tablink");
for (var i = 0; i < btns.length; i++) {
btns[i].addEventListener("click", function() {
var current = document.getElementsByClassName("active");
current[0].className = current[0].className.replace(" active", "");
this.className += " active";
});
}
</script>
</body>
</html>
72 changes: 72 additions & 0 deletions dbdex/templates/dbdex/documentation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{% extends 'dbdex/base.html' %}
{% load static %}

{% block title %}Documentation{% endblock title %}

{% block content %}

<section class="documentation">

<h2>Documentation</h2>
<div class="container">
<div style='padding-bottom: 20px;'>
<p class='shift'><b>SQL Injection</b> is one of the most dangerous vulnerabilities a web application can be
prone to. When a user’s input is being passed unvalidated and unsanitzed as part of an
SQL query that means that the user can manipulate the query itself and force it to return
different data than what it was supposed to return. we will see how and why this is so
dangerous.
</p>

<p class='shift'>
Suppose that we have a web application which takes the parameter
“article” via <code>$_GET</code> request and queries the database to get an article’s content.
<i style='color: blue;'>http://website.com/show.php?article=1</i> The underlying PHP code is the following: //
The ”article” parameter is assigned to $article variable without any sanitization or
validation <code>$articleid = $_GET[‘article’];</code> // The $articleid parameter is passed as part
of the query <code>$query = "SELECT * FROM articles WHERE articleid = $articleid";</code>
If a user changes the article parameter to 1 AND 1=1 then the query becomes like this:
<code>$query = "SELECT * FROM articles WHERE articleid = 1 AND 1=1";</code> In this case, the content
of the page does not change because the two conditions in the SQL statement are both true.
There is an article with an id of 1, and 1 equals to 1 which is true. If a user changes
the parameter to 1 AND 1=2, it returns nothing because 1 is not equal to 2.That means
that the user is controlling the query and can adjust it accordingly to manipulate the
results.
</p>
</div>
<hr>
<div class="container doc-type">
<div class="row justify-content-center">
<div class="col-md-4 marginal">
<h3>SQL Injection</h3>
<ul>
<li>You can scan a url for SQL Injection vulnerability simply by inserting the url in the url field and clicking "Test Url</li>
<li>If the url is vulnerable to SQL Injection, It will be shown in the result </li>
<li>Procedures to take in protecting against this kind of attack will be suggested if the url is vulnerable to this kind of attack.</li>
</ul>
</div>

<div class="col-md-4 marginal">
<h3>HTTP HEADER</h3>
<ul>
<li>Get basic informations About HTTP protocol of any website E.g Cookies,hostname </li>
<li>You can insert a website address or I.P address in the URL field and click on Get info.</li>
<li>Procedures to take in protecting against this kind of attack will be suggested if the url is vulnerable to this kind of attack.</li>
</ul>
</div>

<div class="col-md-4 marginal">
<h3>Cross Site Scripting</h3>
<ul>
<li>Cross-site scripting is the unintended execution of remote code by a web
client. Any web application might expose itself to XSS if it takes input from
a user and outputs it directly on a web page. If input includes HTML or JavaScript,
remote code can be executed when this content is rendered by the web client.
</li>

</ul>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
19 changes: 19 additions & 0 deletions dbdex/templates/dbdex/feedback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'dbdex/base.html' %}
{% load static %}
{% load crispy_forms_tags %}

{% block title %}feedback{% endblock title %}

{% block content %}
<!-- FEEDBACK section -->
<section class='container'>
<div class="feedback">
<h2 class="text-white"> FEEDBACK</h2>
<p>your feedback is highly valuable...</p>
<form method="POST" >
{% csrf_token %}
{{ form|crispy }}
<input style='margin-top: 15px;' type="submit" class="btn btn-primary" value='Submit' />
</div>
</section>
{% endblock content %}
73 changes: 73 additions & 0 deletions dbdex/templates/dbdex/formparameter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{% extends 'dbdex/base.html' %}
{% load static %}

{% block title %}Form Parameter{% endblock title %}

{% block content %}
<!-- Tabbar -->
{% include 'dbdex/nav/tabbar.html' %}

<!-- search component -->

<section class='container-fluid main' id='parameter'>
<div class='container'>
<div class="form-enter">
<h2>Form Parameter</h2>
<p>Please enter the url to be tested in the following format: <br />
http://www.example.com/login.php
</p>

{% include 'dbdex/forms.html' %}
</span>
<div id="parameter">
{% if notvulnerable %}
<p><strong>RESULT</strong></p>
{{link}}{{getresult}}

{% endif %}

{% if vulnerable %}
<span style="color:black;"><strong>RESULT: </strong></span>
<span style="color: red;">{{link}}</span><span style="color:red; ">{{getresult}}</span>
<p style="text-align: center; color: black;"><strong>Vulnerability Description</strong></p>
<div class="table-responsive">
<table class="table" style="color:black;">
<thead>
<tr>
<th>Issue</th>
<th>Description</th>
<th>Suggested Remediation</th>
</tr>
</thead>
<tbody>
<tr>
<th>Input Validation</th>
<td>Even though an id will always be a number, the example above is not validating user input at all.</p>
<p>While validating user input is not a direct solution to SQL injection, it helps us control malicious
user input into the database.
</td>
<td>Before even processing the SQL query, validate user input.</p>
<p>In this case, we need to check that the input is a number.
</td>
</tr>
<tr>
<th>Code allows for SQL injection</th>
<td>The example above is accepting user input (in this case, from a GET parameter), and including it
directly in the SQL statement.</p>
<p>This allows an attacker to inject SQL into the query, therefore tricking the application into
sending a malformed query to the database.
</td>
<td>Use parameterized queries when dealing with SQL queries that contains user input.<p>A parameterized
query allows the database to understand which parts of the SQL query should be considered as user
input, therefore solving SQL injection.</li>
</p>
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</section>
{% endblock content %}
13 changes: 13 additions & 0 deletions dbdex/templates/dbdex/forms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- INput Form -->
<form action="" method="POST" class="form-inline">
<fieldset>
{% csrf_token %}

<div class="input-group">
{{ form.url}}
<div class="input-group-prepend">
<input class="input-group-text" type="submit" value="TEST URL">
</div>
</div>
</fieldset>
</form>
38 changes: 38 additions & 0 deletions dbdex/templates/dbdex/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends 'dbdex/base.html' %}
{% load static %}

{% block title %}HTTP Header Test{% endblock title %}

{% block content %}
<!-- Tabbar -->
{% include 'dbdex/nav/tabbar.html' %}

<!-- search component -->

<section class='container-fluid main'>
<div class='container'>
<div class="form-enter">
<h2>Scan the http header</h2>
<p>Please enter the url to be tested in the following format: <br />
http://www.example.com/
</p>

<!-- Header form -->
{% include 'dbdex/forms.html' %}
</div>

<div id="outcome">
{% if httpheader %}
<p>result :</p>
<ul class="list-unstyled list-group">
{% for key,values in head.items %}
<li class="list-group-item ">
<span class="title"> {{key}} :</span> {{values}}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</section>
{% endblock content %}
Loading