Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrofroes committed Nov 14, 2020
1 parent af774fb commit 0ca516e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# manw

manw is a very simple and fast command line search engine for Windows API written in Go.
manw is a very simple and fast command line search engine for Windows OS info written in Go.

## Why?

Expand Down Expand Up @@ -145,6 +145,11 @@ Used in_SECURITY_CLIENT_CONTEXT
* Now both Kernel Structure and Data Type module supports caching feature.
* Some other code improvements.

## **Version 1.2**:

* General bug fix
* Now the cache directory is created only if you specify the -c flag

## **Special Thanks**

* [@merces](https://github.com/merces) for the core idea and all the support.
Expand Down
30 changes: 17 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func main(){
usage := `NAME
manw - A multiplatform command line search engine for Windows API.
manw - A multiplatform command line search engine for Windows OS info.
SYNOPSIS:
Expand All @@ -26,9 +26,9 @@ OPTIONS:
-k, --kernel string Search for a Windows Kernel Structure.
-t, --type string Search for a Windows Data Type.
`
`

if(len(os.Args) < 2){
if(len(os.Args) < 3){
fmt.Fprintf(os.Stderr, usage)
os.Exit(1)
}
Expand All @@ -38,8 +38,6 @@ OPTIONS:
os.Exit(1)
}

cachePath := config.Load()

apiFlag := flag.StringP("api", "a", "", "Search for a Windows API Function/Structure.")
cache := flag.BoolP("cache", "c", false, "Enable caching feature.")
dataTypeFlag := flag.StringP("type", "t", "", "Search for a Windows Data Type.")
Expand All @@ -52,15 +50,21 @@ OPTIONS:
dataTypeSearch := *dataTypeFlag
kernelSearch := *kernelFlag

var cachePath string

if(cacheFlag){
cachePath = config.Load()
}

switch {
case apiSearch != "":
scrapy.RunAPIScraper(apiSearch, cachePath, cacheFlag)
case dataTypeSearch != "":
scrapy.RunTypeScraper(dataTypeSearch, cachePath, cacheFlag)
case kernelSearch != "":
scrapy.RunKernelScraper(kernelSearch, cachePath, cacheFlag)
default:
scrapy.RunAPIScraper(os.Args[1], cachePath, cacheFlag)
case apiSearch != "":
scrapy.RunAPIScraper(apiSearch, cachePath, cacheFlag)
case dataTypeSearch != "":
scrapy.RunTypeScraper(dataTypeSearch, cachePath, cacheFlag)
case kernelSearch != "":
scrapy.RunKernelScraper(kernelSearch, cachePath, cacheFlag)
default:
scrapy.RunAPIScraper(os.Args[1], cachePath, cacheFlag)
}

}
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Load() (cachePath string){
cachePath = cacheDir + "/manw/"

if _, err := os.Stat(cachePath); os.IsNotExist(err) {
err := os.Mkdir(cachePath, 0700)
err := os.MkdirAll(cachePath, 0700)
utils.CheckError(err)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/scrapy/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func RunAPIScraper(search, cachePath string, cacheFlag bool){
cache.RunAPICache(search, cachePath, api)
}
}else{
url := googleTypeSearch(search)
url := googleAPISearch(search)

if url == ""{
utils.Warning("Unable to find the provided Windows resource.")
Expand Down

0 comments on commit 0ca516e

Please sign in to comment.