Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

httpProxy exits when socks5proxy is set to nil #475

Closed
komlevv opened this issue Jan 25, 2024 · 0 comments · Fixed by #476
Closed

httpProxy exits when socks5proxy is set to nil #475

komlevv opened this issue Jan 25, 2024 · 0 comments · Fixed by #476
Assignees
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@komlevv
Copy link

komlevv commented Jan 25, 2024

Proxify version:

0.0.12

Current Behavior:

httpProxy exits when socks5proxy is set to nil

Expected Behavior:

expect http proxy to listen on default port :8888

Steps To Reproduce:

  1. run >proxify.exe -sa ""
  2. banner code runs
  3. http server goroutine runs
  4. proxify.exe process exits
    probably due to the goroutine lacking blocking code here

    proxify/proxy.go

    Lines 259 to 277 in a794db0

    if p.httpProxy != nil {
    p.httpProxy.TLSPassthroughFunc = func(req *http.Request) bool {
    // if !stringsutil.ContainsAny(req.URL.Host, "avatars") {
    // log.Printf("Skipped MITM for %v", req.URL.Host)
    // return true
    // }
    return false
    }
    p.httpProxy.SetRequestModifier(p)
    p.httpProxy.SetResponseModifier(p)
    go func() {
    l, err := net.Listen("tcp", p.options.ListenAddrHTTP)
    if err != nil {
    gologger.Fatal().Msgf("failed to setup listener got %v", err)
    }
    gologger.Fatal().Msgf("%v", p.httpProxy.Serve(l))
    }()

Could probably fix with something like:

		httpProxyRun := func() {
			l, err := net.Listen("tcp", p.options.ListenAddrHTTP)
			if err != nil {
				gologger.Fatal().Msgf("failed to setup listener got %v", err)
			}
			gologger.Fatal().Msgf("%v", p.httpProxy.Serve(l))
		}
		if p.socks5proxy != nil {
			go httpProxyRun()
		} else {
			httpProxyRun()
		}
@komlevv komlevv added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Jan 25, 2024
@dogancanbakir dogancanbakir self-assigned this Jan 25, 2024
@dogancanbakir dogancanbakir linked a pull request Jan 25, 2024 that will close this issue
4 tasks
@ehsandeep ehsandeep added the Status: Completed Nothing further to be done with this issue. Awaiting to be closed. label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants