<commit_before>
WebSocket_cURL is a command line tool like cURL command for WebSocket 
which enables you to send a stirng or binary file as WebSocket data. 
Also you can replay array data from Wireshark capture.

This script is not only sending data but also there is a cool feature, FrameCrafter, that 
enables you to modify WebSocket frame, then send it or save to a file.

Supported Features
------------------
General WebSocket_cURL features
* Sending a string data. This is -s option. 
* Sending a binary file. This is -b option.
* Reading an array file and send it. This is -a option.

FrameCrafter
Use -x option at the end of the command to enter FrameCrafter menu where you can
* flip/overwrite WebSocket frame fields. You can create crafted/malformed frame.
* Save the modified data to a file so that you can read/send via -a option.

Command Syntax 
--------------
# python WebSocket_cURL.py <IP ADDRESS> <PORT> [-s|-b|-a] ["string"|binary file|array file] -x (optional)

How to use
-----------
Send a small string data
# python WebSocket_cURL.py 192.168.0.101 80 -s "DEAD BEEF"

Send a large string data, with bash script
# str=; tmp=a; for i in {1..65535}; do str=$str$tmp; done; python WebSocket_cURL.py 192.168.0.101 80 -s "$str"

Send a binary file
# python WebSocket_cURL.py 192.168.0.101 80 -b 50byte.bin

Send an array file 
# cat array
0x81, 0x9c, 0x39, 0x5d, 0xcf, 0x95, 0x6b, 0x32,
0xac, 0xfe, 0x19, 0x34, 0xbb, 0xb5, 0x4e, 0x34,
0xbb, 0xfd, 0x19, 0x15, 0x9b, 0xd8, 0x75, 0x68,
0xef, 0xc2, 0x5c, 0x3f, 0x9c, 0xfa, 0x5a, 0x36,
0xaa, 0xe1
# python WebSocket_cURL.py 192.168.0.101 80 -a array
 
FrameCrafter
# python WebSocket_cURL.py 192.168.0.101 80 -s "DEAD BEEF" -x


Enjoy !

[EOF]
<commit_msg>HOWTO update<commit_after>
How to use FrameCrafter.

Enter FrameCrafter menu by giving --editor option. 
In "Frame Header bits" you can see header binary.
In "Frame Header Analyzer" you can see human friendly view.
In "Frame Crafter Menu" you can select actions.

For example, I selected 'F' to flip FIN bit from '1' to '0'.
And save the array data to a text file so that I can send it later via --array option.

(*;-;)? < python WebSocket_cURL.py 192.168.0.10 9090 /ws -s "DEAD BEEF" -e
-------------------------------------
* Frame Header bits                 *
-------------------------------------
  1000000110001001 0100001001000101
  0100010101000110 0000011000000000
  0000010000000010
-------------------------------------
* Frame Header Analizer             *
-------------------------------------
FIN        [0th bit]: 1
RSV     [1-3th bits]: 000
opcode  [4-7th bits]: 0001
MASK       [8th bit]: 1
Length [9-15th bits]: 9 byte
-----------------------------
* Frame Crafter Menu        *
-----------------------------
Flip FIN bit: F
Flip RSV1 bit: R1
Flip RSV2 bit: R2
Flip RSV3 bit: R3
Overwrite Opcode: O
Flip MASK bit: M
Change Length: L
Write to file: W

Send frame as it is: S

Input: F

-------------------------------------
* Frame Header bits                 *
-------------------------------------
  0000000110001001 0100001001000101
  0100010101000110 0000011000000000
  0000010000000010
-------------------------------------
* Frame Header Analizer             *
-------------------------------------
FIN        [0th bit]: 0
RSV     [1-3th bits]: 000
opcode  [4-7th bits]: 0001
MASK       [8th bit]: 1
Length [9-15th bits]: 9 byte
-----------------------------
* Frame Crafter Menu        *
-----------------------------
Flip FIN bit: F
Flip RSV1 bit: R1
Flip RSV2 bit: R2
Flip RSV3 bit: R3
Overwrite Opcode: O
Flip MASK bit: M
Change Length: L
Write to file: W

Send frame as it is: S

Input: W

File Name: fin.txt

(*'-') < python WebSocket_cURL.py 192.168.0.10 9090 /ws -a fin.txt   



Enjoy !

[EOF]

{'fraction_non_alphanumeric': 0.19503072401816723, 'fraction_numerical': 0.10072134651349185, 'mean_word_length': 2.024232633279483, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 7, 'substrings_counts': 5, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3760372', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1214, 'n_words': 494}