Commit 48ea5ef2 authored by dmknght's avatar dmknght

Improve help banner

parent 05195dc9
Pipeline #1136 failed with stages
......@@ -12,7 +12,7 @@
"label": "[Test]Show user options",
"type": "shell",
"command": "nim c -r src/test/testargs.nim a.b -w x"
}
},
{
"label": "[Test]Test run connection",
"type": "shell",
......
# import os
import utils
import .. / cores / info
proc fastHelp*() =
# TODO read data from .nimble for dynamic information
echo "DirbNim - A modern URL bruteforcing tool"
echo "Author: Nong Hoang \"dmknght\" Tu <dmknght@parrotsec.org>"
echo "URL: https://nest.parrotsec.org/dmknght/dirbnim"
echo "Usage: dirbnim <URL> [Options]"
echo " \e[97m" & appName & " - " & appDescr & "\e[0m"
echo "\nGitlab: \e[94m" & homePage & "\e[0m"
echo "Author: \e[36m" & author & "\e[0m - <\e[96m" & email & "\e[0m>"
echo "Version: \e[95m" & version & "\e[0m - License: \e[35m" & license & "\e[0m"
echo "\n\e[31mUsage\e[0m: \e[91mdirbnim\e[0m <\e[92mURL\e[0m> [\e[32mOptions\e[0m]"
proc helpBanner*() =
......@@ -15,3 +16,8 @@ proc helpBanner*() =
showHelpCmd(keyword = "-w", value = "<path_to_wordlist>", descr = "Define custom wordlist")
showHelpCmd(keyword = "-a", value = "<browser agent>", descr = "Custom user-agent")
showHelpCmd(keyword = "-c", value = "<cookie>", descr = "Custom HTTP cookie")
proc fullHelp*() =
fastHelp()
helpBanner()
# import tables
import os
import .. / cores / paramHandler
import strutils
import utils
import help
type
......@@ -27,10 +30,12 @@ proc getOptions*(): DirbOptions =
helpKeywords = ["help", "--help", "-h", "--h", "-help"]
case szArgs:
of 0:
discard # TODO fast help and exit
fastHelp()
allOptions.paramError = true
of 1:
if paramStr(1) in helpKeywords:
discard # TODO full help and exit
fullHelp()
allOptions.paramError = true
else:
allOptions.url = urlFormat(paramStr(1))
else:
......@@ -47,11 +52,16 @@ proc getOptions*(): DirbOptions =
of "-a":
allOptions.agent = paramStr(i + 1)
else:
if paramStr(i) in helpKeywords:
# TODO full help banner and handle exit
discard
if paramStr(i).startsWith("-"):
if paramStr(i) in helpKeywords:
fullHelp()
allOptions.paramError = true
else:
prntErr("Unknown option " & paramStr(i))
else:
allOptions.url = urlFormat(paramStr(1))
if allOptions.url == "":
allOptions.paramError = true
i -= 1
i += 2
......
......@@ -59,5 +59,4 @@ proc prntFound*(status, url: string) =
elif status.startsWith("5"):
msg = "[\e[96m" & status & "\e[0m]" & msg # Bright Cyan
echo msg
const
appName* = "DirbNim"
appDescr* = "A modern URL bruteforcing tool"
author* = "Nong Hoang Tu"
email* = "dmknght@parrotsec.org"
homePage* = "https://nest.parrotsec.org/dmknght/dirbnim"
version* = "0.1"
license* = "GPL-3.0"
\ No newline at end of file
......@@ -9,6 +9,9 @@ proc urlFormat*(url: string): string =
Input: URL: string
Outpt: URL: string
]#
if url == "":
prntErr("URL is missing")
return ""
if not url.startsWith("http://") and not url.startsWith("https://"):
prntWarn("Added http to url", "Missing protocol in URL")
result = "http://" & url
......
import .. / modules / cli / options
let allOptions = getOptions()
if not allOptions.paramError:
discard # TODO handle here
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment