-
Notifications
You must be signed in to change notification settings - Fork 119
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
[WIP] Shifud #549
base: main
Are you sure you want to change the base?
[WIP] Shifud #549
Conversation
@frankhli843 we'd better consist with the folder structure of existing repo. should move shifud as a subfolder under /pkg? |
devices.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this file check in?
var devices []shifud.DeviceConfig | ||
var wg sync.WaitGroup | ||
|
||
log.Println("Launching our little scanner minions! 🚀") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pkg/logger/log.go to print shifu log
var wg sync.WaitGroup | ||
|
||
log.Println("Launching our little scanner minions! 🚀") | ||
for i := 1; i <= 254; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
254 to be a const?
|
||
log.Println("Launching our little scanner minions! 🚀") | ||
for i := 1; i <= 254; i++ { | ||
ip := fmt.Sprintf("192.168.1.%d", i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make 192.168.1. as a const
BTW, one question, would the network always start with 192.168.1?
Shifud
How do I run it locally
Running in docker
docker build -t shifud . docker run -p 8080:8080 shifud
Shifud Plugin Development Guide
Shifud is a flexible network scanning tool with an extensible plugin system. This guide will help you create and integrate a new plugin into the Shifud system.
Understanding the Plugin System
Shifud uses Go's
plugin
package to dynamically load plugins at runtime. Plugins are compiled as shared libraries (.so
files) and loaded from theplugins
folder. Each plugin must implement theScannerPlugin
interface, which is defined in theshifud.go
file:Creating a New Plugin
http_scanner.go
.** function.** This is where you'll add the core functionality of your plugin. The
Scan()
function should return a slice ofDeviceConfig
objects and an error if something goes wrong.Compiling and Loading the Plugin
Compile the plugin as a shared library. Use the following command to compile your plugin:
You can also build all plugins yourself with the following command:
Replace
your_plugin_name
with the appropriate name for your plugin.file. The
LoadPlugins
function in theshifud.go
file handles the loading of plugins. It is called in themain.go
file as follows:With these steps, your new plugin will be loaded and used by Shifud at runtime. You can create additional plugins by following the same process, and Shifud will automatically load and use them.
Testing Your Plugin
After creating and loading your plugin, run the
main.go
file to test your plugin's functionality. If everything is set up correctly, you should see the output of your plugin'sScan()
function when Shifud runs.