Can we get the Code of a Plugin?

I wonder if I could see the code of plugins?
(I’m making an Anti-virus plugin which checks the code of all Scripts, it can be usefull to check also the plugins)
Also, could we “call a plugin”? Like a require() function…
I don’t know how if we could use a plugin without downloading it (or buy, I don’t know how it works)

You can see the code of a plugin by inserting the related Lua or RBXM(X) files in a plugin’s folder. This is accessible via your InstalledPlugins folder on your filesystem.

In terms of a plugin accessing another plugin’s code, no I don’t think you can do that. You can’t call a plugin either unless it’s a ModuleScript, though I don’t see much use for doing that. The only thing you’d get back is what the ModuleScript exposes to other scripts via its return value.

You may be able to insert the plugin as a model via InsertService but I don’t know that works or if that’s of any effect.

1 Like

Also to “call a plugin” it’s just because we could make a script calling a plugin wich wasn’t downloaded before…
Anyway, thanks for you supporting me!

Adding onto what colbert mentioned, you cannot directly modify the local and executed files of an installed plugin. However, you could try to emulate a plugin via an installed plugin. If the plugin files are are acquired through the :GetObjects() function of the Data Model (game) and the scripts containing the source code are converted into module scripts, a separate plugin can simply require such module scripts and initialize the entire plugin asynchronously with your anti-virus plugin.

Of course some plugin mechanics would have to be modified, such as the plugin’s settings, so that certain plugins aren’t able to interact with other plugins. Though I assume that wouldn’t be too much of an issue, considering that you’d probably already have a framework implemented that could detect and edit specific harmful components of a script.

Yes it is possible

game:GetService("InsertService"):LoadAsset(ID,true).Parent = workspace

1 Like

Thanks! It’s exactly what I would need!
So, we can see the code of a plugin without executing it and we can also some sort of “call” a plugin, however it must be done with a plugin, for me it’s fine since it’s for an anti-virus plugin.
For thoses who doesn’t know how to make a plugin: Intro to plugins