Skip to content

Commit

Permalink
Adds README.md
Browse files Browse the repository at this point in the history
Adds setup.py
	- Not working because of main.py config path
	- Future terminal entry-point: hack
Adds __init__.py
	- Future terminal entry-point: hack
Updates main.py
	- Future terminal entry-point: hack
  • Loading branch information
tory1103 committed May 10, 2022
1 parent 8308536 commit d5f40d5
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 4 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<div align="center">

# What's HackMyCLI
HackMyCLI is a command line interface to manage the hackmyvm platform.<br>
It's created in Python and uses [python-fire](https://github.com/google/python-fire) for generating the interface.

</div>

---

# 🏁 Getting started

## Installation

### Using source code
```bash
# Clone repository and change directory to it
$ git clone https://github.com/tory1103/hackmycli.git
$ cd hackmycli

# Install dependencies
$ python3 -m pip install requirements.txt

# Change dir to source
$ cd src/hackmycli

# Run python3 script
$ python3 main.py <args>
```

---

## 🎈 Documentation

### Basic usage
```bash
# Main program syntax
$ hack <command> <parameters>

# Listing all avaliable machines
$ hack list all --update --descendant

# Downloading machine by name
$ hack download <machine_name>

# Downloading machine by URL
# URL must be google drive link for the moment
$ hack download <machine_URL> --no-verify

# Using config command
$ hack config fresh <username> <password> <api_key>

# Using config to add custom data
$ hack config add <key> <value>

# Using config to remove data
$ hack config remove <key>

# For more information about any command
# type: hack <command> --help
# All commands are not avaliable for the moment,
# HackMyVM API is under development
$ hack <command> --help
```
17 changes: 17 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from setuptools import setup

setup(
author="Adrian Toral",
author_email="adriantoral@sertor.es",
version="1.0.0",
description="HackMyVM CLI tool",
name="hackmycli",
install_requires=["requests", "fire", "gdown", "oh-my-pickledb", "pint", "prettytable"],
package_dir={"": "src"},
packages=["hackmycli"],
entry_points = {
'console_scripts': [
'hack=hackmycli.main:main'
]
}
)
Empty file added src/hackmycli/__init__.py
Empty file.
9 changes: 5 additions & 4 deletions src/hackmycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from requests import post, get
from gdown import download
from json import loads
from exceptions import *
from .exceptions import *
from prettytable.colortable import ColorTable, Themes
from my_pickledb import LoadPickleDB

Expand All @@ -16,7 +16,7 @@ class HackMyCLI:
It is a tool for managing HackMyVM platform basics.
It includes some of these utilities:
- List all avaliable machine
- Download machines
- Download machines
- Insert flags to machines
- Local configuration basics
- Submit challenges and machines
Expand Down Expand Up @@ -246,7 +246,7 @@ def status(self, name: str, challenge: bool = False): # Status: Not Working

pass

def __catchAPIKey(self): # Status: Working
def __catchAPIKey(self): # Status: Working
"""
Raises an exception if the API key is not set
"""
Expand Down Expand Up @@ -389,5 +389,6 @@ def leaderboard(self, limit: int = 5): # Status: Not Working

return leaderboard[:limit]

def main(): Fire(HackMyCLI)

if __name__ == "__main__": Fire(HackMyCLI)
if __name__ == "__main__": main()

0 comments on commit d5f40d5

Please sign in to comment.