-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
86 lines (72 loc) · 2.75 KB
/
Copy pathsetup.py
File metadata and controls
86 lines (72 loc) · 2.75 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
"""
Alien Parser Setup Script
Author: Mohamed Alzahrani
Description: Setup script for the Alien Parser DFIR tool
"""
import os
import sys
import subprocess
def check_python_version():
"""Check if Python version is 3.7 or higher"""
if sys.version_info < (3, 7):
print("❌ Python 3.7 or higher is required")
print(f" Current version: {sys.version}")
return False
print(f"✅ Python {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} detected")
return True
def test_installation():
"""Test the Alien Parser installation"""
print("\n🧪 Testing Alien Parser installation...")
# Test with sample data
if os.path.exists("sample_input.json"):
try:
result = subprocess.run([
sys.executable, "yaraconvert.py",
"-i", "sample_input.json",
"-o", "test_output.csv"
], capture_output=True, text=True, timeout=30)
if result.returncode == 0:
print("✅ Installation test passed!")
print("📄 Sample CSV generated: test_output.csv")
print("📊 Summary report: alien_parser_report.json")
# Clean up test files
for file in ["test_output.csv", "alien_parser_report.json"]:
if os.path.exists(file):
os.remove(file)
return True
else:
print("❌ Installation test failed")
print(f"Error: {result.stderr}")
return False
except subprocess.TimeoutExpired:
print("❌ Installation test timed out")
return False
except Exception as e:
print(f"❌ Installation test failed: {e}")
return False
else:
print("⚠️ Sample input file not found, skipping test")
return True
def main():
print("🛸 Alien Parser Setup")
print("=" * 50)
# Check Python version
if not check_python_version():
sys.exit(1)
# Check if main script exists
if not os.path.exists("yaraconvert.py"):
print("❌ yaraconvert.py not found in current directory")
sys.exit(1)
print("✅ Main script found")
# Test installation
if test_installation():
print("\n🎉 Setup completed successfully!")
print("\n📚 Quick Start:")
print(" python yaraconvert.py -i your_thor_log.json -o output.csv")
print("\n🔗 For more examples, check the README.md")
else:
print("\n❌ Setup failed. Please check the error messages above.")
sys.exit(1)
if __name__ == "__main__":
main()