Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
web security map
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
131
Issues
131
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
2
Merge Requests
2
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Internet Cleanup Foundation
web security map
Commits
02cfdbc7
Verified
Commit
02cfdbc7
authored
Oct 30, 2017
by
Elger Jonker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint and debugging hunt results
parent
1b19dde9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
11 deletions
+54
-11
.gitignore
.gitignore
+2
-1
failmap_admin/scanners/management/commands/discover-endpoints-http-https.py
...ners/management/commands/discover-endpoints-http-https.py
+11
-5
failmap_admin/scanners/management/commands/support/arguments.py
...p_admin/scanners/management/commands/support/arguments.py
+18
-2
failmap_admin/scanners/scanner_http.py
failmap_admin/scanners/scanner_http.py
+22
-2
failmap_admin/settings.py
failmap_admin/settings.py
+1
-1
No files found.
.gitignore
View file @
02cfdbc7
...
...
@@ -28,4 +28,5 @@ vendor/dnsrecon/
vendor/theHarvester/
vendor/Google Chrome.app/
failmap_dataset*
failmap_testdataset*
\ No newline at end of file
failmap_testdataset*
failmap_debug_dataset*
\ No newline at end of file
failmap_admin/scanners/management/commands/discover-endpoints-http-https.py
View file @
02cfdbc7
...
...
@@ -6,7 +6,7 @@ from failmap_admin.organizations.models import Organization, Url
from
failmap_admin.scanners.models
import
Endpoint
from
failmap_admin.scanners.scanner_http
import
scan_url
,
scan_urls
from
.support.arguments
import
add_organization_argument
from
.support.arguments
import
add_
discover_verify
,
add_
organization_argument
logger
=
logging
.
getLogger
(
__package__
)
...
...
@@ -17,20 +17,26 @@ class Command(BaseCommand):
def
add_arguments
(
self
,
parser
):
add_organization_argument
(
parser
)
add_discover_verify
(
parser
)
def
handle
(
self
,
*
args
,
**
options
):
# some expansion magic to avoid using eval
func
=
"verify_existing_endpoints"
if
options
[
'method'
]
==
"verify"
else
"discover_endpoints"
functionlist
=
{
"verify_existing_endpoints"
:
verify_existing_endpoints
,
"discover_endpoints"
:
discover_endpoints
}
if
not
options
[
'organization'
]:
discover_endpoints
()
functionlist
[
func
]
()
return
if
options
[
'organization'
][
0
]
==
"_ALL_"
:
discover_endpoints
()
functionlist
[
func
]
()
return
organization
=
Organization
.
objects
.
all
().
filter
(
name
=
options
[
'organization'
][
0
])
discover_endpoints
(
organization
=
organization
)
functionlist
[
func
]
(
organization
=
organization
)
def
verify_existing_endpoints
(
port
=
None
,
protocol
=
None
,
organization
=
None
):
...
...
@@ -54,7 +60,7 @@ def verify_existing_endpoints(port=None, protocol=None, organization=None):
if
protocol
:
endpoints
=
endpoints
.
filter
(
protocol
=
protocol
)
else
:
endpoints
=
endpoints
.
filter
(
endpoint__
protocol__in
=
[
'http'
,
'https'
])
endpoints
=
endpoints
.
filter
(
protocol__in
=
[
'http'
,
'https'
])
if
organization
:
endpoints
=
endpoints
.
filter
(
url__organization
=
organization
)
...
...
failmap_admin/scanners/management/commands/support/arguments.py
View file @
02cfdbc7
...
...
@@ -15,6 +15,17 @@ def add_organization_argument(parser):
)
def
add_discover_verify
(
parser
):
return
parser
.
add_argument
(
'--method'
,
'-m'
,
help
=
"verify|discover. Verify checks all existing ones, discover tries to find new ones."
,
nargs
=
'?'
,
required
=
False
,
type
=
valid_discover_verify
,
default
=
"verify"
)
def
valid_organization
(
name
):
if
"_ALL_"
in
name
:
return
"_ALL_"
...
...
@@ -22,5 +33,10 @@ def valid_organization(name):
o
=
Organization
.
objects
.
get
(
name
=
name
)
return
o
.
name
except
ObjectDoesNotExist
:
msg
=
"%s is not a valid organization or _ALL_"
%
name
raise
argparse
.
ArgumentTypeError
(
msg
)
raise
argparse
.
ArgumentTypeError
(
"%s is not a valid organization or _ALL_"
%
name
)
def
valid_discover_verify
(
option
):
if
option
==
"verify"
or
option
==
"discover"
:
return
option
raise
argparse
.
ArgumentTypeError
(
"Method can be either 'discover' or 'verify'. Given: "
%
option
)
failmap_admin/scanners/scanner_http.py
View file @
02cfdbc7
...
...
@@ -34,7 +34,8 @@ from requests import ConnectTimeout, HTTPError, ReadTimeout, Timeout
from
requests.exceptions
import
ConnectionError
from
failmap_admin.celery
import
app
from
failmap_admin.scanners.models
import
Endpoint
from
.models
import
Endpoint
logger
=
logging
.
getLogger
(
__package__
)
...
...
@@ -76,10 +77,30 @@ def scan_urls(urls, ports, protocols):
def
scan_url
(
url
,
port
=
80
,
protocol
=
"https"
):
task
=
scan_url_task
.
s
(
url
,
port
,
protocol
)
task
.
apply_async
()
def
database_debug
():
# had the wrong env.
from
django.db
import
connection
from
failmap_admin
import
settings
logger
.
error
(
dir
(
settings
))
logger
.
error
(
settings
.
DATABASE
)
logger
.
error
(
settings
.
DATABASES
)
sql
=
"SELECT name FROM sqlite_master WHERE type='table';"
cursor
=
connection
.
cursor
()
cursor
.
execute
(
sql
)
rows
=
cursor
.
fetchall
()
logger
.
error
(
rows
)
for
row
in
rows
:
logger
.
error
(
row
)
@
app
.
task
def
scan_url_task
(
url
,
port
=
80
,
protocol
=
"https"
):
"""
...
...
@@ -267,7 +288,6 @@ def endpoint_exists(url, port, protocol, ip):
def
kill_endpoint
(
url
,
port
,
protocol
,
ip
):
eps
=
Endpoint
.
objects
.
all
().
filter
(
url
=
url
,
port
=
port
,
ip
=
ip
,
...
...
failmap_admin/settings.py
View file @
02cfdbc7
...
...
@@ -86,7 +86,7 @@ try:
import
django_extensions
INSTALLED_APPS
+=
[
'django_extensions'
]
except
ImportError
:
print
(
"
swag
"
)
print
(
"
Django Extensions is not installed (not a dev setup?) Install requirements.dev.txt if needed.
"
)
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment