Giter Club home page Giter Club logo

cook's Introduction

COOK

An overpower wordlist generator, splitter, merger, finder, saver, create words permutation and combinations, apply different encoding/decoding and everything you need.

Frustration killer! & Customizable!

Index

Installation

Use Go or download latest builds

go install -v github.com/glitchedgitz/cook/v2/cmd/cook@latest

Configuration

From version v2.2 cook save cook-ingredients at $home/.config/cook/cook-ingredients

To change create a path variable name COOK=[YOUR PATH]

Basic

Without basics, everything is complex.

Ranges

Param Approach

Name them anything and use them to generate the pattern. This will be more useful when you apply encoding column-wise using methods.

cook -start intigriti,bugcrowd  -sep _,- -end users.rar,secret.zip  / start sep end

Note: you must include parameter in the pattern, otherwise it will not print anything. 

COOK's Ingredients

Cook depends on cook-ingredients, which are .yaml files collections of wordsets, functions, ports, wordlists from assetnotes, seclist, fuzzdb, 15+ etc.

Categories

Category Description
lists Array of values to directly use when called out
files Array of urls
ports Ranges of numbers
raw-files Array of local files
functions Functions are used to generate patterns

Save wordlists/lists/chars everything in my.yaml

Functions

cook -dob date[17,Sep,1994] elliot _,-, dob

Customize my.yaml

Edit my.yaml manually or use these commands.

▸ Add/Update

If keyword doesn't exist it will create it. Otherwise it will update it and add the new value in the same variable.

# Syntax
cook add [keyword]=[value1, value2, ..., valueN] in [category]

# Command
cook add unique_name=word1,word2,word3 in lists

▸ Delete

cook delete [keyword]

Local File / Fetch URL

use : after param name.

cook -f: live.txt f
cook -f: https://example.com/wordlist.txt f

Access Wordlists from databases

Cook has fetched multiple repositories and can directly use wordlist from these repos...

assetnotes, seclist, fuzzdb, etc.

Methods

Using methods you can encode, decode, reverse, split, sort, extract and can do much more...

Methods can be applied on final output or column-wise

  • -m/-method to apply methods on the final output
  • -mc/-methodcol to apply column-wise.
  • param.methodname apply to any parameter-wise, will example this param thing later.

Multiple Encoding

  • Overlapping Encodings:
    • Use dot .
    • md5.b64e.urle apply multiple methods one by one.
    • Output Logic:
      • Generated Pattern > md5 hashing > base 64 encoding > URL Encoding.
  • Different Encodings:
    • Use comma ,
    • md5,sha1,sha256 apply different encoding to the same generated pattern.
    • Output Logic:
      • Generated Pattern > md5 hashing
      • Generated Pattern > sha1 hashing
      • Generated Pattern > sha256 hashing

Break naming conventions 💫

Special focus on these 2 methods, these will be great help everytime you use any wordlist.

Smart Break -m smart

▶ cook adminNew,admin_new -m smart
Output:

admin
New
admin
new

Smart Join -m smartjoin[<case>:<char>]

It breaks and join back with the supplied character.

▶ cook adminNew,admin-old -m smartjoin[:_]
Output:

admin_New
admin_old

Apply Cases over separated

Here we applied camlecase

▶ cook suppose_this_is_long_text -m smartjoin[c:_]
Output:

suppose_This_Is_Long_Text

All methods cook help methods

sort                           - Sort them
sortu                          - Sort them with unique values only
reverse                        - Reverse string
leet                           - a->4, b->8, e->3 ...
                                    leet[0] or leet[1]

smart                          - Separate words with naming convensions
                                    redirectUri, redirect_uri, redirect-uri  ->  [redirect, uri]
smartjoin                      - This will split the words from naming convensions &
                                    param.smartjoin[c,_] (case, join)
                                    redirect-uri, redirectUri, redirect_uri ->  redirect_Uri

u          upper               - Uppercase
l          lower               - Lowercase
t          title               - Titlecase

String Operations

split                          - split[char]
splitindex                     - splitindex[char:index]
replace                        - Replace All replace[this:tothis]

JSON

json                           - Extract JSON field
                                    json[key] or json[key:subkey:sub-subkey]

Url Operations

fb         filebase            - Extract filename from path or url
s          scheme              - Extract http, https, gohper, ws, etc. from URL
           user                - Extract username from url
           pass                - Extract password from url
h          host                - Extract host from url
p          port                - Extract port from url
ph         path                - Extract path from url
f          fragment            - Extract fragment from url
q          query               - Extract whole query from url
k          keys                - Extract keys from url
v          values              - Extract values from url
d          domain              - Extract domain from url
           tld                 - Extract tld from url
           alldir              - Extract all dirrectories from url's path
