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

New Module: docker_build #103

Merged
merged 13 commits into from
Mar 9, 2021
Merged

New Module: docker_build #103

merged 13 commits into from
Mar 9, 2021

Conversation

Kovah
Copy link
Contributor

@Kovah Kovah commented Dec 12, 2019

This is currently WIP.

Managed to get everything working so far, the last thing missing is to properly print instructions. Pulling instructions from a list like all other data wouldn't be the problem, but I would also like to print generic output for instructions that run and are not cached.

Example:

RUN ls -la

should output something like

total 208
drwxr-xr-x  21 kg  staff    672 Dec 12 09:36 .
drwxr-xr-x@  9 kg  staff    288 Dec  5 00:17 ..
-rw-r--r--   1 kg  staff    219 May 21  2019 .editorconfig
drwxr-xr-x  15 kg  staff    480 Dec 12 11:01 .git
-rw-r--r--   1 kg  staff     28 Jun  1  2018 .gitignore
-rw-r--r--   1 kg  staff   2812 May 21  2019 .travis.yml

but I'm not sure how to implement this. Any ideas?

Also, hope the current code is not that horrifying. 😬

@Kovah
Copy link
Contributor Author

Kovah commented Jan 9, 2020

My idea would be to re-use the current modules. Inside the docker build, for each step it selects a random other module and runs it once. Would that be possible?

@svenstaro
Copy link
Owner

Not all modules are suited for that but perhaps you can just use the same data set of the other modules and mesh 'em together to create someting believable.

@Kovah
Copy link
Contributor Author

Kovah commented Jan 10, 2020

Hm dummer.. that would be a lot of duplicated code in that case. Are there modules which could be run once or would that require rewriting the app?

@svenstaro
Copy link
Owner

It should be possible to call the cc module in the middle of another one. Try it, it likely just works as expected.

@svenstaro
Copy link
Owner

Do you need any further mentoring to get this wrapped up? I think it's a really cool idea and I'd like it in.

@Kovah
Copy link
Contributor Author

Kovah commented Jan 23, 2020

I did not have the time to look into it, but it's on my todo list.

@svenstaro
Copy link
Owner

svenstaro commented Jan 23, 2020 via email

@Kovah
Copy link
Contributor Author

Kovah commented Feb 24, 2020

Took some time but finally manged to get this running. Used the implementation from the main.rs file. The command runs a random other module a single time, then chooses a new random one.

Last needed: some command signatures for the modules. Thought about implementing them into the modules directly, like weblog::get_signature() which returns something like tail -f /var/log/nginx/access.log.
What do you think?

@svenstaro
Copy link
Owner

@Kovah Sorry for the loooong silence. I did a pretty major refactor of genact and everything is now much more modern, using wasm-bindgen and proper modularization. However, changes for modules themselves should be minimal.

I kind of like the idea of command signatures as you suggest. They could we somewhat lightly generated and also serve for other modules. Their invocation doesn't need to make too much sense.

Are you still interested in getting this merged? I certainly would like it!

@Kovah
Copy link
Contributor Author

Kovah commented Aug 10, 2020

Sure, I till have a look at this later.

@svenstaro
Copy link
Owner

Hey, did you have a chance to look at this? :)

@Kovah
Copy link
Contributor Author

Kovah commented Sep 22, 2020

Will take a look later. Can you assign this issue to me? 🤔

@Kovah
Copy link
Contributor Author

Kovah commented Sep 24, 2020

Updated the module with the latest structure. It's working good so far.
Only issue: the first line gets overwritten but I don't know why. Maybe you could take a look into this?

Before:

Sending build output to Docker daemon  567.52MB

After:

Step 1/99 : RUN ./botnet.shcker daemon  567.52MB
 ---> Using cache
 ---> f7ef5623b82a

@Kovah
Copy link
Contributor Author

Kovah commented Sep 24, 2020

There's a problem: The ubuntu-latest for wasm32-unknown-unknown check tells me that the return statement is missing in the new get_signature() function, while the ubuntu-latest for x86_64-unknown-linux-musl check tells me to remove it.

src/modules/cargo.rs Outdated Show resolved Hide resolved
@svenstaro
Copy link
Owner

Hey, are you still interested in getting this merged?

@Kovah
Copy link
Contributor Author

Kovah commented Jan 4, 2021

Absolutely, I just stopped working on it because of these weird CI errors. Couldn't get everything fixed. If you have an idea, please share it with me.

@Kovah
Copy link
Contributor Author

Kovah commented Feb 7, 2021

It's fixed. Hoooray! 🥳

@svenstaro
Copy link
Owner

Very nice, will take a look soon!

@svenstaro
Copy link
Owner

So I had a proper look and the output certainly is great and nice idea! I'll merge it as is as it took so long to get here but I'm wondering whether you're interested in doing some follow-up work as well. For instance, currently, the output is a little broken on the web version which should be easy to fix with a dprint. Also, it might make sense to implement the modules as structs implementing a common trait as this would cut down some of the repetition we're seeing here.

At any rate, good job. I'm happy we can finally get this in!

@svenstaro svenstaro merged commit 0b49a7d into svenstaro:master Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants