All Projects → steinfletcher → gonum

steinfletcher / gonum

Licence: other
An enum generator for Go

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to gonum

php-enum
Enumeration support for PHP
Stars: ✭ 17 (-34.62%)
Mutual labels:  enumeration
massh-enum
OpenSSH 2.3 up to 7.4 Mass Username Enumeration (CVE-2018-15473).
Stars: ✭ 136 (+423.08%)
Mutual labels:  enumeration
Semigroups
The GAP package Semigroups
Stars: ✭ 21 (-19.23%)
Mutual labels:  enumeration
AzureAD Autologon Brute
Brute force attack tool for Azure AD Autologon/Seamless SSO - Source: https://arstechnica.com/information-technology/2021/09/new-azure-active-directory-password-brute-forcing-flaw-has-no-fix/
Stars: ✭ 90 (+246.15%)
Mutual labels:  enumeration
WhoEnum
Mass querying whois records
Stars: ✭ 24 (-7.69%)
Mutual labels:  enumeration
zBuster
Bash script for CTF automating basic enumeration
Stars: ✭ 20 (-23.08%)
Mutual labels:  enumeration
CEH
Exam Prep for the Ec-council Certified Ethical Hacker 312-50
Stars: ✭ 71 (+173.08%)
Mutual labels:  enumeration
Reconky-Automated Bash Script
Reconky is an great Content Discovery bash script for bug bounty hunters which automate lot of task and organized in the well mannered form which help them to look forward.
Stars: ✭ 167 (+542.31%)
Mutual labels:  enumeration
Lucifer
A Powerful Penetration Tool For Automating Penetration Tasks Such As Local Privilege Escalation, Enumeration, Exfiltration and More... Use Or Build Automation Modules To Speed Up Your Cyber Security Life
Stars: ✭ 302 (+1061.54%)
Mutual labels:  enumeration
ggtfobins
Get GTFOBins info about a given exploit from the command line
Stars: ✭ 27 (+3.85%)
Mutual labels:  enumeration
nightcall
Automated Enumeration Script for Pentesting
Stars: ✭ 32 (+23.08%)
Mutual labels:  enumeration
graphw00f
graphw00f is GraphQL Server Engine Fingerprinting utility for software security professionals looking to learn more about what technology is behind a given GraphQL endpoint.
Stars: ✭ 260 (+900%)
Mutual labels:  enumeration
lua-enum
Enumerated Types for Lua
Stars: ✭ 16 (-38.46%)
Mutual labels:  enumeration
spicescript
A Handy-Dandy Personal Toolkit for Enumeration and a headstart on attacking a machine!
Stars: ✭ 20 (-23.08%)
Mutual labels:  enumeration
meta enumerator
C++14 library to enhance enumerator capabilities, including arbitrary length, statically allocated, strongly typed masks.
Stars: ✭ 21 (-19.23%)
Mutual labels:  enumeration
Blowhole
Docker auditing and enumeration script.
Stars: ✭ 21 (-19.23%)
Mutual labels:  enumeration
Spray365
Spray365 makes spraying Microsoft accounts (Office 365 / Azure AD) easy through its customizable two-step password spraying approach. The built-in execution plan features options that attempt to bypass Azure Smart Lockout and insecure conditional access policies.
Stars: ✭ 233 (+796.15%)
Mutual labels:  enumeration
Clippy
Terribad PrivEsc enumeration script for Windows systems
Stars: ✭ 15 (-42.31%)
Mutual labels:  enumeration
HostEnumerator
A tool that automates the process of enumeration
Stars: ✭ 29 (+11.54%)
Mutual labels:  enumeration
auto-recon-ng
Automated script to run all modules for a specified list of domains, netblocks or company name
Stars: ✭ 17 (-34.62%)
Mutual labels:  enumeration

gonum

I don't recommend using this in production, but rather as an example of how one could go about using AST to generate code. I am not planning to maintain this or add any new features.

gonum is an enum generator for Go. It is inspired by the powerful enum types found in Java. gonum has the following capabilities

  • Reference and compare enums using values
  • Provide a display value for the enumerated fields
  • Generate an enum instance from a string factory method
  • Generate a slice of display values
  • JSON support
  • Enum instances can be passed as errors since they implement Error() string

Install

From a github release

curl https://raw.githubusercontent.com/steinfletcher/gonum/master/download.sh | sh
mv bin/gonum /usr/local/bin

OR

go get -u github.com/steinfletcher/gonum

Example

To define an enum, create a struct with the suffix Enum. You can define a display value in the struct tag. Adding a hyphen will assign the field name to the display value.

You can then generate the enum as follows.

//go:generate gonum -types=ColorEnum,StatusEnum,SushiEnum

// generate an enum with display values. The display values are used for JSON serialization/deserialization
type ColorEnum struct {
	Red       string `enum:"RED"`
	LightBlue string `enum:"LIGHT_BLUE"`
}

// generate an enum with default display values. The display values are set to the field names, e.g. `On` and `Off`
type StatusEnum struct {
	On  string `enum:"-"`
	Off string `enum:"-"`
}

// generate an enum with display values and descriptions.
type SushiEnum struct {
	Maki    string `enum:"MAKI,Rice and filling wrapped in seaweed"`
	Temaki  string `enum:"TEMAKI,Hand rolled into a cone shape"`
	Sashimi string `enum:"SASHIMI,Fish or shellfish served alone without rice"`
}

When a description is defined the json is serialized as follows (not yet implemented)

{
  "sushi": {
    "name": "SASHIMI",
    "description": "Fish or shellfish served alone without rice"
  }
}

Consumer api

The generated code would yield the following consumer api

Create an enum value

a := Red // OR var a Color = Red

Create an enum from a factory method

var name Color = NewColor("RED")

Get the display value

var name string = a.Name() // "RED"

Get all display values

var names []string = ColorNames() // []string{"RED", "BLUE"}

Get all values

var values []Color = ColorValues() // []string{Red, Blue}

Pass as an error

Enums implement Error() string which means they can be passed as errors.

var a error = Red

Developing

go build gonum.go
go generate
go test .

OR

make test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].