-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Changes in decoding the command NO due to FW 1.9a * Version change and minor fixes * Minor comments fixes --------- Co-authored-by: Marco Simone Zuppone <[email protected]>
- Loading branch information
Showing
2 changed files
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# PayShieldPressureTest | ||
|
||
<img src=images/supporting-member-badge.png width=100> | ||
<img src=images/supporting-member-badge.png width=100 alt="logo of Python Foundation Supporting Member"> | ||
|
||
The **pressureTest.py** Python script creates a workload on the **Thales payShield 10k** and **9k** appliances. | ||
The script can be useful during demonstrations of the monitoring features of the appliance and can be used in every case | ||
you need to generate a workload for testing purposes. | ||
|
||
It requires **Python 3**. It was tested on **Python 3.10.2** using a **payShield 10k** with firmware **1.7**. | ||
It requires **Python 3**. It was tested on **Python 3.10.2** using a **payShield 10k** with firmware **1.7a**. | ||
|
||
## Version | ||
|
||
**1.3** | ||
**1.3.1** | ||
|
||
## Usage | ||
|
||
|
@@ -103,7 +103,7 @@ The possible choices are: | |
|
||
C:\Test>python pressureTest.py 192.168.0.36 --nc --times 2 | ||
|
||
PayShield stress utility, version 1.3, by Marco S. Zuppone - [email protected] - https://msz.eu | ||
PayShield stress utility, version 1.3.1, by Marco S. Zuppone - [email protected] - https://msz.eu | ||
To get more info about the usage invoke it with the -h option This software is open source, and it is under the Affero | ||
AGPL 3.0 license | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
from typing import Tuple, Dict | ||
from types import FunctionType | ||
|
||
VERSION = "1.3" | ||
VERSION = "1.3.1" | ||
|
||
|
||
class PayConnector: | ||
|
@@ -233,13 +233,18 @@ def decode_no(response_to_decode: bytes, head_len: int): | |
str_pointer = str_pointer + 1 | ||
print("Type of connection: ", NET_PROTO.get(response_to_decode[str_pointer:str_pointer + 1], "Unknown")) | ||
str_pointer = str_pointer + 1 | ||
print("Number of TCP sockets: ", response_to_decode[str_pointer:str_pointer + 2]) | ||
str_pointer = str_pointer + 2 | ||
if len(response_to_decode) > (24 + head_len): # FW 1.8a or more | ||
socket_field_len = 4 # From FW 1.8a the Number of TCP sockets is 4 character long instead of 2 | ||
else: | ||
socket_field_len = 2 | ||
print("Number of TCP sockets: ", response_to_decode[str_pointer:str_pointer + socket_field_len]) | ||
str_pointer = str_pointer + socket_field_len | ||
print("Firmware number: ", response_to_decode[str_pointer:str_pointer + 9]) | ||
str_pointer = str_pointer + 9 | ||
print("Reserved: ", response_to_decode[str_pointer:str_pointer + 1]) | ||
str_pointer = str_pointer + 1 | ||
print("Reserved: ", response_to_decode[str_pointer:str_pointer + 4]) | ||
|
||
else: # Mode 01 | ||
str_pointer = str_pointer + 2 | ||
if response_to_decode[str_pointer:str_pointer + 1] == '0': | ||
|
@@ -1003,8 +1008,8 @@ def common_parser(response_to_decode: bytes, head_len: int) -> Tuple[str, int, i | |
|
||
parser = argparse.ArgumentParser( | ||
description="Generates workload on PayShield 10k and 9k for the sake of testing and demonstration.", | ||
epilog="For any questions, feedback, suggestions or send money (yes...it's a dream, I know), you can contact the " | ||
"author at [email protected]") | ||
epilog="For any questions, feedback, suggestions or send money (yes...it's a dream, I know), you can contact " | ||
"the author at [email protected]") | ||
parser.add_argument("host", help="Ip address or hostname of the payShield") | ||
group = parser.add_mutually_exclusive_group() | ||
parser.add_argument("--port", "-p", help="The host port. " | ||
|
@@ -1050,7 +1055,6 @@ def common_parser(response_to_decode: bytes, head_len: int) -> Tuple[str, int, i | |
parser.add_argument("--decode", help="If specified the reply of the payShield is interpreted " | ||
"if a decoder function for that command has been implemented.", | ||
action="store_true") | ||
|
||
parser.add_argument("--times", help="How many times to repeat the operation " | ||
"If not specified the default is 1000.", type=int, default=1000) | ||
parser.add_argument("--proto", help="Accepted values are tcp, udp or tls. The default is tcp", default="tcp", | ||
|