Giter VIP home page Giter VIP logo

htb-cli's Introduction

htb-cli's People

Contributors

actions-user avatar qu35t-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

htb-cli's Issues

Improve table

The table can be improved with :

  • A better design
  • Emojis
  • Colors
  • When several machines are selected, it is important to keep them well indented.

Automatic release

Add a pipeline that automatically deploys releases - with static binaries

Unit tests

Add tests that will use the HTB API to ensure that the project is stable and avoid bugs + coverage

panic: runtime error: index out of range [0] with length 0

Bug when specifying a challenge name while flagging a machine.

utils.go -> func SearchItemIDByName (Unmarshal)

go run . submit -m phonebook -f FLAG4TESTING -d 2

goroutine 1 [running]:
github.com/GoToolSharing/htb-cli/utils.SearchItemIDByName({0x16bd7f1d7?, 0x0?}, {0x0, 0x0}, {0x104365079, 0x7})
	/Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/utils/utils.go:66 +0x818
github.com/GoToolSharing/htb-cli/cmd.glob..func8(0x14000146600?, {0x104364073?, 0x4?, 0x104364077?})
	/Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/cmd/submit.go:46 +0x2c4
github.com/spf13/cobra.(*Command).execute(0x104724800, {0x1400007e6c0, 0x6, 0x6})
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:876 +0x548
github.com/spf13/cobra.(*Command).ExecuteC(0x104724080)
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:990 +0x318
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:918
github.com/GoToolSharing/htb-cli/cmd.Execute()
	/Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/cmd/root.go:28 +0x24
main.main()
	/Users/qu35t/Documents/GoToolSharingCorp/htb-cli-reborn/main.go:6 +0x1c
exit status 2

Review the code

The code is 1 year old and contains several bugs, notably with the Hackthebox API.

Bug issue templates

Create bug issue templates to retrieve important information for bug reproduction.

Seasons support

Add user progress for the current season and rank history for previous seasons

[BUG] VIP+ and Seasonal Machine not properly spawned

Describe the bug
The seasonal machine is not properly spawned. After running htb-cli start -m Drive (seasonal box at the time), the program spat out what appears to be an empty target string and incorrectly states that its been deployed to lab, when in reality its been deployed to seasonal/competitive.

Machine deployed to lab. Dedicated Instance spawned
Target: %!s(<nil>)

also, when spawning the machine, the IP of the seasonal machine is undefined

htb-cli info                         
? Do you want to check for active machine ? Yes
Name    |OS      |Retired   |Difficulty   |Stars   |IP          |Status        |Last Reset   |Release
Drive   |Linux   |No        |Hard         |4.8     |Undefined   |User & Root   |<nil>        |2023-10-14

It also seems to have side effects to the rest of the machines, as now spawning any machine is giving me this error

? The following machine was found : Visual Yes
No machine is running
Incorrect lab type.
Target: %!s(<nil>)

htb-cli start -m Travel
? The following machine was found : Travel Yes
No machine is running
Incorrect lab type.
Target: %!s(<nil>)

To Reproduce
Steps to reproduce the behavior:

  1. Obtain name/id of current seasonal mac
  2. Run the command htb-cli start -m [current seasonal machine]
  3. try running other machines afterwards

Expected behavior
The seasonal machine is recognized as such, and handled appropriately and not causing side effects.

Information from active instances

When a machine/challenge is running, a command is needed to display the information about the active machine/challenge (ip, name, difficulty, etc.).

Improving info command

Add a flag to list user/challenge information

htb-cli info -c Phonebook
htb-cli info -m SteamCloud
htb-cli info -u qu35t

The options can also be combined :

htb-cli info -c Phonebook -c Survival
htb-cli info -m Sau -m pilgrimage

Information about a machine to be released - panic: runtime error: index out of range [0] with length 0

Error when displaying information about a machine about to be released :

❯ htb-cli info -m clicker
? Do you want to check for active machine ? No
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/GoToolSharing/htb-cli/utils.SearchItemIDByName({0x14000018b40?, 0x1?}, {0x0, 0x0}, {0x102ee5115, 0x7})
	/Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/[email protected]/utils/utils.go:67 +0xcc0
github.com/GoToolSharing/htb-cli/cmd.glob..func2(0x1032ad8a0?, {0x102ee268c?, 0x2?, 0x2?})
	/Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/[email protected]/cmd/info.go:91 +0x498
github.com/spf13/cobra.(*Command).execute(0x1032ad8a0, {0x1400006e6c0, 0x2, 0x2})
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:876 +0x4b8
github.com/spf13/cobra.(*Command).ExecuteC(0x1032adda0)
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:990 +0x354
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/qu35t/go/pkg/mod/github.com/spf13/[email protected]/command.go:918
github.com/GoToolSharing/htb-cli/cmd.Execute()
	/Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/[email protected]/cmd/root.go:28 +0x28
main.main()
	/Users/qu35t/go/pkg/mod/github.com/!go!tool!sharing/[email protected]/main.go:6 +0x1c

Be the first

Issue transferred. From @skyf0l

As a HTB tryharder, I lose time to spawn my machine during the release, is it possible to program the spawn of a machine to be the first to be on it and have more chance to make a first blood?

[BUG] Displaying owned flags

Describe the bug
Root root ?

> htb-cli machines

│Pilgrimage      🐧Linux      Easy       4.5   ✅Root ❌Root   24 June 2023                    ││                              │
│Sandworm        🐧Linux      Medium     4.6   ✅Root ❌Root   17 June 2023

Hide flag value

The flag must be requested in password mode during a submit to avoid it being in the history or in the screens

Missing no active machine is running message

When no machine is active, the message is missing.

❯ htb-cli info
? Do you want to check for active machine ? Yes

Expected :

❯ htb-cli info
? Do you want to check for active machine ? Yes
No machine is running

Fortresses support

  • Add flag submit for fortresses
  • Retrieve fortress information (name, ip, ...)
  • View flag progress

Add log file

Global flag: --log /tmp/trace.log to retrieve the verbose in a log file (easier for issues)

Status command

Add the status command to see if the configuration is ok

Support Discord webhook

Command logs can be sent to Discord webhooks.
For example we could have a message when starting a machine, stopping, with information such as the machine name and IP address

[BUG] Target error when a machine is assigned

Describe the bug

❯ htb-cli start -m analytics
? The following machine was found : Analytics Yes
No machine is running
You already have a machine assigned on your current lab.
Target: %!s(<nil>)

Machine search verification

When a machine search is performed, a request for validation of the machine(s) found must be present to be sure of the choice.

Invalid HTB_TOKEN

If the HTB_TOKEN variable is invalid, return an error and not panic.

Proxy flag don't get informations

❯ go run . active -p http://127.0.0.1:8080 -v
⠋2023/09/08 11:32:01 Proxy URL found : http://127.0.0.1:8080
2023/09/08 11:32:01 HTTP request URL : https://www.hackthebox.com/api/v4/machine/list
2023/09/08 11:32:01 HTTP request method : GET
2023/09/08 11:32:01 HTTP request body : {}
2023/09/08 11:32:01 HTTP request headers : map[Authorization:[Bearer […REDACTED…]] Host:[www.hackthebox.com] User-Agent:[HTB-Tool]]
2023/09/08 11:32:09 remote error: tls: user canceled
exit status 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.