Create new branch to refactor cli

This commit is contained in:
Tiffany 2023-11-06 18:27:52 -05:00
parent 904ec77932
commit b0c14895b4
6 changed files with 37 additions and 19 deletions

19
main.py
View file

@ -1,19 +0,0 @@
#!/usr/bin/python
import argparse
from src import ddos
def main():
parser = argparse.ArgumentParser(description="DDoS Proof of concept")
parser.add_argument('-t', '--target', help="Attack target IP address")
parser.add_argument('-p', '--port', help="Port to attack")
parser.add_argument('-i', '--ipaddress', help="Fake ip address")
args = parser.parse_args(ddos)
if __name__ == "__main__":
main()

4
requirements.txt Normal file
View file

@ -0,0 +1,4 @@
typer==0.3.2
colorama==0.4.4
shellingham==1.4.0
pytest==6.2.4

5
simpleDDoS/__init__.py Normal file
View file

@ -0,0 +1,5 @@
"""Top-level package for Simple DDoS."""
# simpleDDoS/__init__.py
__app_name__ = 'simple_ddos'
__version__ = "0.1.0"

0
simpleDDoS/__main__.py Normal file
View file

28
simpleDDoS/cli.py Normal file
View file

@ -0,0 +1,28 @@
"""Top-level package for Simple DDoS."""
# simpleDDoS/cli.py
from typing import Optional
import typer
from simpleDDoS import __app_name__, __version__
app = typer.Typer()
def _version_callback(value: bool) -> None:
if value:
typer.echo(f"{__app_name__} v{__version__}")
raise typer.Exit()
@app.callback()
def main(
version: Optional[bool] = typer.Option(
None,
"--version",
"-v",
help="Show the application's version and exit.",
callback=_version_callback,
is_eager=True,
)
) -> None:
return