|
|
|
@ -111,7 +111,7 @@ export class SlitherClient extends PluginClient { |
|
|
|
|
} |
|
|
|
|
} else console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Compiler version is same as installed solc version') |
|
|
|
|
} |
|
|
|
|
const outputFile: string = 'remix-slitherReport_' + Date.now() + '.json' |
|
|
|
|
// Allow paths and set solc remapping for import URLs
|
|
|
|
|
const fileContent = readFileSync(`${this.currentSharedFolder}/${filePath}`, 'utf8') |
|
|
|
|
const importsArr = fileContent.match(/import ['"][^.|..](.+?)['"];/g) |
|
|
|
|
let allowPaths = ''; let remaps = '' |
|
|
|
@ -126,11 +126,13 @@ export class SlitherClient extends PluginClient { |
|
|
|
|
const solcArgs: string = optimizeOption || evmOption || allowPathsOption ? `--solc-args '${allowPathsOption}${optimizeOption}${evmOption}'` : '' |
|
|
|
|
const solcRemaps = remaps ? `--solc-remaps "${remaps}"` : '' |
|
|
|
|
|
|
|
|
|
const outputFile: string = 'remix-slitherReport_' + Math.floor(Date.now() / 1000) + '.json' |
|
|
|
|
const cmd: string = `slither ${filePath} ${solcArgs} ${solcRemaps} --json ${outputFile}` |
|
|
|
|
console.log('\x1b[32m%s\x1b[0m', '[Slither Analysis]: Running Slither...') |
|
|
|
|
// Added `stdio: 'ignore'` as for contract with NPM imports analysis which is exported in 'stderr'
|
|
|
|
|
// get too big and hangs the process. We process analysis from the report file only
|
|
|
|
|
const child = spawn(cmd, { cwd: this.currentSharedFolder, shell: true, stdio: 'ignore' }) |
|
|
|
|
|
|
|
|
|
const response = {} |
|
|
|
|
child.on('close', () => { |
|
|
|
|
const outputFileAbsPath: string = `${this.currentSharedFolder}/${outputFile}` |
|
|
|
|