Skip to main content

An example of a package developed with pyenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.

Project description

Team 13 - Hackertype

Buildtest

Open in Visual Studio Code

A little exercise to create a Python package, build it, test it, distribute it, and use it. See instructions for details.

Team Members

Kedan Zha

Bruce Wu

Evan Huang

Amaan Khwaja

Project Description

Hackertype lets you pretend you are the elite hacker you always you knew you were in your heart of hearts, right from the CLI.

CLI Tools

Hackertype

python -m team13hackertype hackertype <language:[python|java]>

Run the classic hackertype app from the old internet days. Press keys to generate programming snippets from the given language and press esc to finish. Currently supported languages are python and java.

Penetrate

python -m team13hackertype penetrate <language> <text:optional>

Simulate a penetration hack. The program will display your text in a scary looking font before launching into hackertype of your given language. The supported language and usage is the same as hackertype. When done, the program will tell you that you are logging out.

Help

python -m team13hackertype -h

View a description of the functions and the parameters provided by the package.

Happy hacking!

Usage in a Python project

While hackertype is meant to be, for the most part, a fun, whimsical command line app, there are a few functionalities that may be imported into your project.

hackertype.looping_string

looping_string(string: str, chunk_size: int) -> Iterator[str]

Creates an iterator that loops over a string forever. Each iteration returns the next chunk of the string of length 'chunk_size'.

  • Parameters
    • string: str
      • The string that is being looped.
    • chunk_size: int
      • The size of the substring that is returned.
  • Returns
    • Iterator[str]
      • An iterator of substrings of string where each substring has size chunk_size. This iterator has no stop.

hackertype.get_code_snippet

get_code_snippet(language: str) -> str

Given a coding language, returns a large code snippet written in that language as a string. Currently, supported values for lanuage are 'python' and 'java'. The code snippet for Python was borrowed from TensorFlow and the snippet for Java was borrowed from Spring.

  • Parameters
    • language: 'python' | 'java'
      • The language of the code snippet.
  • Returns
    • str
      • The code snippet written in the language programming language.
  • Raises
    • NotImplementedError
      • Raised if we do not have a snippet for the language provided. Right now, we support python and java.
    • IOError
      • Raised if there was another IO problem with opening the file.
    • Exception
      • Raised for any other miscellaneous exceptions occuring when opening the file.

hackertype.hackertype

hackertype(language: str, speed: int = 20) -> None

Starts listening for keyboard presses. On key press, prints out speed amount of characters from a code snippet written in the language coding language, until the Esc key is pressed. Note that this function is not asynchronous. This means that after running, it will wait for the Esc key before continuing program execution.

  • Parameters
    • language: 'python' | 'java'
      • The coding language of the hacker snippet to be printed.Supported values include 'python' and 'java'.
    • speed: int, optional, default: 20
      • The number of characters to print out on a single key press.
  • Returns
    • None
  • Raises
    • Same as hackertype.get_code_snippet.

penetrate.penetrate

penetrate(language: str, text: str = "DARKWEB", loading_bar_speed: float = 1.0, emphasis_style: str = "bold red", notification_style: str = "bold green") -> None

Simulates a penetration hacking attempt in the standard output. Logs out text in ASCII text before launching into hackertype. Upon escaping, displays a logging out message. Note that this function utilizes hackertype.hackertype and is also not asynchronous.

  • Parameters
    • language: str
      • The coding language of the hacker type to be printed.Supported values include 'python' and 'java'. See hackertype.hackertype.
    • text: str, optional, default: "DARKWEB"
      • The text shown in the banner. Length of string must be less than 8.
    • loading_bar_speed: float, optional
      • The speed of loading bar progress.
    • emphasis_style: str, optional, default: "bold red"
      • The style for Console print of emphasized text. For options, see Rich docs.
    • notification_style: str, optional, default: "bold green"
      • The style for Console print of emphasized text, used in show_header. For options, see Rich docs.
  • Returns
    • None
  • Raises
    • NotImplementedError
      • Raised if we do not have a snippet for the language provided. Right now, we support python and java. See hackertype.hackertype.
    • ValueError
      • Raised if the given style is not provided.
    • Exception
      • Unexpected exception that may arise from IO or console issues.

Example Usage

View an example usage of the functions here.

Contributing Runbook

  1. Clone the project. (git clone https://github.com/software-students-fall2022/python-package-exercise-project-3-team-13.git)
  2. Change directories into the project. (cd python-package-exercise-project-3-team-13)
  3. Set up and activate your virtual environment. (python -m venv venv && source venv/bin/activate)
  4. Install the requirements. (python -m pip install -r requirements.txt)
  5. The package is now available to you in src/team13hackertype.
  6. Run the tests. (python -m pytest ./tests)
  7. To build, run python -m build.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

team13hackertype-1.0.1.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

team13hackertype-1.0.1-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file team13hackertype-1.0.1.tar.gz.

File metadata

  • Download URL: team13hackertype-1.0.1.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for team13hackertype-1.0.1.tar.gz
Algorithm Hash digest
SHA256 09603336fc70b62f42013427b1a1aea641dd5c0abf6722ce200331b0cf39c3d6
MD5 b92a60c9b9060247086af091adad8d8e
BLAKE2b-256 58e730b07ded5b5152acd1d7193fb30a4f14be446f9b8732f8a145cb633d0760

See more details on using hashes here.

File details

Details for the file team13hackertype-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for team13hackertype-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3effa425b8a6cb52e3973e0ebfecf1aa16a44f3747c242e5d36c5e96c515d27
MD5 e49b2bcc354cbf63f9d9b7a5961b41cc
BLAKE2b-256 9c21fa70998ff1534b61f60925720f9f603feb93d13b115798936f8d3eace4ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page