diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index cca6e1c..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1211f8e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +*.swp +*.pyc +*.bak +.idea +__pycache__ diff --git a/README.md b/README.md index 79b0d6a..5e817f1 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ Squatm3gator is a complete web solution based on the python tool squatm3, design - Substitution attacks - Flipping attack -- Homoglyph attack fast (execute a fast homoglyph attack, mutating only one letter at the time ) +- Homoglyph attack fast (execute a fast homoglyph attack, mutating only one letter at the time) - Homoglyph attack complete (generates all the possible combinations) -The tool is ment to help penetration testers to identify domains to be used in phishing attack simulations and security analysts to detect and prevent cybersquatting attacks. +The tool is meant to help penetration testers to identify domains to be used in phishing attack simulations and security analysts to detect and prevent cybersquatting attacks. ## Architecture @@ -36,6 +36,7 @@ pip3 install -r requirements.txt ### Spin up a Redis container +One way to get it quickly done is to use the bitnami/redis docker: ``` docker run -d -e REDIS_PASSWORD=waddup --name squatme-redis -p 6379:6379 bitnami/redis diff --git a/architecture.png b/architecture.png index 86e1068..274f7ee 100644 Binary files a/architecture.png and b/architecture.png differ diff --git a/squatm3-api/.idea/misc.xml b/squatm3-api/.idea/misc.xml deleted file mode 100644 index ba24381..0000000 --- a/squatm3-api/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/squatm3-api/.idea/modules.xml b/squatm3-api/.idea/modules.xml deleted file mode 100644 index d686504..0000000 --- a/squatm3-api/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/squatm3-api/.idea/squatm3-api.iml b/squatm3-api/.idea/squatm3-api.iml deleted file mode 100644 index 6711606..0000000 --- a/squatm3-api/.idea/squatm3-api.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/squatm3-api/.idea/workspace.xml b/squatm3-api/.idea/workspace.xml deleted file mode 100644 index 67384cc..0000000 --- a/squatm3-api/.idea/workspace.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Not connected

-

Users connected: 0

-

To test, open two windows with Web Socket support, type a message above and press return.

-

The server side code is available here: node-web-socket & server (note that it runs on nodejs)

