Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ Cloud/GCE/config.sh
# node.js dependencies, used by the JavaScript parser for the FuzzIL compiler
node_modules
package-lock.json

# V8 build directory for testing
v8_build_test/
52 changes: 52 additions & 0 deletions Examples/postgresql-corpus-example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# PostgreSQL Corpus Example for Fuzzilli
# This script demonstrates how to use the new PostgreSQL corpus feature

echo "=== Fuzzilli PostgreSQL Corpus Example ==="
echo ""

echo "1. Basic PostgreSQL corpus usage:"
echo "swift run FuzzilliCli --corpus=postgresql --postgres-url=postgresql://localhost:5432/fuzzilli --profile=v8 /path/to/d8"
echo ""

echo "2. With custom sync interval and validation:"
echo "swift run FuzzilliCli --corpus=postgresql --postgres-url=postgresql://user:pass@host:5432/db --sync-interval=30 --validate-before-cache --execution-history-size=20 --profile=v8 /path/to/d8"
echo ""

echo "3. Multiple fuzzer instances sharing the same PostgreSQL database:"
echo "# Fuzzer 1:"
echo "swift run FuzzilliCli --corpus=postgresql --postgres-url=postgresql://localhost:5432/fuzzilli --profile=v8 /path/to/d8"
echo ""
echo "# Fuzzer 2 (in another terminal):"
echo "swift run FuzzilliCli --corpus=postgresql --postgres-url=postgresql://localhost:5432/fuzzilli --profile=v8 /path/to/d8"
echo ""

echo "4. Available PostgreSQL corpus options:"
echo " --corpus=postgresql : Use PostgreSQL corpus"
echo " --postgres-url=url : PostgreSQL connection string (required)"
echo " --sync-interval=n : Sync interval in seconds (default: 10)"
echo " --validate-before-cache : Enable program validation (default: true)"
echo " --execution-history-size=n : Recent executions to keep in memory (default: 10)"
echo ""

echo "5. PostgreSQL connection string format:"
echo " postgresql://username:password@hostname:port/database"
echo " Example: postgresql://fuzzilli:password@localhost:5432/fuzzilli"
echo ""

echo "6. Features of PostgreSQL corpus:"
echo " - In-memory caching for fast access"
echo " - PostgreSQL backend for persistence and sharing"
echo " - Execution metadata tracking (coverage, execution count, etc.)"
echo " - Periodic synchronization with central database"
echo " - Thread-safe operations"
echo " - Distributed fuzzing support"
echo ""

echo "7. Help and validation:"
echo "swift run FuzzilliCli --help # Show all options"
echo "swift run FuzzilliCli --corpus=postgresql # Shows validation error"
echo ""

echo "=== Example Complete ==="
4 changes: 4 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ let package = Package(
url: "https://github.com/apple/swift-collections.git",
.upToNextMinor(from: "1.2.0")
),
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.20.0"),
.package(url: "https://github.com/vapor/postgres-kit.git", from: "2.9.0"),
],
targets: [
.target(name: "libsocket",
Expand All @@ -47,6 +49,8 @@ let package = Package(
dependencies: [
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
.product(name: "Collections", package: "swift-collections"),
.product(name: "PostgresNIO", package: "postgres-nio"),
.product(name: "PostgresKit", package: "postgres-kit"),
"libsocket",
"libreprl",
"libcoverage"],
Expand Down
Loading
Loading