Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
0672234f
Commit
0672234f
authored
Jun 09, 2021
by
aniket-engg
Committed by
Aniket
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
analyse method added
parent
38e95947
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
slither-handle.js
apps/remix-ide/src/app/files/slither-handle.js
+1
-1
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+29
-1
No files found.
apps/remix-ide/src/app/files/slither-handle.js
View file @
0672234f
...
...
@@ -5,7 +5,7 @@ const profile = {
name
:
'slither'
,
displayName
:
'Slither'
,
url
:
'ws://127.0.0.1:65523'
,
methods
:
[],
methods
:
[
'analyse'
],
description
:
'Using Remixd daemon, run slither static analysis'
,
kind
:
'other'
,
version
:
packageJson
.
version
...
...
libs/remixd/src/services/slitherClient.ts
View file @
0672234f
import
*
as
WS
from
'ws'
// eslint-disable-line
import
{
PluginClient
}
from
'@remixproject/plugin'
const
{
spawn
}
=
require
(
'child_process'
)
export
class
SlitherClient
extends
PluginClient
{
methods
:
Array
<
string
>
...
...
@@ -8,7 +9,7 @@ export class SlitherClient extends PluginClient {
constructor
(
private
readOnly
=
false
)
{
super
()
this
.
methods
=
[]
this
.
methods
=
[
'analyse'
]
}
setWebSocket
(
websocket
:
WS
):
void
{
...
...
@@ -18,4 +19,31 @@ export class SlitherClient extends PluginClient {
sharedFolder
(
currentSharedFolder
:
string
):
void
{
this
.
currentSharedFolder
=
currentSharedFolder
}
analyse
(
filePath
:
string
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
readOnly
)
{
const
errMsg
=
'[Slither Analysis]: Cannot analyse in read-only mode'
return
reject
(
new
Error
(
errMsg
))
}
const
outputFile
=
'slither-report.json'
const
cmd
=
`slither
${
filePath
}
--disable-solc-warnings --json
${
outputFile
}
`
const
options
=
{
cwd
:
this
.
currentSharedFolder
,
shell
:
true
}
const
child
=
spawn
(
cmd
,
options
)
let
result
=
''
let
error
=
''
child
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
const
msg
=
`[Slither Analysis]:
${
data
.
toString
()}
`
console
.
log
(
'
\
x1b[32m%s
\
x1b[0m'
,
msg
)
result
+=
msg
+
'
\
n'
})
child
.
stderr
.
on
(
'data'
,
(
err
)
=>
{
error
+=
`[Slither Analysis]:
${
err
.
toString
()}
`
})
child
.
on
(
'close'
,
()
=>
{
if
(
error
)
reject
(
error
)
else
resolve
(
result
)
})
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment