Giter VIP home page Giter VIP logo

leakless's People

Contributors

normalpunch avatar ysmood avatar

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

Watchers

 avatar  avatar

leakless's Issues

Add a way to hide launched application through leakless

Currently on windows, even if you launch a console application using leakless you get console window flashing.
On further research I found that it is caused by -H=windowsgui flag here.

Problem is, since it is a build-time flag, there is no way to control this programmatically.

After tinkering with the code for a bit it looks like it is possible to adjust this behavior dynamically by removing -H=windowsgui flag and instead setting syscall.SysProcAttr.HideWindow in osSetupCmd for windows here.

Then it is possible to set this through leakless launcher options (I have put up a draft in my fork). This essentially makes it possible to configure leakless launcher like this:

https://github.com/avixFF/leakless/blob/99b97b5/leakless_windows_test.go#L13-L22

This in turn launches modified leakless binary like so:

leakless.exe --hide-window <uid> <tcp-addr> <cmd>

which triggers command setup snippet for windows:

https://github.com/avixFF/leakless/blob/99b97b5/cmd/leakless/os_windows.go#L14-L17

The current issue with this is that it looks like it doesn't completely solve this problem.
While I was successfully was able to show and hide notepad.exe on windows (by replacing path to the binary here), it looks like this approach doesn't work for binaries compiled with -H=windowsgui flag.

In fact when launching a binary compiled with -H=windowsgui flag (i.e. test_windows.exe), leakless.exe is always shown even if HideWindow is true.

Here is the final test that isn't working as expected if you run it manually on windows

What are your thoughts on this?

Processes not getting closed properly on Windows

On v0.6.9, closing the program window after launching a browser with rod wouldn't close the program completely and still would leave chrome processes opened.

Going back-and-forth to v0.6.8 and v0.6.9, changing nothing but leakless version on go.mod, the problem would only happen when the program was using v0.6.9.

I think it's an annoying problem as by default newer versions of go-rod are using v0.6.9 of leakess ๐Ÿ˜€

LockPort hangs the application if port is unusable

If the default port 2978 is not available on the system, then LockPort stucks in infinite for loop.

leakless/leakless.go

Lines 131 to 138 in 9bcba10

for {
var err error
l, err = net.Listen("tcp", fmt.Sprintf(":%d", port))
if err == nil {
break
}
time.Sleep(time.Duration(rand.Intn(100)) * time.Millisecond)
}

In my case, I keep getting:
listen tcp 127.0.0.1:2978: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

This is a problem with Windows. It reserves and blocks the ports if you have Docker or Hyper-V. But this port might be also in use by system. So it would be better to return an error, so users can understand why the application is hanged.

Maybe a try limit would be also good. For example try to listen port 3 times and then return error if it doesn't work. Or maybe allow an ability to switch automatically to .Leakless(false) for go-rod. (I'm not sure about this)

Edit: Oh I see, you use this port for cross-process locking. I'm not sure in this case. Maybe we can check returned error.

Panic in Launcher.Serve

There is an unhandled error in leakless which causes to terminate our process.

image

We are investigating the issue now.

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.