No project description provided
Project description
TCP Traffic Generator
A simple Python script with no dependencies for generating quick TCP traffic to test a port on an endpoint.
Prerequisites
- Install Python.
- Ensure Python is in your
PATH. In Windows, this option may need to be selected during the installation process. - In Windows, ensure that
.pyfiles are associated with Python. This option may need to be selected during the installation process.
Installation
From PyPI
It is recommended to use pipx for user-installed non-system Python applications:
pipx install tcpgen
If you want to install the program globally (not recommended), you can simply use pip:
pip install tcpgen
Manual Install
To install the script manually from Github, follow these instructions:
Windows
- Create the
%USERPROFILE%\.local\and%USERPROFILE%\.local\bin\directories - Add
%USERPROFILE%\.local\binto yourPATHand.PYto yourPATHTEXT- Open
File Explorer> Right clickThis PC> ClickProperties> ClickAdvanced System Settings> ClickEnvironment Variables - Select
Pathfor your user (not your system), clickEdit, and add%USERPROFILE%\.local\bin - Select
PATHTEXTfor your system, clickEdit, and add.PYto the end of the list
- Open
- Move the
tcpgen/main.pyfile to the%USERPROFILE%\.local\bin\directory and rename it totcpgen.py - Add the
#!/usr/bin/env pythonshebang to the top oftcpgen.pyfile - Open a new CMD instance and run
tcpgen
Linux/MacOS
- Move the
tcpgen/main.pyfile to~/.local/bin/with the nametcpgen(extension not necessary) - Some distros use the
pythoncommand, and others usepython3. Add the#!/usr/bin/env pythonshebang to the top of thetcpgenfile. If it doesn't work, change it to#!/usr/bin/env python3 chmod u+x ~/.local/bin/tcpgento make the file executable.- Open a new terminal session and run
tcpgen
Note: The requirements.txt file contains dev dependencies only. You do not need to pip install the requirements.
Usage
No CLI Args
You can use the script without any arguments passed. For example, if using Windows, you might do this:
>tcpgen
Hostname/IP: localhost
Resolved localhost to 127.0.0.1
Ports (separated by space, e.g. 22 80 443): 22 80 443 3389
[output omitted]
Hostname/IP:
Exiting...
>
This will prompt you for a host and a list of ports until Ctrl-C is detected.
One CLI Arg
If there is only one argument, the script expects a hostname or IP address. For example:
>tcpgen localhost
Resolved localhost to 127.0.0.1
[output omitted]
>
By default, port 22 will be used. If you installed manually, you can change this by setting the DEFAULT_PORTS variable. For example:
DEFAULT_PORTS = [22, 80, 443]
More Than One CLI Arg
If there are multiple arguments, the first must be the hostname or IP address. The rest are expected to be ports. For example:
>tcpgen localhost 22 80 443 3389
Resolved localhost to 127.0.0.1
[output omitted]
>
Example
Here's what it looks like:
Note that the error messages in Windows are different than Linux. In Windows, if the traffic reaches the destination but the traffic is rejected, the traffic will appear to be timed out or dropped (even with Defender Firewall turned off). Ubuntu, however, more accurately displays the error message "Connection refused". This is not a bug, but rather a difference in how the operating systems display rejected traffic. This isn't to say that Ubuntu's error messages are necessarily better, however.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcpgen-0.1.1.tar.gz.
File metadata
- Download URL: tcpgen-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e47d9bfc076c4ae3830ee0ae42060139ca51631b2245062fb9713a3ab125e4b
|
|
| MD5 |
46fc412debdbb316b45b588fd5cabef4
|
|
| BLAKE2b-256 |
8cd27efa92fbe1145777bfcf1721a73b0d6eba5e266789fc7b073dde7dcd71c0
|
File details
Details for the file tcpgen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tcpgen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
283719ad160a015ad91310be55844e21f4ede5868aebb1f0d07e318da576a35c
|
|
| MD5 |
022f3f03d8ec6d5b3d0386aefb823f95
|
|
| BLAKE2b-256 |
718dee47bd344f5c99ba9d195042678aa4e55ed9d92d9b77c1a88738c50e7544
|