-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix/tools)proxy usage with socks & http (#69)
* (fix/proxy)using GetHttpTransport() to configure http settings still a some work to do in order to have Proxy set for every tool if it is specified by the user, but having a helper function to easily fetch http.Transport with the correct values is a good start (also fixed some english spelling mistakes) next step is to add the proxy to the configuration of bigger projects, like httpx & nuclei. AFAIK httpx does not use ProxyFromEnvironment in order to set the proxy, which means we probably will have to set it manually. This can be annoying as this is not a mandatory setting will also probably need to rework dorks through a cleaner interface, because using exec.Command() prevents us from manually setting a proxy. * (mod/build)adding rule to dynamically build Yelaa To run Yelaa with Proxychains, one needs to have a dynamically compiled program. This is because Proxychains uses LD_PRELOAD tricks to hook to connect() and set the proxy, which is not possible with a statically program such as one compile with gc (standard go compiler) the script used to compile is still very much a WIP and other options could be explored instead: - use a TUN interface (https://github.com/nicocha30/ligolo-ng) - TUN to SOCKS (https://github.com/russdill/tunsocks) - iptables tricks (https://github.com/n1nj4sec/pr0cks) but this would not work very well with docker * (mod/gowitness)setting proxy option in chrome - dorks was broken with socksproxy so the option for that was removed. scan command is broken, further testing is required * (fix/tools)manually setting proxy for most interfaces * (mod/docs)improving docs regarding make dynamic rule * (mod/main)removing YELAA_PROXY env value usage * (mod/ci)bumping tool version & improving docs a little
- Loading branch information
Showing
17 changed files
with
187 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ target.txt | |
# Build files | ||
dist/ | ||
Yelaa | ||
DynYelaa | ||
nuclei-templates/ | ||
|
||
# Out files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
package helper | ||
|
||
import "os" | ||
import ( | ||
"net/http" | ||
"net/url" | ||
"os" | ||
) | ||
|
||
var YelaaPath = GetHome() + "/.yelaa" | ||
|
||
func GetHome() (home string) { | ||
home, _ = os.UserHomeDir() | ||
return | ||
} | ||
|
||
func GetHttpTransport() (*http.Transport) { | ||
var proxy = os.Getenv("HTTP_PROXY") | ||
url, err := url.Parse(proxy) | ||
|
||
if proxy != "" && err == nil { | ||
return &http.Transport{ | ||
DisableKeepAlives: true, | ||
Proxy: http.ProxyURL(url), | ||
} | ||
} | ||
return &http.Transport{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eou pipefail | ||
|
||
# | ||
# This script is a work-around to use gccgo with reflect2 | ||
# (which is a dependency of protobuf, so it's can of hard for us to | ||
# fix this manually) | ||
# | ||
# Reference: https://github.com/modern-go/reflect2/issues/21 | ||
# | ||
# I don't like this either, but this has been the only way to make proxychains | ||
# work, because it relies on LD_PRELOAD to set proxies, so we should use gccgo | ||
# to resolve libc dynamically | ||
# https://github.com/golang/go/issues/31772#issuecomment-488322661 | ||
# https://github.com/Jguer/yay/issues/429#issuecomment-393661439 | ||
# | ||
|
||
PKG_PATH="${GOPATH}/pkg/mod/github.com/modern-go/[email protected]" | ||
FILENAME="unsafe_link.go" | ||
|
||
PROGRAM_NAME=DynYelaa | ||
|
||
compile () { | ||
echo "[+] Running compile with gccgo" | ||
go build -compiler gccgo -o ${PROGRAM_NAME} | ||
} | ||
|
||
backup_program_files () { | ||
echo "[+] Making backups of soon-to-be modified file" | ||
|
||
sudo cp -v "${PKG_PATH}/${FILENAME}" "/tmp/${FILENAME}" | ||
mv ~/.cache ~/.cache.bak | ||
} | ||
|
||
reset_cache () { | ||
|
||
echo "[+] Resetting file" | ||
sudo mv -v "/tmp/${FILENAME}" "${PKG_PATH}/${FILENAME}" | ||
|
||
mv ~/.cache.bak ~/.cache | ||
} | ||
|
||
replace_files () { | ||
echo "[+] Fixing reflect.unsafe_New call in ${PKG_PATH}/${FILENAME}" | ||
|
||
sudo sed -i 's/go:linkname unsafe_New reflect.unsafe_New/go:linkname unsafe_New reflect.unsafe__New/' "${PKG_PATH}/${FILENAME}" | ||
sudo sed -i 's/go:linkname unsafe_NewArray reflect.unsafe_NewArray/go:linkname unsafe_NewArray reflect.unsafe__NewArray/' "${PKG_PATH}/${FILENAME}" | ||
} | ||
|
||
backup_program_files | ||
|
||
replace_files | ||
|
||
reset_cache | ||
|
||
echo "[+] Successfully generated ${PROGRAM_NAME}:" | ||
file "${PROGRAM_NAME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.