Skip to content

Commit

Permalink
Merge pull request #12
Browse files Browse the repository at this point in the history
Added decoding for more comands and other fixes
  • Loading branch information
mszeu committed May 14, 2021
2 parents 0c09e2f + 8002299 commit 4c1bceb
Show file tree
Hide file tree
Showing 2 changed files with 404 additions and 89 deletions.
120 changes: 66 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,51 @@
# PayShieldPPressureTest

<a href="https://www.jetbrains.com/?from=PayshieldPPressureTest"><img src=images/jetbrains-variant-3.png width=100></a>May thanks to <a href="https://www.jetbrains.com/?from=PayshieldPPressureTest">JetBrains</a> for giving us the <b>Open Source License</b> for free with the full access to their developer suite.
<a href="https://www.jetbrains.com/pycharm/?from=PayshieldPPressureTesPyCharm">PyCharm</a> is an awesome Python IDE that greatly simplified my work.
<a href="https://www.jetbrains.com/?from=PayshieldPPressureTest"><img src=images/jetbrains-variant-3.png width=100></a>
Many thanks to <a href="https://www.jetbrains.com/?from=PayshieldPPressureTest">JetBrains</a> for giving us the <b>Open
Source License</b> for free with the full access to their developer suite.
<a href="https://www.jetbrains.com/pycharm/?from=PayshieldPPressureTesPyCharm">PyCharm</a> is an awesome Python IDE that
greatly simplified my work.

&nbsp;

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.

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.

The project is in an early development stage and still a bit clumsy.

It requires **Python 3**. It was tested on **Python 3.7** and **3.8** using a **payShield 10k**.
It requires **Python 3**. It was tested on **Python 3.7** and **3.8** using a **payShield 10k** with firmware **1.3a**

## Version

**1.1.3**

## Usage

**pressureTest.py \[-h\] \[--port PORT\] \[--proto {tcp, udp, tls}\] \[--keyfile CLIENT.KEY\] \[--crtfile CLIENT.CRT\] \[--key {2048,4096} | --nc | --j2 | --j4 | --n8 | --jk | --randgen\] \[--head HEADER\] \[--forever\] \[--times TIMES\] host**
pressureTest.py [-h] [--port PORT] [--key {2048,4096} | --nc | --no | --j2 | --j4 | --j8 | --jk | --randgen]
[--header HEADER] [--forever] [--decode] [--times TIMES] [--proto {tcp,udp,tls}] [--keyfile KEYFILE]
[--crtfile CRTFILE]
host

**host** you need to specify the ip address or the hostname/fqdn of the **payShield** appliance.
**host** *ip address* or the *hostname/fqdn* of the **payShield** appliance.

**--port** specify the host port, if the parameter is omitted the default value **1500** is used.
**--port** specifies the host port, if omitted the default value **1500** is used.

**--proto** specify the protocol to use, **tcp**, **udp** or **tls**, if the parameter is omitted the default value **
tcp** is used. If **tls** is used you might specify the path of the client key file and the certificate using the
parameters **--keyfile** and **--crtfile**
**--proto** specify the protocol to use, **tcp**, **udp** or **tls**, if omitted the default value **tcp**
is used.
If **tls** is used you might specify the path of the client key file and the certificate using the parameters **
--keyfile** and **--crtfile**.

**--keyfile** the path of the client key file, if is not specified the default value is **client.key**. It's only
considered if the protocol is **tls**
**--keyfile** the path of the client key file, if is not specified the default value is **client.key**.
It's only considered if the protocol is **tls**.

**--crtfile** the path of the client certificate file, if is not specified the default value is **client.crt**. It's
only considered if the protocol is **tls**
**--crtfile** the path of the client certificate file, if is not specified the default value is **client.crt**.
It's only considered if the protocol is **tls**.

**--key** the length of the RSA key that the appliance will generate. There are only two valid values: **2048** or **
4096**. If the parameter is not specified **2048** is the default.
**--key** the length of the RSA to generate. There are only two valid values: **2048** or **4096**.
If not specified, **2048** is the default.

**--header** the header string to prefix to the host command, if it is not specified the default value is **HEAD**.
**--header** the header string to prefix to the host command, if not specified the default value is **HEAD**.

**--nc** performs just an **NC** test. It cannot be used in conjunction with **--key**.

Expand All @@ -54,35 +65,36 @@ only considered if the protocol is **tls**

**--times** how many times execute the test. If it is not specified the default value is **1000** times.

**--decode** decodes the response of the payShield if a decoder function is available for the command.
**--decode** decodes the response of the payShield if a decoder function is available for the command.
The commands **--decode** supports in the release are: **N0**, **NO**, **NC**, **J2**, **J4**, **J8** and **JK**.

## Example

C:\Test>*python pressureTest.py 192.168.0.36 --nc --times 2*

PayShield stress utility, version 1.1.1, by Marco S. Zuppone - msz@msz.eu - 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

Iteration: 1 of 2

Return code: 00 No error
Command sent/received: NC ==> ND
sent data (ASCII) : b'HEADNC'
sent data (HEX) : b'0006484541444e43'
received data (ASCII): b'HEADND005D672700000000001500-0023'
received data (HEX) : b'0021484541444e44303035443637323730303030303030303030313530302d30303233'

Iteration: 2 of 2

Return code: 00 No error
Command sent/received: NC ==> ND
sent data (ASCII) : b'HEADNC'
sent data (HEX) : b'0006484541444e43'
received data (ASCII): b'HEADND005D672700000000001500-0023'
received data (HEX) : b'0021484541444e44303035443637323730303030303030303030313530302d30303233'

DONE
C:\Test>python pressureTest.py 192.168.0.36 --nc --times 2

PayShield stress utility, version 1.1.3, by Marco S. Zuppone - msz@msz.eu - 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

Iteration: 1 of 2

Return code: 00 No error
Command sent/received: NC ==> ND
sent data (ASCII) : b'HEADNC'
sent data (HEX) : b'0006484541444e43'
received data (ASCII): b'HEADND005D672700000000001500-0023'
received data (HEX) : b'0021484541444e44303035443637323730303030303030303030313530302d30303233'
Iteration: 2 of 2
Return code: 00 No error
Command sent/received: NC ==> ND
sent data (ASCII) : b'HEADNC'
sent data (HEX) : b'0006484541444e43'
received data (ASCII): b'HEADND005D672700000000001500-0023'
received data (HEX) : b'0021484541444e44303035443637323730303030303030303030313530302d30303233'
DONE

## NOTES

Expand All @@ -95,15 +107,15 @@ The **EI** command used to generate the RSA key requires authorization, and the

Copyright(C) 2020-2021 **Marco S. Zuppone** - **msz@msz.eu** - [https://msz.eu](https://msz.eu)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or any later version.

This program is distributed in the hope that it will be useful,
but **WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.** See the
**GNU Affero General Public License** for more details.

This program is distributed in the hope that it will be useful,
but **WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.** See the
GNU Affero General Public License for more details.

## Questions, bugs & suggestions
For any questions, feedback, suggestions, send money ***(yes...it's a dream I know)*** you can contact the author at **msz@msz.eu**
Loading

0 comments on commit 4c1bceb

Please sign in to comment.