# 编写自定义剧本插件

自定义的剧本需要实现以下方法：

```go
type Step interface {
	ID() string
	SetID(id string)
	Exec(session *transport.Session, sudo bool) ([]byte, error)
	GetSchema() (interface{}, error)
	Create(conf []byte) (Step, error)
	Name() string
	Desc() string
	Config() interface{}
}
```

同时需要定义一个manifest.yaml

```yaml
name: vnc_install
import: vnc_install
```

其中name表示唯一的插件名，import表示导入的路径，可以参考go path的导入规则。

详情可见example：

<https://github.com/ssbeatty/vnc_install>

编写后放到`data/plugin`

添加识别成功后可以在剧本添加时找到

![](https://2312048859-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQkSQhUKIXYVpPqKWHNg7%2Fuploads%2FW7HHfCpcMQ0a7HROHdba%2Fimage.png?alt=media\&token=fbc7929f-9cf6-42a6-8ad5-90e5120d1101)
