banner
andrewji8

Being towards death

Heed not to the tree-rustling and leaf-lashing rain, Why not stroll along, whistle and sing under its rein. Lighter and better suited than horses are straw sandals and a bamboo staff, Who's afraid? A palm-leaf plaited cape provides enough to misty weather in life sustain. A thorny spring breeze sobers up the spirit, I feel a slight chill, The setting sun over the mountain offers greetings still. Looking back over the bleak passage survived, The return in time Shall not be affected by windswept rain or shine.
telegram
twitter
github

Pythonによるsqlmap注入バッチ検出ツール

SQLMap は、強力なオープンソースの自動化 SQL インジェクションツールであり、ペネトレーションテストエンジニアが SQL インジェクションの脆弱性を迅速に発見し、利用するのを助けることを目的としています。自動検出、脆弱性の利用、データ抽出などの機能を備えています。SQLMap の主な機能は、指定された URL 内の SQL インジェクションの脆弱性をスキャン、発見、利用することです。また、多くのバイパスプラグインが内蔵されており、MySQL、Oracle、PostgreSQL、Microsoft SQL Server、Microsoft Access、IBM DB2、SQLite、Firebird、Sybase、SAPMaxDB など、さまざまなデータベースをサポートしています。SQLMap を使用することで、ペネトレーションテストエンジニアは SQL インジェクションの脆弱性の検出と利用をより効率的に行うことができます。

以下は Python に基づいて書かれたバッチ検出ツールで、複数のウェブサイトの URL リストを一度にインポートし、自動的にスキャンを行います。これにより、脆弱性スキャンの効率が大幅に向上し、時間と労力を節約できます。
実行結果:

image
このプログラムを実行する前に、SQLMap がローカルにインストールされており、環境変数に追加されていることを確認してください。これにより、任意のディレクトリでこのツールを使用して SQL インジェクションの検出を行うことができます。

import tkinter as tk
from tkinter import ttk
import tkinter.filedialog as fd
import subprocess
import threading


class Application(tk.Tk):
    def __init__(self, title, geometry):
        super().__init__()
        self.title(title)
        self.geometry(geometry)

        self.columns = ("URL", "Injection", "Payload")
        self.tree = ttk.Treeview(self, columns=self.columns, show="headings")

        for col in self.columns:
            self.tree.heading(col, text=col)
            self.tree.column(col, width=200, anchor="center")

        self.tree.pack(fill="both", expand=True)

        self.text_widget = tk.Text(self, height=20)
        self.text_widget.pack(fill="x")

        buttons_frame = tk.Frame(self)
        buttons_frame.pack(fill="x", pady=10)

        import_data_btn = tk.Button(buttons_frame, text="URLをインポート", command=self.import_data)
        import_data_btn.pack(side="left", padx=10)

        tk.Label(buttons_frame, text="sqlmap -u url --batch").pack(side="left")
        self.params_entry = tk.Entry(buttons_frame, width=50)
        self.params_entry.pack(side="left", padx=10)
        self.params_entry.insert(0, "--level 3")

        self.run_btn = tk.Button(buttons_frame, text="実行", command=self.run)
        self.run_btn.pack(side="left", padx=10)
        self.pause_btn = tk.Button(buttons_frame, text="一時停止", command=self.pause)
        self.pause_btn.pack(side="left", padx=10)
        clear_btn = tk.Button(buttons_frame, text="クリア", command=self.clear_content)
        clear_btn.pack(side="left", padx=10)

        self.is_paused = False
        self.thread = None

    def import_data(self):
        file_path = fd.askopenfilename(defaultextension=".txt", filetypes=[("テキストファイル", "*.txt")])
        if file_path:
            self.tree.delete(*self.tree.get_children())
            with open(file_path, "r") as file:
                for line in file:
                    line = line.strip().split(",")
                    self.tree.insert("", "end", values=line)

    def run(self):
        params = self.params_entry.get()
        self.run_btn.config(text="実行中", state="disabled")
        self.pause_btn.config(state="normal")
        self.is_paused = False
        self.thread = threading.Thread(target=self._run_scan, args=(params,))
        self.thread.start()

    def pause(self):
        self.is_paused = True

    def _run_scan(self, params):
        for index, item in enumerate(self.tree.get_children()):
            if self.is_paused:
                self.run_btn.config(text="続行", state="normal")
                return

            url = self.tree.item(item)["values"][0]
            result = subprocess.run(['sqlmap', '-u', url] + params.split() + ['--batch'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")
            result_output = result.stdout + result.stderr
            self.text_widget.insert(tk.END, result_output)
            self.text_widget.update_idletasks()
            if "Parameter: " in result_output:
                self.tree.set(item, "Injection", "はい")
                payload_start = result_output.index("Payload:") + len("Payload:")
                payload_end = result_output.index("\n", payload_start)
                self.tree.set(item, "Payload", result_output[payload_start:payload_end].strip())
            else:
                self.tree.set(item, "Injection", "いいえ")
        self.run_btn.config(text="実行", state="normal")
        self.pause_btn.config(state="disabled")

    def clear_content(self):
        self.text_widget.delete("1.0", "end")
        for item in self.tree.get_children():
            for column in self.columns:
                self.tree.set(item, column, "")


if __name__ == "__main__":
    app = Application("SQLMAP - バッチ検出 ", "900x750")
    app.mainloop()
読み込み中...
文章は、創作者によって署名され、ブロックチェーンに安全に保存されています。