sub        subdomain           - Extract subdomain from url
           allsubs             - Extract subdomain from url

Encode/Decode

b64e       b64encode           - Base64 encode
b64d       b64decode           - Base64 decode

           charcode            - Give charcode encoding
                                    - charcode[0]
                                        &#97&#98&#99 
                                    - charcode[1] with semicolon 
                                        &#97;&#98;&#99;

hexe       hexencode           - Hex string encode
hexd       hexdecode           - Hex string decode

jsone      jsonescape          - JSON escape
jsonu      jsonunescape        - JSON unescape

urle       urlencode           - URL encode reserved characters
            utf16                - UTF-16 encoder (Little Endian)
            utf16be              - UTF-16 encoder (Big Endian)
urld       urldecode           - URL decode
urleall    urlencodeall        - URL encode all characters

xmle       xmlescape           - XML escape
xmlu       xmlunescape         - XML unescape

unicodee   unicodeencodeall    - Unicode escape string encode (all characters)
unicoded   unicodedecode       - Unicode escape string decode

HASHES

md5                            - MD5 sum
sha1                           - SHA1 checksum
sha224                         - SHA224 checksum
sha256                         - SHA256 checksum
sha384                         - SHA384 checksum
sha512                         - SHA512 checksum

Some Usecases Examples

Some general usecases to grasp understanding of cook.

▸ Sites using custom suffix/preffix?

▸ Join wordlists line-by-line

Use -append flag:

cook -l: live.txt -p: payloads.txt l / p -append 2

# Multiple columns    
cook col1 col2 col3 col4 col5 -append 2,5

Note: Sometime is confusing to find index of column, then use -col

▸ Print at every step

If you want to start printing data for each permuation, then use -min flag

Note: Sometime is confusing to find index of column, then use -col

Combine with tools

Generate pattern and combine with other tools using PIPE.

cook [Generated Pattern] | [Any tool with pipe input]

▸ Basic Auth Fuzzing with FFUF

cook usernames_list : passwords_list -m b64e | ffuf -u https://target.com -w - -H "Authorization: Basic FUZZ"

▸ Null Payload Fuzzing with FFUF

cook https://target.com/**100 | ffuf -u FUZZ -w - 

▸ Hidden Parameters with x8

cook [generated output] | x8 -u https://target.com

▸ Live Top level domains with dnsx or httprobe

cook example.com seclists-tlds.txt  | dnsx -v

ULTIMATE USAGE

Too overpower? But everyday you came accross weird BB stuff, like a big json file from target? May be you want to extract, join, merge or whatever. You can use cook smartly as per your usecase.

Real life usage example:

As BBH, we came arross JSON file often. YOu may be you read find wordlist to save in your collection.

Let's say you read this blog about IIS Shortname Vulnerabilities https://blog.assetnote.io/2020/09/18/finding-hidden-files-folders-iis-bigquery/.

Here Assetnote shared BIG ZIP FILE, Now you need something that can save this file and you can recall it when you need.

Save it like this..., this will save file in my.yaml

cook add shub_zip_files=[URL] in files

Or manually save in my.yaml,

