Skip to content

Commit 2d64ad3

Browse files
committed
Merge branch 'develop' (#11).
2 parents 494f2e5 + 469d06d commit 2d64ad3

File tree

11 files changed

+132
-38
lines changed

11 files changed

+132
-38
lines changed

.semver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.3
1+
3.0.4

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
os: linux
22
dist: trusty
3-
sudo: required
43
language: python
54

65
python:
76
- "2.7"
8-
- "3.3"
97
- "3.4"
108
- "3.5"
119
- "3.6"
1210
- "3.7-dev"
1311

1412
install:
15-
- pip install -r requirements.txt
13+
- python setup.py install
1614

1715
script:
1816
- python -m unittest discover

README.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Table of contents
3737
Installation
3838
------------
3939

40-
First make sure you're on `Python 2.7/3.3 <https://www.python.org/>`__ or higher. Then run the command below to install ACSTIS.
40+
First make sure you're on `Python 2.7/3.4 <https://www.python.org/>`__ or higher. Then run the command below to install ACSTIS.
4141

4242
``$ pip install git+https://github.com/tijme/angularjs-csti-scanner.git``
4343

@@ -68,25 +68,26 @@ Usage
6868

6969
.. code:: text
7070
71-
usage: acstis [-h] -d DOMAIN [-c] [-vp] [-av ANGULAR_VERSION] [-pmm] [-sos] [-soh] [-sot] [-siv] [-md MAX_DEPTH] [-mt MAX_THREADS]
71+
usage: acstis [-h] -d DOMAIN [-c] [-vp] [-av ANGULAR_VERSION] [-vrl VULNERABLE_REQUESTS_LOG] [-siv] [-pmm] [-sos] [-soh] [-sot] [-md MAX_DEPTH] [-mt MAX_THREADS] [-iic] [-tc TRUSTED_CERTIFICATES]
7272
7373
required arguments:
74-
-d DOMAIN, --domain DOMAIN the domain to scan (e.g. finnwea.com)
74+
-d DOMAIN, --domain DOMAIN the domain to scan (e.g. finnwea.com)
7575
7676
optional arguments:
77-
-h, --help show this help message and exit
78-
-c, --crawl use the crawler to scan all the entire domain
79-
-vp, --verify-payload use a javascript engine to verify if the payload was executed (otherwise false positives may occur)
80-
-av ANGULAR_VERSION, --angular-version ANGULAR_VERSION manually pass the angular version (e.g. 1.4.2) if the automatic check doesn't work
81-
-pmm, --protocol-must-match (crawler option) only scan pages with the same protocol as the startpoint (e.g. only https)
82-
-sos, --scan-other-subdomains (crawler option) also scan pages that have another subdomain than the startpoint
83-
-soh, --scan-other-hostnames (crawler option) also scan pages that have another hostname than the startpoint
84-
-sot, --scan-other-tlds (crawler option) also scan pages that have another tld than the startpoint
85-
-siv, --stop-if-vulnerable (crawler option) stop scanning if a vulnerability was found
86-
-md MAX_DEPTH, --max-depth MAX_DEPTH (crawler option) the maximum search depth (default is unlimited)
87-
-mt MAX_THREADS, --max-threads MAX_THREADS (crawler option) the maximum amount of simultaneous threads to use (default is 8)
88-
-iic, --ignore-invalid-certificates (crawler option) ignore invalid ssl certificates
89-
-tc TRUSTED_CERTIFICATES, --trusted-certificates TRUSTED_CERTIFICATES (crawler option) trust this CA_BUNDLE file (.pem) or directory with certificates
77+
-h, --help show this help message and exit
78+
-c, --crawl use the crawler to scan all the entire domain
79+
-vp, --verify-payload use a javascript engine to verify if the payload was executed (otherwise false positives may occur)
80+
-av ANGULAR_VERSION, --angular-version ANGULAR_VERSION manually pass the angular version (e.g. 1.4.2) if the automatic check doesn't work
81+
-vrl VULNERABLE_REQUESTS_LOG, --vulnerable-requests-log VULNERABLE_REQUESTS_LOG log all vulnerable requests to this file (e.g. /var/logs/acstis.log or urls.log)
82+
-siv, --stop-if-vulnerable (crawler option) stop scanning if a vulnerability was found
83+
-pmm, --protocol-must-match (crawler option) only scan pages with the same protocol as the startpoint (e.g. only https)
84+
-sos, --scan-other-subdomains (crawler option) also scan pages that have another subdomain than the startpoint
85+
-soh, --scan-other-hostnames (crawler option) also scan pages that have another hostname than the startpoint
86+
-sot, --scan-other-tlds (crawler option) also scan pages that have another tld than the startpoint
87+
-md MAX_DEPTH, --max-depth MAX_DEPTH (crawler option) the maximum search depth (default is unlimited)
88+
-mt MAX_THREADS, --max-threads MAX_THREADS (crawler option) the maximum amount of simultaneous threads to use (default is 8)
89+
-iic, --ignore-invalid-certificates (crawler option) ignore invalid ssl certificates
90+
-tc TRUSTED_CERTIFICATES, --trusted-certificates TRUSTED_CERTIFICATES (crawler option) trust this CA_BUNDLE file (.pem) or directory with certificates
9091
9192
**Authentication, Cookies, Headers, Proxies & Scope options**
9293

acstis/Driver.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from nyawc.helpers.HTTPRequestHelper import HTTPRequestHelper
3737
from acstis.helpers.BrowserHelper import BrowserHelper
3838
from acstis.helpers.PackageHelper import PackageHelper
39+
from acstis.helpers.FileLoggingHelper import FileLoggingHelper
3940
from acstis.Scanner import Scanner
4041

4142
class Driver:
@@ -75,6 +76,8 @@ def __init__(self, args, options):
7576
"User-Agent": user_agent(PackageHelper.get_alias(), PackageHelper.get_version())
7677
})
7778

