pact-audit-free
Version:
Free smart contract security scanner using Slither static analysis
236 lines (170 loc) ⢠6.11 kB
Markdown
# PACT Audit Free
Free smart contract security scanner using Slither static analysis by [Habify Labs](https://habifylabs.io).
[](https://badge.fury.io/js/pact-audit-free)
[](https://opensource.org/licenses/MIT)
## About
PACT Audit Free is the community edition of PACT Audit, owned and developed by **Habify Labs**. This tool provides free smart contract security scanning to help developers identify vulnerabilities before deployment.
## Features
- š **Static Analysis** - Powered by Slither analyzer
- š **Completely Free** - No API keys or subscriptions required
- ā” **Fast & Lightweight** - Minimal dependencies, quick installation
- šÆ **Easy to Use** - Simple CLI interface
- š **Clean Output** - Professional vulnerability reporting
- š **CI/CD Ready** - JSON output and proper exit codes
- š **Cross-Platform** - Works on Windows, macOS, and Linux
## Installation
### Prerequisites
First, install Slither analyzer:
```bash
# Using pip
pip install slither-analyzer
# Using pip3
pip3 install slither-analyzer
# On macOS with Homebrew
brew install slither-analyzer
```
### Install PACT Audit Free
```bash
npm install -g pact-audit-free
```
## Usage
### Basic Scanning
```bash
# Scan a single Solidity file
pact-audit-free scan MyContract.sol
# Scan all Solidity files in a directory
pact-audit-free scan contracts/
```
### Output Options
```bash
# Save results to JSON file
pact-audit-free scan MyContract.sol --output results.json
# Output JSON to stdout (useful for CI/CD)
pact-audit-free scan MyContract.sol --json
```
### Example Output
```
š PACT Audit Free - Slither Security Scanner
Free smart contract security analysis
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
šÆ Target: /path/to/MyContract.sol
š Validating target path...
ā
Path validation passed
š§ Checking Slither installation...
ā
Slither is installed and ready
š Running Slither security analysis...
ā
Scan completed
š SCAN RESULTS
āāāāāāāāāāāāāā
Summary:
HIGH: 1
MEDIUM: 2
LOW: 1
Details:
1. [HIGH] reentrancy-eth
Reentrancy vulnerability in withdraw function
š MyContract.sol:45
2. [MEDIUM] missing-zero-check
Missing zero address validation in transfer
š MyContract.sol:23
3. [MEDIUM] unprotected-upgrade
Function lacks access control
š MyContract.sol:67
4. [LOW] unused-return
Return value not used
š MyContract.sol:12
ā ļø HIGH SEVERITY ISSUES DETECTED - Review required before deployment!
```
## Exit Codes
- `0` - No issues or only low/informational issues
- `1` - Medium severity issues detected
- `2` - High severity issues detected
Perfect for CI/CD integration:
```bash
# This will fail the build if high/medium issues are found
pact-audit-free scan contracts/ || exit 1
```
## JSON Output Format
When using `--output` or `--json`, the tool outputs structured data:
```json
{
"timestamp": "2024-01-15T10:30:00.000Z",
"target": "/path/to/contracts",
"vulnerabilities": [
{
"type": "reentrancy-eth",
"severity": "HIGH",
"description": "Reentrancy vulnerability in withdraw function",
"sourceMapping": {
"filename": "MyContract.sol",
"lines": [45]
},
"confidence": "high",
"impact": "high"
}
],
"summary": {
"total": 4,
"high": 1,
"medium": 2,
"low": 1,
"informational": 0
}
}
```
## Supported Vulnerability Types
PACT Audit Free detects all vulnerabilities that Slither can find, including:
- Reentrancy vulnerabilities
- Access control issues
- Integer overflow/underflow
- Unprotected functions
- Missing zero address checks
- Timestamp dependencies
- Gas optimization opportunities
- Code quality issues
- And many more...
## Requirements
- **Node.js** 16.0.0 or higher
- **Slither** analyzer installed via pip
- **Python** 3.6+ (for Slither dependency)
## Troubleshooting
### Slither Not Found
If you get a "Slither not found" error:
1. Ensure Python and pip are installed
2. Install Slither: `pip install slither-analyzer`
3. Verify installation: `slither --version`
4. If using virtual environments, ensure Slither is installed in the active environment
### Permission Issues
If you encounter permission issues on macOS/Linux:
```bash
# Install with sudo if needed
sudo npm install -g pact-audit-free
# Or use npx to run without installing globally
npx pact-audit-free scan MyContract.sol
```
## Comparison
| Feature | PACT Audit Free | Raw Slither | Premium Tools |
|---------|----------------|-------------|---------------|
| Price | Free | Free | $$ |
| Ease of use | āāāāā | āā | āāāā |
| Setup time | < 1 min | ~5 min | ~15 min |
| Clean output | ā
| ā | ā
|
| JSON export | ā
| ā ļø | ā
|
| CI/CD ready | ā
| ā ļø | ā
|
## Contributing
We welcome contributions! Please see our [Contributing Guide](https://github.com/habify-labs/pact-protocol-v1/blob/main/CONTRIBUTING.md) for details.
## License
MIT License - see [LICENSE](LICENSE) file for details.
## Related Projects
- **[pact-audit](https://www.npmjs.com/package/pact-audit)** - Enterprise version with AI analysis
- **[Slither](https://github.com/crytic/slither)** - The underlying static analysis framework
- **[PACT Protocol](https://pactprotocol.io)** - Complete DeFi security ecosystem
## Support
- š [Documentation](https://docs.pactprotocol.io)
- š [Issue Tracker](https://github.com/habify-labs/pact-protocol-v1/issues)
- š¬ [Discord Community](https://discord.gg/pactprotocol)
- š [Upgrade to Premium](https://pactprotocol.io/audit)
## About Habify Labs
PACT Audit is owned and developed by **[Habify Labs](https://habifylabs.io)**, a leading blockchain security company focused on making smart contract auditing accessible to all developers.
---
Made with ā¤ļø by [Habify Labs](https://habifylabs.io)