shub_zip_files : [https://storage.googleapis.com/zipfilesbq/zipfiles.json]

Note: cook already saved it in default wordlists, you can use cook shub_zip_files to access it

▸ File contains data like this, but this isn't directly useful.

{"repo_name":"cocowool/RoseCMS","ref":"refs/heads/1","path":"user_guide/_downloads/ELDocs.tmbundle.zip","mode":"33261","id":"f7a11b364ca918379b48ad525798148e7470b6b1"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/fast.zip","mode":"33188","id":"f4ed17b98c9d7bcd21efc4523ce75fbe2b071d0a"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/store.zip","mode":"33188","id":"e2add30dc0e3129dc89e20a71abe7314052d0002"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/ultra.zip","mode":"33188","id":"86a8ec776107c075ce2c7f803472aa97dc25cbf7"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/normal.zip","mode":"33188","id":"b4602c94ee000ee54c71c9302b9db956b3fd9f0e"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/fastest.zip","mode":"33188","id":"f4ed17b98c9d7bcd21efc4523ce75fbe2b071d0a"}
{"repo_name":"xuguanfeng/practise","ref":"refs/heads/1","path":"node_modules/selenium-webdriver/node_modules/adm-zip/test/assets/maximum.zip","mode":"33188","id":"86a8ec776107c075ce2c7f803472aa97dc25cbf7"}
...

Let say you need to:
▸ Extract json field path
▸ extract filebase from path
▸ then spliting it based on naming conventions

Single line solution

▸ With cook not just we can extract it, we can extract filebase from path and sort unique, then use smartjoin to create diff permuataions.

cook -z shub_zip_files z.json[path].fb.sortu.smartjoin[c:_]

And this is also how cook was born, while fuzzing IIS Shortnames and later on I added other features.

Repeat Operator * and **

  • Use * for horizontal repeating.
  • Use ** for vertical repeating.
  • And try this *10-1 or this *1-10.

Parsing Rules

Columns Separated by space
Values Separated by comma
Params You can give param any name, use - before anything to make it param -param value
Raw Strings Use ` before and after the string to stop cook's parsing. Useful when you need to use any keyword as a word.
Pipe Input Take pipe input using - as value of any param.
File Input Use : after param name to take file input. cook -f: live.txt f
Functions Can be called using params only.
Methods Can be used on params or on final output

Flags

Flag Usage
-peek Peek the output using -peek 50 for first 50 lines
-a, -append Append to the previous lines, instead of permutations
-c, -col Print column numbers and there values
-conf, -config Config Information
-mc, -methodcol Apply methods column wise -mc 0:md5,b64e; 1:reverse
To all cols separate -mc md5,b64e
-m, -method Apply methods to final output
-h, -help Help
-min Minimum no of columns to print

Use as library

COOK := New(&COOK{
    Pattern: "1-10 .example.com",
})

COOK.Generate()
fmt.Printf("Generated list: %v", COOK.Final)

Search the cook-ingredients using library

COOK := NewWithoutConfig()
results := COOK.Search("api")
fmt.Printf("Searched: %v", results)

Share your recipies and ingredients in cook-ingredients

  • Share your yaml file with community

Contribute

  • Use concurrency and make it faster
  • Autocomplete for shells
  • Make append work something like this cook file1 =/= file2, make sure chars directly work with all terminals.
  • Making raw string works like as it works in programming languages. Means better parser.
  • I don't know, you might use your creativity and add some awesome features.
  • You can buy me a coffee

cook's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

cook's Issues

Cook recipe

Can you create a cook-recipe repository so people can share their cook.yml config?

Double digit ranges

Is there a way I can generate a double digit range like:

00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19

This is useful for server naming which usually uses conventions similar to this

Version / release / git tags consistency

Context

I was surprise the BA PKGBUILD for cook was using version 1.6 and 2.0 because we are using the last commit (217) from the git source and not a specific release.

Troubleshooting

While building the PKGBUILD manually I found that it was targeting version 1.6 (see screenshot)

image

I'm not familiar with go building process, but it seems that the following commands (https://github.com/BlackArch/blackarch/blob/cd42e3f9aa06e236bd22d18ad9a11ac5265e9895/packages/cook/PKGBUILD#L25-L34) are fetching the @latest release.
So I checked the git tags here and found they were inconsistent: 1.0, v1.5, v1.6.0, 2.0.a, 2.0. Sometimes it using x.y and sometimes x.y.z (not following semver https://semver.org/) but more importantly sometimes it has the v prepended and sometimes not. So I think the go resolver find that v1.6.0 is matching @latest because alphabetically v.1.6.0 is higher than 2.0 (ASCII order).

irb(main):001:0> ['1.0', 'v1.5', 'v1.6.0', '2.0.a', '2.0'].sort
=> ["1.0", "2.0", "2.0.a", "v1.5", "v1.6.0"]

Solution

Solution A

Remove old git tags and create new git tags that all match the same versioning convention.

Example of end result:

1.0.0
1.5.0
1.6.0
2.0.0
2.0.0-a

# or

v1.0.0
v1.5.0
v1.6.0
v2.0.0
v2.0.0-a

Solution B

If you want to keep the old references, you can create new tags following the convention with the higher precedence.

Example of end result:

1.0
2.0
2.0.a
v1.0.0
v1.5
v1.5.0
v1.6.0
v2.0.0
v2.0.0-a

About 2.0.0 and 2.0.0-a 2.0.0-a < 2.0.0 (see semver precedence) so no worry it's not alphabetically in the right order. If you want to be extra sure make the actual 2.0 become 2.0.1.

[BUG] CRLF

Empty lines with file mode

cook -f: https://raw.githubusercontent.com/danielmiessler/SecLists/master/Discovery/Web-Content/common.txt f

problem with s in basic mode!

run this command:
cook a,A s,S

we expectation print :

as
aS
As
AS

but output is:

a!
a#
a$
a%
a&
a(
...SNIP....
A^
A_
A`
A|
A~
A"
AS

I use cook Version 2.0

Extension suggestion

Tools look great, would be awesome to see a year, month, and season extension set added!

[Bug] Space/Tab in cook.exe

Command:
cook.exe -start first,second -end 2020,2021 start:end
or cook.exe first,second:2020,2021

Outputs:

error: yaml: line 4: found character that cannot start any tokenfirst2020
first2021
second2020
second2021

Working with files and methods

Hi
Thank you for providing this awesome tool!!
I wanna merge 2 files with smart method but i don't know how, i have read your guide in the repository but still i'm a bit confused ....
Suppose that i have 2 wordlists (wordlist1 and wordlist2) , what is the command to merge 2 wordlists together using smart method?
Thank you!

Installation / deployment

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. #13 (reply in thread)

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.

Switch wordlists config to string instead of list

files:
  bo0m_fuzz: [https://raw.githubusercontent.com/Bo0oM/fuzz.txt/master/fuzz.txt]
raw_files:
  bxss: [E:\tools\base\bxss.txt]

Is there a reason why the value of the wordlist is a list here ?

Should we maybe switch to:

files:
  bo0m_fuzz: "https://raw.githubusercontent.com/Bo0oM/fuzz.txt/master/fuzz.txt"
raw_files:
  bxss: "E:\tools\base\bxss.txt"

Support the repeater

hello
Can you support an option for a loop or a repeater
example

cook -start admin,root -sep -,. -end test,help start:sep:end

output normal

admin-test
admin-help
admin.test
admin.help
root-test
root-help
root.test
root.help

the output can you support

admin-test
admin-help
admin.test
admin.help
root-test
root-help
root.test
root.help

test-admin
test-root
test.admin
test.root
help-admin
help-root
help.admin
help.root

With the addition of an option for that, and not to be done automatically

regex

Hi,
thanks for the great tool, sadly I've got some problems with it.

Version: (i do not know how to get it while downloading it with go get ..)

md5sum /root/go/bin/cook
## output:
# 55e5ae65e1dafadb32960afb301f4349  /root/go/bin/cook

I do not understand the regular expression function. I'm trying to use the regex from here

Empty responses:

echo -e 'Job[49]\njob[49]\nJob[49]\njob[50]' | cook -d - d -m regex[^[a-z]+\[[0-9]+\]]
## outputs nothing
echo 'adam[23]\neve[7]\nJob[48]\nsnakey' | cook -d - -m regex[^[a-z]+\[[0-9]+\]] d 
## output (should be adam[23] and eve[7] but is:
# adam[23]

The date function different in linux (maybe in future change it to square bracket instead of parenthesis)?

cook help usage | grep dob | cut -d '$' -f 2 | sh
## output:
# sh: 1: Syntax error: "(" unexpected
# i found the problem, should wildcard the brackets in linux:
cook help usage | grep dob | cut -d '$' -f 2 | sed -e 's/^[ \t]*//' | replace \( \\\( | replace \) \\\) | bash
elliot_17Sep1994
elliot_Sep171994
elliot_17/Sep/1994
elliot_Sep/17/1994
elliot_17-Sep-1994
elliot_Sep-17-1994
elliot_17.Sep.1994
elliot_Sep.17.1994
elliot_17.1994
elliot_Sep.1994
elliot_17.Sep
elliot-17Sep1994
elliot-Sep171994
elliot-17/Sep/1994
elliot-Sep/17/1994
elliot-17-Sep-1994
elliot-Sep-17-1994
elliot-17.Sep.1994
elliot-Sep.17.1994
elliot-17.1994
elliot-Sep.1994
elliot-17.Sep

regards,

esp0xdeadbeef.

issues with files option from cook.yaml

Hello there,
firstly, thanks a lot for the tool, i am exploring and it is really good.
However, i am facing an issue with the option of 'files'
in the cook.yaml, if i change the path of files i.e the password file from my local filesystem, then i am getting error.
example command - cook -admin admin,root,superuser,su,sa,moderator -s "." -sep / https://mysite.com:sep:admin:robot_1000
i am changing the location referred in the cook.yaml file to my local filesystem. When i run the above command, then i get the error `E:\tools\wordlists\SecLists\Discovery\Web-Content\RobotsDisallowed-Top1000.txt
panic: open E:\tools\wordlists\SecLists\Discovery\Web-Content\RobotsDisallowed-Top1000.txt: no such file or directory

goroutine 1 [running]:
main.fileValues(0x84c0280, 0x4e, 0xbffa46d2, 0xa, 0x84f011c)
/home/kali/go/src/github.com/giteshnxtlvl/cook/main.go:157 +0x172
main.main()
/home/kali/go/src/github.com/giteshnxtlvl/cook/main.go:226 +0x53b
`
i even tried changing the path in the main.go file as shown in the above error but it throws out the same error.

Can you help me on where i am messing up?? or is it an issue.

Thanks in advance.

Ranges are not working

Pre-defined sets are working but not ranges:

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

$ cook 10-20 -config-path /usr/share/cook/cook.yaml
10-20

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

$ cook a -config-path /usr/share/cook/cook.yaml 
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z

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.