79+
FileLoggingHelper.set_file(self.__args.vulnerable_requests_log)
80+
7881
def __signal_handler(self, signum, frame):
7982
"""On sigint (e.g. CTRL+C) stop the crawler.
8083
@@ -208,6 +211,7 @@ def cb_request_after_finish(self, queue, queue_item, new_queue_items):
208211

209212
for vulnerable_item in queue_item.vulnerable_items:
210213
colorlog.getLogger().success(self.__request_to_string(vulnerable_item.request))
214+
FileLoggingHelper.log(self.__request_to_string(vulnerable_item.request))
211215

212216
if vulnerable_item.payload["message"]:
213217
colorlog.getLogger().warning(vulnerable_item.payload["message"])

acstis/helpers/FileLoggingHelper.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# MIT License
4+
#
5+
# Copyright (c) 2017 Tijme Gommers
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
25+
import os
26+
import sys
27+
import colorlog
28+
29+
class FileLoggingHelper:
30+
"""The FileLoggingHelper enables logging messages to a file.
31+
32+
Attributes:
33+
__phantomjs_driver (str): The cached path to the executable PhantomJS driver.
34+
35+
"""
36+
37+
__filename = None
38+
39+
@staticmethod
40+
def set_file(filename=None):
41+
"""Set the filename to log messages to.
42+
43+
Args:
44+
filename (str): The filename (including absolute or relative path) to log to.
45+
46+
Note:
47+
If the log filename already exists it will be appended with a number. So output.log
48+
could become `output.log.1` or `output.log.2`.
49+
50+
"""
51+
52+
if not filename:
53+
return
54+
55+
filename_backup = filename
56+
filename_append = 0
57+
filename_changed = False
58+
filename_error = False
59+
60+
while os.path.isfile(filename) and not filename_error:
61+
filename_changed = True
62+
filename_append += 1
63+
filename = filename_backup + "." + str(filename_append)
64+
65+
if filename_append == sys.maxsize:
66+
filename_error = True
67+
68+
if filename_error:
69+
colorlog.getLogger().error("The output log file already exists and therefore no logs will be written.")
70+
return
71+
72+
if filename_changed:
73+
colorlog.getLogger().warning("The output log filename was changed to `" + filename + "` since `" + filename_backup + "` already exists.")
74+
75+
FileLoggingHelper.__filename = filename
76+
77+
@staticmethod
78+
def log(message):
79+
"""Write the given message to the initialized log file.
80+
81+
Args:
82+
message (str): The message to write to the log file.
83+
84+
"""
85+
86+
if not FileLoggingHelper.__filename:
87+
return
88+
89+
with open(FileLoggingHelper.__filename, "a") as log:
90+
log.write(message + "\n")

acstis_scripts/acstis_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def require_arguments():
4040

4141
parser = argparse.ArgumentParser(
4242
prog=PackageHelper.get_alias(),
43-
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=180, width=180)
43+
formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=220, width=220)
4444
)
4545

4646
optional = parser._action_groups.pop()
@@ -51,6 +51,7 @@ def require_arguments():
5151
optional.add_argument("-c", "--crawl", help="use the crawler to scan all the entire domain", action="store_true")
5252
optional.add_argument("-vp", "--verify-payload", help="use a javascript engine to verify if the payload was executed (otherwise false positives may occur)", action="store_true")
5353
optional.add_argument("-av", "--angular-version", help="manually pass the angular version (e.g. 1.4.2) if the automatic check doesn't work", type=str, default=None)
54+
optional.add_argument("-vrl", "--vulnerable-requests-log", help="log all vulnerable requests to this file (e.g. /var/logs/acstis.log or urls.log)", type=str, default=None)
5455
optional.add_argument("-siv", "--stop-if-vulnerable", help="(crawler option) stop scanning if a vulnerability was found", action="store_true")
5556
optional.add_argument("-pmm", "--protocol-must-match", help="(crawler option) only scan pages with the same protocol as the startpoint (e.g. only https)", action="store_true")
5657
optional.add_argument("-sos", "--scan-other-subdomains", help="(crawler option) also scan pages that have another subdomain than the startpoint", action="store_true")

extended.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def require_arguments():
8282
optional.add_argument("-c", "--crawl", help="use the crawler to scan all the entire domain", action="store_true")
8383
optional.add_argument("-vp", "--verify-payload", help="use a javascript engine to verify if the payload was executed (otherwise false positives may occur)", action="store_true")
8484
optional.add_argument("-av", "--angular-version", help="manually pass the angular version (e.g. 1.4.2) if the automatic check doesn't work", type=str, default=None)
85+
optional.add_argument("-vrl", "--vulnerable-requests-log", help="log all vulnerable requests to this file (e.g. /var/logs/acstis.log or urls.log)", type=str, default=None)
8586
optional.add_argument("-siv", "--stop-if-vulnerable", help="(crawler option) stop scanning if a vulnerability was found", action="store_true")
8687
optional.add_argument("-pmm", "--protocol-must-match", help="(crawler option) only scan pages with the same protocol as the startpoint (e.g. only https)", action="store_true")
8788
optional.add_argument("-sos", "--scan-other-subdomains", help="(crawler option) also scan pages that have another subdomain than the startpoint", action="store_true")

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"Programming Language :: Python :: 3.6",
5555
"Programming Language :: Python :: 3.5",
5656
"Programming Language :: Python :: 3.4",
57-
"Programming Language :: Python :: 3.3",
5857
"Programming Language :: Python :: 2.7",
5958
"Topic :: Security"
6059
],

test/test_angular_scope.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_inside_app(self):
4949

5050
exitcode = process.wait()
5151
except Exception as e:
52-
print(e)
52+
print("Exception: " + str(e))
5353
exitcode = 1
5454

5555
server.stop()
@@ -71,7 +71,7 @@ def test_outside_app(self):
7171

7272
exitcode = process.wait()
7373
except Exception as e:
74-
print(e)
74+
print("Exception: " + str(e))
7575
exitcode = 1
7676

7777
server.stop()
@@ -93,7 +93,7 @@ def test_inside_non_bindable(self):
9393

9494
exitcode = process.wait()
9595
except Exception as e:
96-
print(e)
96+
print("Exception: " + str(e))
9797
exitcode = 1
9898

9999
server.stop()
@@ -115,7 +115,7 @@ def test_inside_script(self):
115115

116116
exitcode = process.wait()
117117
except Exception as e:
118-
print(e)
118+
print("Exception: " + str(e))
119119
exitcode = 1
120120

121121
server.stop()

test/test_payloads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def test_payloads(self):
168168

169169
exitcode = process.wait()
170170
except Exception as e:
171-
print(e)
171+
print("Exception: " + str(e))
172172
exitcode = 1
173173

174174
server.stop()

0 commit comments

Comments
 (0)