Skip to content

Commit

Permalink
feat(readme): Support save options
Browse files Browse the repository at this point in the history
  • Loading branch information
JisuPark committed Oct 16, 2018
1 parent 3cddf56 commit 37f6ec3
Show file tree
Hide file tree
Showing 10 changed files with 717 additions and 14 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Sooho

[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

**Got a Question?** Send me a <a href="mailto:[email protected]">mail</a>

## Table of Contents
- [Introduction](#introduction)
- [Development](#development)
- [Install](#install)
- [License](#license)
- [About](#about)

## Introduction

**Sooho** used to interact with Sooho services from the command line. It is built using oclif.

For more about Sooho, see https://sooho.io

## Development

### Install

This project is built with [lerna](http://lernajs.io/). The core plugins are located in ./packages.

```bash
$ git clone https://github.com/soohoio/sooho
$ lerna bootstrap
```

## License

Copyright (c) 2018 Sooho Inc. It is free software and maybe redistributed under the terms specified in the LICENSE file.

## About

Authored and maintained by **Jisu Park**.

> Github [@JisuPark](https://github.com/JisuPark)
9 changes: 9 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Reporting Security Issues

Sooho strongly believes the responsible disclosure of security vulnerabilities in open source helps user privacy and security. We appreciate your efforts to responsibly disclose your findings and will make every effort to acknowledge your contributions.

To report a security issue, email [[email protected]](mailto:[email protected]) and include the word "SECURITY" in the subject line.

We will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement and may ask for additional information or guidance.

Report the security bugs in third-party modules to the person or team maintaining the module. You can also report a vulnerability through the [Sooho Vulnerability Disclosure](https://goo.gl/forms/BFB76kc0q0Q2a7PN2) program.
11 changes: 9 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
"packages/*"
],
"version": "0.1.0",
"lerna": "3.4.3",
"command": {
"publish": {
"conventionalCommits": true
"allowBranch": "master",
"conventionalCommits": true,
"message": "chore(release): publish %s"
}
}
},
"ignoreChanges": [
"**/test/**",
"**/*.md"
]
}
621 changes: 621 additions & 0 deletions packages/sooho-cli/LICENSE

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions packages/sooho-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"bin": {
"sooho": "./bin/run"
},
"repository": {
"type": "git",
"url": "https://github.com/soohoio/sooho"
},
"bugs": "https://github.com/soohoio/sooho/issues",
"dependencies": {
"@oclif/command": "^1",
Expand Down Expand Up @@ -42,7 +46,12 @@
],
"homepage": "https://github.com/soohoio/sooho",
"keywords": [
"oclif"
"sooho",
"security",
"assessments",
"contract",
"solidity",
"vulnerability"
],
"license": "GPL-3.0",
"main": "lib/index.js",
Expand All @@ -53,7 +62,6 @@
"@oclif/plugin-help"
]
},
"repository": "soohoio/sooho",
"scripts": {
"postpack": "rm -f oclif.manifest.json",
"posttest": "tslint -p test -t stylish",
Expand Down
31 changes: 24 additions & 7 deletions packages/sooho-cli/src/commands/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ export default class Encrypt extends Command {
]

static flags = {
help: flags.help({char: 'h', description: 'show CLI help'}),
abstract: flags.boolean({char: 'a', description: 'turn on abstraction mode'}),
help: flags.help({char: 'h', description: 'show CLI help'}),
save: flags.boolean({char: 's', description: 'save encrypted result'}),
}

static args = [{name: 'filePath', required: true, description: 'entry path'}]
Expand All @@ -22,6 +23,7 @@ export default class Encrypt extends Command {
const {args, flags} = this.parse(Encrypt)
const filePath = args.filePath
const abstract = flags.abstract || false
const save = flags.save || false

this.log(
`Extracting signatures in ${filePath}`,
Expand All @@ -30,6 +32,7 @@ export default class Encrypt extends Command {

const readFile = promisify(fs.readFile)
const input = await readFile(filePath, 'utf8')
const functions = []

try {
if (!input) throw new Error('Invalid input')
Expand All @@ -40,20 +43,34 @@ export default class Encrypt extends Command {
// console.warn("[Constructor]")
// console.warn(`Code: ${node.ctx.getText()}`)
} else {
this.log('[Function]')
const body = node.self.getText()
this.log(JSON.stringify({
startLine: node.loc.start.line,
endLine: node.loc.end.line
}))
this.log(crypto.createHash('md5').update(body).digest('hex'))
functions.push({
loc: JSON.stringify({
startLine: node.loc.start.line,
endLine: node.loc.end.line
}),
signature: crypto.createHash('md5').update(body).digest('hex'),
})
}
}
})
} catch (e) {
if (e instanceof parser.ParserError) {
this.log(e.errors)
return
}
}

if (save) {
const output = fs.createWriteStream(`${filePath.split('.sol')[0]}.aegis`, 'utf8')
functions.forEach(func => {
output.write(`[Function]\n${func.loc}\n${func.signature}\n`)
})
output.end()
} else {
functions.forEach(func => {
this.log(`[Function]\n${func.loc}\n${func.signature}`)
})
}
}
}
Empty file removed packages/sooho-parser/CHANGES.md
Empty file.
2 changes: 1 addition & 1 deletion packages/sooho-parser/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2018 Federico Bond
Copyright (c) 2018 Sooho Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions packages/sooho-parser/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@sooho/parser
=====================

This project is hardly forked from the federicobond's awesome project([solidity-parser-antlr/](https://github.com/federicobond/solidity-parser-antlr/))

A Solidity parser built on top of a robust [ANTLR4 grammar](https://github.com/solidityj/solidity-antlr4).

### Usage
Expand Down
4 changes: 2 additions & 2 deletions packages/sooho-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@sooho/parser",
"version": "0.1.0",
"description": "A Solidity parser forked From federicobond/solidity-parser-antlr",
"description": "A Solidity parser forked from federicobond/solidity-parser-antlr",
"main": "dist/index.js",
"scripts": {
"antlr4": "sh scripts/antlr4.sh",
"build": "rm -rf dist && babel --out-dir=dist src --quiet",
"prepublish": "yarn build",
"prepublishOnly": "yarn build",
"prettier": "find src -name *.js | egrep -v '^src/(lib|antlr4)/' | xargs prettier --no-semi --single-quote --write",
"eslint": "eslint src",
"test": "nyc mocha"
Expand Down

0 comments on commit 37f6ec3

Please sign in to comment.