jeirmeister
391a2fa35d
Initial implementation of a tool to analyze Ethereum smart contracts for fraudulent patterns. Currently supports: - Contract deployment analysis - Early actor identification - Exchange interaction tracking - Wash trading detection - Suspicious pattern recognition Known issues: - Directory structure needs cleanup - Some indentation errors to fix - Missing proper error handling - Needs better report formatting
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
from blockchain_analyzer import BlockchainAnalyzer
|
|
from report_generator import BlockchainReportGenerator
|
|
import argparse
|
|
import logging
|
|
import os
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Analyze blockchain contract for suspicious activity')
|
|
parser.add_argument('contract_address', help='The contract address to analyze')
|
|
parser.add_argument('--verbose', '-v', action='store_true', help='Enable verbose logging')
|
|
|
|
args = parser.parse_args()
|
|
|
|
# Setup logging
|
|
log_level = logging.DEBUG if args.verbose else logging.INFO
|
|
logging.basicConfig(
|
|
level=log_level,
|
|
format='%(asctime)s - %(levelname)s - %(message)s'
|
|
)
|
|
|
|
try:
|
|
analyzer = BlockchainAnalyzer()
|
|
analysis = analyzer.analyze_contract(args.contract_address)
|
|
|
|
if analysis:
|
|
report_generator = BlockchainReportGenerator()
|
|
report_path = report_generator.generate_report(analysis)
|
|
print(f"\nAnalysis complete!")
|
|
print(f"Report generated at: {report_path}")
|
|
print(f"Raw data and analysis files in: {os.path.join(os.getcwd(), 'data')}")
|
|
else:
|
|
logging.error(f"Failed to analyze contract {args.contract_address}")
|
|
|
|
except Exception as e:
|
|
logging.error(f"Error during analysis: {str(e)}")
|
|
raise
|
|
|
|
if __name__ == "__main__":
|
|
main()
|