ysmood / leakless Goto Github PK
View Code? Open in Web Editor NEWThou shalt not stay
Home Page: https://godoc.org/github.com/ysmood/leakless
License: MIT License
Thou shalt not stay
Home Page: https://godoc.org/github.com/ysmood/leakless
License: MIT License
So the size of the executable can be very tiny.
Some candidates:
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?
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
If the default port 2978 is not available on the system, then LockPort stucks in infinite for loop.
Lines 131 to 138 in 9bcba10
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.