-
    - - \ No newline at end of file diff --git a/squatm3-api/requirements.txt b/squatm3-api/requirements.txt index 1445303..52f6988 100644 --- a/squatm3-api/requirements.txt +++ b/squatm3-api/requirements.txt @@ -1,8 +1,16 @@ -tld==0.9.1 +Flask==1.0.2 +Flask_And_Redis>=0.7 +Flask_RESTful>=0.3.6 +Flask_Session>=0.3.1 +Flask_SocketIO>=3.0.2 +attr==0.3.1 attrs==18.2.0 +eventlet==0.24.1 +homoglyphs==1.3.1 redis==2.10.6 -requests>=2.20.0 +requests>=2.20.1 simplejson==3.16.0 +<<<<<<< HEAD Flask_RESTful==0.3.6 Flask==1.0.2 Flask_Session==0.3.1 @@ -13,3 +21,7 @@ attr==0.3.1 Flask_And_Redis==0.7 eventlet Flask-Redis==0.3.0 +======= +tld==0.9.1 +validators==0.12.2 +>>>>>>> upstream/master diff --git a/squatm3-api/server.py b/squatm3-api/server.py index cb14cd0..de7d562 100644 --- a/squatm3-api/server.py +++ b/squatm3-api/server.py @@ -15,8 +15,6 @@ import validators import eventlet eventlet.monkey_patch(socket=True) - - # initiate the app, Api and redis settings reading from config file template_dir = os.path.abspath('../squatm3-ui') app = Flask(__name__, template_folder=template_dir) @@ -31,17 +29,15 @@ app.static_url_path="../squatm3-ui/static" # set the absolute path to the static folder app.static_folder=app.static_url_path -#print(app.static_url_path) -#print(app.static_folder) -#app.config.from_pyfile('config.cfg') +# Setup Session app.config['SESSION_TYPE'] = 'redis' app.config['SECRET_KEY'] = 'mysecretrediskey' app.config['SESSION_REDIS'] = redis.Redis(host='localhost', port=6379, password='waddup') - sess = Session() sess.init_app(app) +# Setup SocketIO socketio = SocketIO(app) socketio.init_app(app, async_mode=async_mode, message_queue='redis://:waddup@localhost:6379/') @@ -64,8 +60,6 @@ def start_reporting(sess_key=None, sid=None): We do this by comparing the job_id and the session key. When we start an attack we create a UUID used as session key and as job_id ''' - #sess_key = "123" - print(sess_key + "##" + sid) print("Entering start_reporting") c = comm.Communication() with app.app_context(): @@ -75,29 +69,21 @@ def start_reporting(sess_key=None, sid=None): if job and sess_key: w_id,job_id,msg = job.decode().split("#") if job_id == sess_key: - print("###########") - print(msg) - print("###########") socketio.emit('results', msg, room=sid) else: - print("NOT FOR THIS SESSION") - print(msg) #message not for this client, return it back in the queue c.redis.rpush(c.channel_reporting, job) @socketio.on('client_connected') def handle_client_connect_event(): - print("connected client socketio") worker_reporter = threading.Thread(target=start_reporting, kwargs=dict(sess_key=check_session(), sid=request.sid)) worker_reporter.setDaemon(True) worker_reporter.start() - #threadreport = socketio.start_background_task(target=start_reporting(check_session())) @app.route('/') def index(): create_session() - print('Session has been created') return render_template('index.html', async_mode=socketio.async_mode) @app.errorhandler(404) @@ -146,14 +132,10 @@ class get_list_domains_generated(Resource): commands = ["Hf","Hc","-add","F","R"] - - for attack in attacks: - print(attack) if attack in commands: options = options + "-" + attack + " " - if godaddy == 1: options = options + "--godaddy " @@ -164,11 +146,8 @@ class get_list_domains_generated(Resource): except Exception as e: print(e) - return "Something went wrong while parsing the query string" - - """ Retrieves all the domains generated by the ALL attacks We use the redis producer to push a Job object to the queue. @@ -196,8 +175,6 @@ class get_list_domains_generated(Resource): api.add_resource(get_list_domains_generated, '/api/') - - #Utils Funcs def create_session(): key = str(uuid.uuid4()) @@ -210,5 +187,4 @@ def check_session(): #main if __name__== '__main__': - #app.run() socketio.run(app, async_mode=async_mode) diff --git a/squatm3-api/static/app.js b/squatm3-api/static/app.js deleted file mode 100644 index e12779b..0000000 --- a/squatm3-api/static/app.js +++ /dev/null @@ -1,22 +0,0 @@ -socket = io.connect('http://' + document.domain + ':' + location.port); - -socket.on('connect', function() { - socket.emit('client_connected', {data: 'New client!'}); -}); - -socket.on('results', function (data) { - console.log(data); -}); - -socket.on('alert', function (data) { - alert('Alert Message!! ' + data); -}); - -function json_button() { - socket.send('{"message": "test"}'); - alert(1) -} - -function alert_button() { - socket.emit('alert_button', 'Message from client!') -} \ No newline at end of file diff --git a/squatm3-api/static/style.css b/squatm3-api/static/style.css deleted file mode 100644 index e69de29..0000000 diff --git a/squatm3-api/templates/index.html b/squatm3-api/templates/index.html deleted file mode 100644 index 7d15bef..0000000 --- a/squatm3-api/templates/index.html +++ /dev/null @@ -1,10 +0,0 @@ - -Websockets tutorial - - - -
    -

    Hello World!

    - - -
    \ No newline at end of file diff --git a/squatm3-api/websockets.py b/squatm3-api/websockets.py deleted file mode 100644 index 984d9e1..0000000 --- a/squatm3-api/websockets.py +++ /dev/null @@ -1,21 +0,0 @@ -from server import socketio -from flask_socketio import send, emit - - -@socketio.on('client_connected') -def handle_client_connect_event(json): - print('received json: {0}'.format(str(json))) - - - -@socketio.on('message') -def handle_json_button(json): - # it will forward the json to all clients. - send(json, json=True) - - -@socketio.on('results') -def handle_alert_event(json): - # it will forward the json to all clients. - print('Message from client was {0}'.format(json)) - emit('results', 'Message from backend') \ No newline at end of file diff --git a/squatm3-api/worker.py b/squatm3-api/worker.py deleted file mode 100644 index 974fff4..0000000 --- a/squatm3-api/worker.py +++ /dev/null @@ -1,6 +0,0 @@ -import redis -from wrapper.classes import job -from wrapper.consumer import consumer - -c = consumer -c.listen_for_commands() \ No newline at end of file diff --git a/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/__init__.cpython-36.pyc index 349af8b..3f97bc6 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/config.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/config.cpython-36.pyc index edb5d6b..5c5dc84 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/config.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/configuration/__pycache__/config.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Domain.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Domain.cpython-36.pyc index 67c0192..bdcbb5c 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Domain.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Domain.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Result.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Result.cpython-36.pyc index 3597e80..7ed3ced 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Result.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/Result.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/__init__.cpython-36.pyc index be391c0..13987c5 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Classes/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/GoDaddy.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/GoDaddy.cpython-36.pyc index e32951e..9b75c81 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/GoDaddy.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/GoDaddy.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/__init__.cpython-36.pyc index 2693de8..97fbc2f 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/GoDaddyChecker/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/__init__.cpython-36.pyc index 3f6f7da..4fea479 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/outputer.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/outputer.cpython-36.pyc index ab39da6..6011d85 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/outputer.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Output/__pycache__/outputer.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/AddOneLetter.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/AddOneLetter.cpython-36.pyc index 0eb93a8..9a43609 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/AddOneLetter.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/AddOneLetter.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/RemoveOneLetter.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/RemoveOneLetter.cpython-36.pyc index 858faf9..96f69fb 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/RemoveOneLetter.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/RemoveOneLetter.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/__init__.cpython-36.pyc index d31549e..31488ee 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Remover/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/Flipper.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/Flipper.cpython-36.pyc index afb1eea..468c14f 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/Flipper.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/Flipper.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack.cpython-36.pyc index 8c2b3ab..9ad0590 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack2.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack2.cpython-36.pyc index a5a2eb6..23803fe 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack2.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/HomoglyphAttack2.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/__init__.cpython-36.pyc index 4424ead..f865bf3 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Substitutions/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/TldSelector.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/TldSelector.cpython-36.pyc index 4f7bf73..5571ab4 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/TldSelector.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/TldSelector.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/__init__.cpython-36.pyc index 9231c75..43dcf2a 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Tldmodule/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/__init__.cpython-36.pyc index 15870f7..61df47a 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/checkvalidity.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/checkvalidity.cpython-36.pyc index 02e6d94..c1c9f67 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/checkvalidity.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/Urlchecker/__pycache__/checkvalidity.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/3rdparty/squatm3/modules/__pycache__/__init__.cpython-36.pyc b/squatm3-api/wrapper/3rdparty/squatm3/modules/__pycache__/__init__.cpython-36.pyc index 4d8c1d3..a63fe3d 100644 Binary files a/squatm3-api/wrapper/3rdparty/squatm3/modules/__pycache__/__init__.cpython-36.pyc and b/squatm3-api/wrapper/3rdparty/squatm3/modules/__pycache__/__init__.cpython-36.pyc differ diff --git a/squatm3-api/wrapper/__pycache__/__init__.cpython-37.pyc b/squatm3-api/wrapper/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 0f1addb..0000000 Binary files a/squatm3-api/wrapper/__pycache__/__init__.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/classes/__pycache__/__init__.cpython-37.pyc b/squatm3-api/wrapper/classes/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index bc99625..0000000 Binary files a/squatm3-api/wrapper/classes/__pycache__/__init__.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/classes/__pycache__/comm.cpython-37.pyc b/squatm3-api/wrapper/classes/__pycache__/comm.cpython-37.pyc deleted file mode 100644 index 5c15bd8..0000000 Binary files a/squatm3-api/wrapper/classes/__pycache__/comm.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/classes/__pycache__/job.cpython-37.pyc b/squatm3-api/wrapper/classes/__pycache__/job.cpython-37.pyc deleted file mode 100644 index 2683dad..0000000 Binary files a/squatm3-api/wrapper/classes/__pycache__/job.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/classes/__pycache__/utils.cpython-37.pyc b/squatm3-api/wrapper/classes/__pycache__/utils.cpython-37.pyc deleted file mode 100644 index 035da08..0000000 Binary files a/squatm3-api/wrapper/classes/__pycache__/utils.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/consumer/__pycache__/__init__.cpython-37.pyc b/squatm3-api/wrapper/consumer/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index e80aec0..0000000 Binary files a/squatm3-api/wrapper/consumer/__pycache__/__init__.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/consumer/__pycache__/consumer.cpython-37.pyc b/squatm3-api/wrapper/consumer/__pycache__/consumer.cpython-37.pyc deleted file mode 100644 index c893e59..0000000 Binary files a/squatm3-api/wrapper/consumer/__pycache__/consumer.cpython-37.pyc and /dev/null differ diff --git a/squatm3-api/wrapper/consumer/consumer.py b/squatm3-api/wrapper/consumer/consumer.py index c3a0aa7..f0143cb 100644 --- a/squatm3-api/wrapper/consumer/consumer.py +++ b/squatm3-api/wrapper/consumer/consumer.py @@ -6,7 +6,6 @@ c_jobs = comm.Communication() job_process = None def report(connection, channel, message): - print("CH: "+channel) #connection.redis.lpush(connection.channel_reporting, message) if channel == connection.channel_reporting: connection.redis.lpush(connection.channel_reporting, message)