Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.6.0 #116

Merged
49 commits merged into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a4cab21
Add no-check flag
qu35t-code Jan 8, 2024
1ca7cd9
Update dev version to a4cab218bb5f9851028091eb74469d4e21c469d0
Jan 8, 2024
32501bf
Create CODEOWNERS
qu35t-code Jan 8, 2024
0625a73
Update dev version to 32501bfab6e93e517a12b7017130f96e6b933311
Jan 8, 2024
eccf372
Add submit for fortresses
qu35t-code Jan 11, 2024
df9a090
Merge branch 'dev' of github.com:GoToolSharing/htb-cli into dev
qu35t-code Jan 11, 2024
41bd1a3
Update dev version to df9a0904e40ac48835fff2efc1ae57d69ab89097
Jan 11, 2024
e660c0a
Remove automatic dev version
qu35t-code Jan 11, 2024
20442b1
Fix conflicts
qu35t-code Jan 11, 2024
21357e2
Add ra submit when no flag is submitted
qu35t-code Jan 11, 2024
1fc0949
Add submit for endgames
qu35t-code Jan 11, 2024
10b18b4
Add prolab submit
qu35t-code Jan 11, 2024
9242976
Add extension message when 2h left
qu35t-code Jan 11, 2024
c501fa6
Fix merge with main
qu35t-code Jan 11, 2024
93784f9
Change from pgrep to grep
qu35t-code Jan 16, 2024
f7845a5
Add fuzzy finder for challenges
qu35t-code Jan 17, 2024
4f0447e
Implement fuzzy search for submit challenges
qu35t-code Jan 17, 2024
6f39aee
Fix get ip from season machine
qu35t-code Jan 17, 2024
4d1cf38
Fix info from release arena machine
qu35t-code Jan 17, 2024
2a11f58
Fix crash when show active release arena machine informations
qu35t-code Jan 17, 2024
60f6596
Fix lint
qu35t-code Jan 17, 2024
7f862df
Fix lint
qu35t-code Jan 17, 2024
ba489d7
Start hosts command
qu35t-code Jan 18, 2024
f59920b
Fix typo
qu35t-code Jan 18, 2024
13382c0
Fix hosts command
qu35t-code Jan 18, 2024
cfc43eb
Retry when the server returns an error
qu35t-code Jan 19, 2024
d152356
Update status code
qu35t-code Jan 19, 2024
d7fd6c2
Add status code for rate limit
qu35t-code Jan 19, 2024
cad2533
Fix VPN download error when API lag
qu35t-code Jan 19, 2024
2422b87
Merge branch 'hosts' of github.com:GoToolSharing/htb-cli into dev
qu35t-code Jan 19, 2024
6a665d8
Add blank hosts command
qu35t-code Jan 19, 2024
7c717e0
Fix lint
qu35t-code Jan 19, 2024
5fce097
Uncomment hosts command
qu35t-code Jan 19, 2024
317fefa
Add SSH login and check if user.txt exists
qu35t-code Jan 19, 2024
4c83c68
Add blooder info for challenges
qu35t-code Jan 19, 2024
1f65741
Add Code of conduct + contributing files
qu35t-code Jan 21, 2024
896f5a4
Add pull request template file
qu35t-code Jan 21, 2024
b6ee87b
Added debug messages and improved file content detection
qu35t-code Jan 22, 2024
1a23802
Start autosubmission feature
qu35t-code Jan 22, 2024
dc37cb0
Add auto submit when user flag is found for machines and release arena
qu35t-code Jan 27, 2024
298536f
Add custom port
qu35t-code Jan 27, 2024
572bb9b
Merge getflag into dev
qu35t-code Jan 27, 2024
ff01f6b
Remove difficulty flag for machines + RA
qu35t-code Jan 27, 2024
bdf9a59
Fix lint
qu35t-code Jan 27, 2024
c923a38
Fix info search error
qu35t-code Jan 27, 2024
2250876
Add achievement link
qu35t-code Jan 27, 2024
49ed17d
Add time to spawn
qu35t-code Jan 27, 2024
43a1963
Display achievement link only when user pwned the machine
qu35t-code Jan 27, 2024
da2b9bc
Merge hosts into dev
qu35t-code Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
QU35T-code
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix
- [ ] New feature
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new warnings
21 changes: 1 addition & 20 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,4 @@ jobs:
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: go build -v ./...

