-
Notifications
You must be signed in to change notification settings - Fork 13
How to setup
This document will guide you through installation of yls onto your system. The whole process is divided into 2 parts:
-
yls
binary installation - Editor configuration
For a quick tutorial checkout the following video: https://user-images.githubusercontent.com/26434056/183893630-b3474a51-9a44-4998-a7a6-10fb87da5139.mp4
The goal of this step is to ensure you have yls installed on your machine.
- you must ensure that you have a supported python version: python 3.8+ 🐍
- you must ensure that you have requirements to install
yara-python
- you must ensure that you have requirements to install
Yaramod
on Linux (Windows packages are pre-built wheels)
pip install -U yls-yara
NOTE:
- since the installation is global it can interfere with your current version of yara-python and YARA
- if you have currently installed yara-python and you would like to keep the version, please follow the steps bellow and install YLS into virtual environment
NOTE: In the configuration steps you will need to provide an absolute path to
the yls
executable either in the editor plugin (VsCode) or in the editor LSP
client configuration (vim). In the Linux example the absolute path was
/home/user/yls/env/bin/yls
.
Following snippets show example installation steps.
:: Pick and create a suitable directory for your yls installation
mkdir yls
cd yls
python -m venv env
env\Scripts\activate.bat
pip install -U yls-yara
:: To get the absolute path of the yls executable
dir /S /b "env\Scripts\yls.exe"
# Pick and create a suitable directory for your yls installation
mkdir -p ~/yls
cd ~/yls
python -m venv env
. env/bin/activate
pip install -U yls-yara
# To get the absolute path of the yls executable
realpath env/bin/yls
The goal of this step is to configure your favorite editor to support yls. This procedure is typically required only for the first time and the new updates are rare.
Install the following extension, depending on the used marketplace. You can search it directly from the Visual Studio Code UI.
- associate
yara
filetype with file extensions
autocmd BufNewFile,BufRead *.yar,*.yara setlocal filetype=yara
- in order to install syntax highlighting declare it with your plugin manager (for example vim-plug)
Plug 's3rvac/vim-syntax-yara'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
{
"languageserver": {
"yara": {
"command": "yls",
"args": ["-vv"],
"filetypes": ["yara"]
}
}
}
Plug 'prabirshrestha/vim-lsp'
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'yls',
\ 'cmd': {server_info->['yls']},
\ 'whitelist': ['yara'],
})
Will be ready in future releases.
Will be ready in future releases.