-
Notifications
You must be signed in to change notification settings - Fork 83
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
Initial linting of ddexec.sh #14
base: main
Are you sure you want to change the base?
Conversation
Problem: ddexec.sh: line 447: /usr/bin/readlink: Argument list too long Solution: Ensusre bin variable is not exported by unsetted it first
From: if [ -z "$DEBUG" ]; then DEBUG=0; fi To: : "${DEBUG:=0}"
This would be all for this PR, just to note that I may create other one with these changes. What do you think of them?
|
Hello! I'm really glad that someone actually took the time to read and understand such difficult to read code.
|
On the other hand please consider that I expect to change the technique to memdlopen. Whenever I have the time, hehe. |
Hi @arget13, Thank you for the fast response. I agree with your comments, and think the compatibility with all possible shell should not be broken (I guess it was hard to get, congratulation) let me show refs.
So I'll just consider tests before you accept this small refactoring (all in functions) to avoid conflicts. Anyway it is the best next step and I'm educatively playing with GitHub Actions. |
I'd like to collaborate more on this ddexec project and understand it is ok. Thank you for pointing me to memdlopen, I'll have a look at the paper (curiosity, i will not use it). My interestsThis leads me to introduce my interests. I am not in cybersecurity (any more), but rather in a user friendly TUI (git like) for remote execution on machines where I am invited. Usually for testing, with code in Bash on my machine piping to an ssh tunnel (this you are familiar lol). Existing alternatives or friendsI created the lib_dispatch bash code to call any Bash function anywhere (with introspection) but it cannot call native binary encoded strings and calling some native code as mprocs would be a nice feature (my chiefs would appreciate :-)). I do not like to touch filesystem either, not for furtivity as pentester but more because it may not exists, be in readonly, not mounted, slow, etc and this leads to add some magic (path) in code, may create some race conditions, etc => this is dirty even for legitimate code! The only solution for in memory execution from shell I found before yours is using memfd_create syscall. See a recent response and also blog. This requires perl! BriefAll that to say that the memory parsing you are doing in pure shell is really innovative, I was waiting for that! The features this unveil extend far beyond education and security. It empowers shell scripting and this is where my interest lie. Saludos desde Chile. |
Hi @arget13,
It works super fine, nice script.
I refactored a little, with the function declaration and docstring my style so that I can have a nice folding, I hope this is OK for you.
Otherwise, there are 2 minors improvement:
if [ -n "interp_off" ]
(forgot the dollar)bin
variable is exported in my environment, so I get an "argument list too long" because this variable becomes very big and is passed (in my case as exported)But most of all these are the changes:
Folding
The folding I get with docstrings inside functions, for reference