-
Notifications
You must be signed in to change notification settings - Fork 33
/
send-one-message.py
72 lines (60 loc) · 2 KB
/
send-one-message.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -*- coding: utf-8 -*-
import logging
from websocket_fuzzer.main.websocket_wrapper import send_payloads_in_websocket
#
# Configure logging
#
logging.basicConfig(level=logging.DEBUG,
format='[%(asctime)s][%(levelname)-8s] %(message)s',
datefmt='%m-%d %H:%M',
filename='output.log',
filemode='w')
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
formatter = logging.Formatter('[%(asctime)s][%(levelname)-8s] %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
#
# User configured parameters
#
# The websocket address, including the protocol, for example:
#
# ws://localhost
# wss://localhost
#
ws_address = ''
# The proxy server used to send the messages. This is very useful
# for debugging the tools
http_proxy_host = 'localhost'
http_proxy_port = '8080'
# Log path, all messages are logged in different files
log_path = 'output/'
# Websocket authentication message. The tool will send the authentication
# message (if included in messages below) and wait for `session_active_message`
# before sending `message`
auth_message = ''
session_active_message = ''
# The message to send to the websocket
message = ''
# The list containing all messages to be sent to the websocket. In some cases
# You need to send two or more messages to set a specific remote state, and
# then you send the attack
messages = [
auth_message,
message,
]
# When doing analysis of the websocket responses to try to identify exceptions
# and other errors, ignore these errors since they are common for the
# application under test
ignore_errors = []
#
# Do not touch these lines
#
send_payloads_in_websocket(ws_address,
messages,
session_active_message,
ignore_errors,
0,
log_path,
http_proxy_host,
http_proxy_port)