Automated security testing with vulnerability detection, gas optimization, and best practice compliance