-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan-remote.sh
More file actions
executable file
·72 lines (59 loc) · 1.76 KB
/
scan-remote.sh
File metadata and controls
executable file
·72 lines (59 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Scan Remote Repository
# Clones a GitHub repo to temporary directory, scans it, then cleans up
set -e
if [ -z "$1" ]; then
echo "Usage: $0 OWNER/REPO-NAME"
echo ""
echo "Examples:"
echo " $0 nodejs/node"
echo " $0 facebook/react"
echo " $0 YOUR_USERNAME/your-repo"
echo ""
echo "Note: Requires GitHub CLI (gh) to be installed and authenticated"
echo "Run: gh auth login"
exit 1
fi
REPO=$1
TEMP_DIR=$(mktemp -d)
echo "🔍 Scanning remote repository: $REPO"
echo "📁 Creating temporary directory: $TEMP_DIR"
echo ""
# Check if gh is installed
if ! command -v gh &> /dev/null; then
echo "❌ Error: GitHub CLI (gh) is not installed"
echo ""
echo "Install with:"
echo " macOS: brew install gh"
echo " Linux: See https://cli.github.com/manual/installation"
echo ""
exit 1
fi
# Check if authenticated
if ! gh auth status &> /dev/null; then
echo "❌ Error: Not authenticated with GitHub"
echo ""
echo "Run: gh auth login"
echo ""
exit 1
fi
# Clone repository
echo "📥 Cloning repository..."
if ! gh repo clone "$REPO" "$TEMP_DIR" 2>&1; then
echo "❌ Error: Failed to clone repository"
echo " Check if the repository exists and you have access"
rm -rf "$TEMP_DIR"
exit 1
fi
echo "✅ Repository cloned"
echo ""
# Run scanner
echo "🛡️ Running Shai Hulud 2.0 Scanner..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
./scan.sh "$TEMP_DIR"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🧹 Cleaning up temporary directory..."
rm -rf "$TEMP_DIR"
echo "✅ Scan complete!"