update-version:
needs: build
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: 'dev'
- name: Update Version in config.go
run: |
sed -i "s/const Version = \".*\"/const Version = \"$GITHUB_SHA\"/" config/config.go
- name: Commit and Push
run: |
git config --global user.email "github-action@github.com"
git config --global user.name "Github Action"
git add config/config.go
git commit -m "Update dev version to $GITHUB_SHA"
git push origin HEAD:dev
run: go build -v ./...
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
github@qu35t-mail.simplelogin.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't hesitate to contribute to the project with a pull request. All ideas are welcome to improve the project !
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div>
<img alt="current version" src="https://img.shields.io/badge/linux-supported-success">
<img alt="current version" src="https://img.shields.io/badge/windows-supported-success">
<img alt="current version" src="https://img.shields.io/badge/WSL-supported-success">
<img alt="current version" src="https://img.shields.io/badge/mac-supported-success">
<br>
<img alt="amd64" src="https://img.shields.io/badge/amd64%20(x86__64)-supported-success">
Expand Down
80 changes: 80 additions & 0 deletions cmd/getflag.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package cmd

import (
"fmt"
"os"
"strings"

"github.com/GoToolSharing/htb-cli/config"
"github.com/GoToolSharing/htb-cli/lib/ssh"
"github.com/GoToolSharing/htb-cli/lib/submit"
"github.com/spf13/cobra"
"go.uber.org/zap"
)

var getflagCmd = &cobra.Command{
Use: "getflag",
Short: "Retrieves and submits flags from an SSH connection (linux only)",
Run: func(cmd *cobra.Command, args []string) {
config.GlobalConfig.Logger.Info("Getflag command executed")
username, err := cmd.Flags().GetString("username")
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
password, err := cmd.Flags().GetString("password")
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
host, err := cmd.Flags().GetString("host")
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
port, err := cmd.Flags().GetInt("port")
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
connection, err := ssh.Connect(username, password, host, port)
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
userFlag, err := ssh.GetUserFlag(connection)
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
userFlag = strings.ReplaceAll(userFlag, "\n", "")
hostname, err := ssh.GetHostname(connection)
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
connection.Close()
url, payload, err := ssh.BuildSubmitStuff(hostname, userFlag)
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}

message, err := submit.SubmitFlag(url, payload)
if err != nil {
config.GlobalConfig.Logger.Error("", zap.Error(err))
os.Exit(1)
}
fmt.Println(message)

config.GlobalConfig.Logger.Info("Exit getflag command correctly")
},
}

func init() {
rootCmd.AddCommand(getflagCmd)
getflagCmd.Flags().StringP("username", "u", "", "SSH username")
getflagCmd.Flags().StringP("password", "p", "", "SSH password")
getflagCmd.Flags().IntP("port", "P", 22, "(Optional) SSH Port (Default 22)")
getflagCmd.Flags().StringP("host", "", "", "(Optional) SSH host")
}
64 changes: 64 additions & 0 deletions cmd/hosts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package cmd

import (
"fmt"

"github.com/GoToolSharing/htb-cli/config"
"github.com/spf13/cobra"
)

var hostsCmd = &cobra.Command{
Use: "hosts",
Short: "Interact with hosts file",
Run: func(cmd *cobra.Command, args []string) {
config.GlobalConfig.Logger.Info("Hosts command executed")
fmt.Println("WIP")
// addParam, err := cmd.Flags().GetString("add")
// if err != nil {
// config.GlobalConfig.Logger.Error("", zap.Error(err))
// os.Exit(1)
// }

// deleteParam, err := cmd.Flags().GetString("delete")
// if err != nil {
// config.GlobalConfig.Logger.Error("", zap.Error(err))
// os.Exit(1)
// }

// ipParam, err := cmd.Flags().GetString("ip")
// if err != nil {
// config.GlobalConfig.Logger.Error("", zap.Error(err))
// os.Exit(1)
// }

// if addParam != "" && deleteParam != "" {
// config.GlobalConfig.Logger.Error("Only one parameter is allowed")
// os.Exit(1)
// }

// if addParam != "" {
// err = hosts.AddEntryToHosts(ipParam, addParam)
// if err != nil {
// config.GlobalConfig.Logger.Error("", zap.Error(err))
// os.Exit(1)
// }
// }

// if deleteParam != "" {
// err = hosts.RemoveEntryFromHosts(ipParam, deleteParam)
// if err != nil {
// config.GlobalConfig.Logger.Error("", zap.Error(err))
// os.Exit(1)
// }
// }

config.GlobalConfig.Logger.Info("Exit hosts command correctly")
},
}

func init() {
rootCmd.AddCommand(hostsCmd)
hostsCmd.Flags().StringP("add", "a", "", "Add a new entry")
hostsCmd.Flags().StringP("ip", "i", "", "IP Address")
hostsCmd.Flags().StringP("delete", "d", "", "Delete an entry")
}
Loading
Loading