glitchedgitz / cook

A wordlist framework to fullfill your kinks with your wordlists. For security researchers, bug bounty and hackers.
https://twitter.com/glitchedgitz
MIT License
1.01k stars 104 forks source link

Installation / deployment #30

Closed noraj closed 2 years ago

noraj commented 2 years ago

On BlackArch Linux we packaged cook this way: https://github.com/BlackArch/blackarch/blob/master/packages/cook/PKGBUILD

As for all ArchLinux packages, cook binary is deployed under /usr/bin/cook and config files under /urs/share/cook (eg. /usr/share/cook/cook.yaml).

Launching cook like that just fails because cook is not able to find it's configuration file

$ cook a                                       
2021/12/04 16:31:56 Err: Parsing YAML yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `Not Found` into map[string][]string

So as a workaround the user is forced to either define the conf file path with the environment variable or the parameter

$ cook a -config-path /usr/share/cook/cook.yaml

It's happening because this was implemented rather than what I suggested.

I don't really know where cook is looking for it's config file because even if you copy cook.yml under /usr/bin or in the working directory cook won't find it.

There are 2 solutions to that:

Solution 1

Implementing a XDG compliant config deployment cf. https://github.com/giteshnxtlvl/cook/discussions/13#discussioncomment-684604

Solution 2

define a go BUILD variable to defined the install path, so when the binary is build any linux distro maintainer would be able to define INSTALLDIR=/usr/bin/cook and cook would look here for it's config file.

Idea

I think any tool creator should think about "how OS maintainers/packagers will deploy my tool on their OS" rather than assume that people will just git clone the tool cd in the repo and do ./tool. Else it prevent for mass deployment on OSes or complexify the work of OS packagers.

noraj commented 2 years ago

It's behavior for cook 1.6 (https://github.com/BlackArch/blackarch/issues/3278), I'm not sure if it really changed in 2.0

glitchedgitz commented 2 years ago

It should work in 2.0, But I will check it later.

glitchedgitz commented 2 years ago

Thanks @noraj for taking your time and suggesting these changes. I appreciate that.

glitchedgitz commented 2 years ago

Solved in #31