查看: 5412|回复: 5

[讨论] 【RMXP】游戏防作弊集锦

[复制链接]
梦石
0
星屑
60
在线时间
705 小时
注册时间
2007-12-23
回帖
809
发表于 2013-8-13 11:43:32 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
今天去研究了一下RMXP的反作弊

除了破解RGSSAD以外,主要还有这两种作弊方式:
1.修改运行时内存数据(比如金山游侠、Cheat Engine等)
2.修改存档(网上应该已经有这类存档修改器了吧)

对于修改内存,RMXP也有保护机制,不过只是将数字乘以2再加1而已,地球人都知道。对于修改存档,则并没有什么好的防范手段。
针对这两种破解方式,在下在网上搜索了一早上,终于找到了几种反作弊方法。
1.内存防改(by @土撥撥 )
http://rpg.blue/thread-218920-1-1.html
6R上已经有现成的了,但也只能防止金钱和变量被修改,如果战斗的时候改改血量之类的就防不住了。希望大神可以研究、改进。
2.存档防改(by @FantasyDR )
这在6R上很难找到,而且已经可以暴力破解了。不过也只是暴力破解,毕竟还是需要一定时间的。可以防范大多数的傻瓜式作弊玩家。
它已经被应用于魔塔样板,但原版代码却很难找到,今天终于在某个角落里发现了它。
  1. #==============================================================================
  2. # ☆★☆ Custom Save☆★☆
  3. #------------------------------------------------------------------------------
  4. # - FantasyDR
  5. #------------------------------------------------------------------------------
  6. # MSN: [email]FantasyDR_SJL@hotmail.com[/email]
  7. #------------------------------------------------------------------------------
  8. # - 2006.7.18
  9. #------------------------------------------------------------------------------
  10. # 自定义存档数据排列顺序并校验存档
  11. #==============================================================================

  12. #==============================================================================
  13. # ■ Scene_File
  14. #------------------------------------------------------------------------------
  15. #  存档画面及读档画面的超级类。
  16. #==============================================================================

  17. class Scene_File
  18.   #--------------------------------------------------------------------------
  19.   # ● 存档密钥,请定义成自己的密钥
  20.   #   密钥不同的存档将无法被读取
  21.   #--------------------------------------------------------------------------
  22.   SAVE_KEY = 1234567
  23.   #--------------------------------------------------------------------------
  24.   # ● 存档号码最大值
  25.   #   默认0~3共4个存档,如果需要大于4个存档,需要改动窗口类。
  26.   #   这里不提供大于4个存档的窗口排布,如果有需要请自己定义。
  27.   #--------------------------------------------------------------------------
  28.   SAVE_MAX = 3
  29.   #--------------------------------------------------------------------------
  30.   # ● 初始化对像
  31.   #   help_text : 帮助窗口显示的字符串
  32.   #--------------------------------------------------------------------------
  33.   def initialize(help_text,type = "档案",save_max = SAVE_MAX)
  34.     @help_text = help_text
  35.     @save_max = save_max
  36.     @type = type
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 主处理
  40.   #--------------------------------------------------------------------------
  41.   def main
  42.    
  43.     # 生成存档选择
  44.     save_list = []
  45.     for i in 1..@save_max+1
  46.       save_list.push(@type+i.to_s)
  47.     end   
  48.     # 生成帮助窗口
  49.     @help_window = Window_Help.new
  50.     @help_window.set_text(@help_text)  
  51.     # 生成存档文件查
  52.     @savefile_windows = []
  53.     for i in 0..@save_max
  54.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
  55.     end
  56.     # 选择最后操作的文件
  57.     @file_index = $game_temp.last_file_index
  58.     @savefile_windows[@file_index].selected = true
  59.     # 执行过渡
  60.     Graphics.transition
  61.     # 主循环
  62.     loop do
  63.       # 刷新游戏画面
  64.       Graphics.update
  65.       # 刷新输入信息
  66.       Input.update
  67.       # 刷新画面
  68.       update
  69.       # 如果画面被切换的话就中断循环
  70.       if $scene != self
  71.         break
  72.       end
  73.     end
  74.     # 准备过渡
  75.     Graphics.freeze
  76.     # 释放窗口
  77.     @help_window.dispose
  78.     for i in @savefile_windows
  79.       i.dispose
  80.     end
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ● 刷新画面
  84.   #--------------------------------------------------------------------------
  85.   def update
  86.     # 刷新窗口
  87.     @help_window.update
  88.     for i in @savefile_windows
  89.       i.update
  90.     end
  91.     # 按下 C 键的情况下
  92.     if Input.trigger?(Input::C)
  93.       # 调用过程 on_decision (定义继承目标)
  94.       on_decision(make_filename(@file_index))
  95.       $game_temp.last_file_index = @file_index
  96.       return
  97.     end
  98.     # 按下 B 键的情况下
  99.     if Input.trigger?(Input::B)
  100.       # 调用过程 on_cancel (定义继承目标)
  101.       on_cancel
  102.       return
  103.     end
  104.     # 按下方向键下的情况下
  105.     if Input.repeat?(Input::DOWN)
  106.       # 方向键下的按下状态不是重复的情况下、
  107.       # 并且光标的位置在 3 以前的情况下
  108.       if Input.trigger?(Input::DOWN) or @file_index < 3
  109.         # 演奏光标 SE
  110.         $game_system.se_play($data_system.cursor_se)
  111.         # 光标向下移动
  112.         @savefile_windows[@file_index].selected = false
  113.         @file_index = (@file_index + 1) % 4
  114.         @savefile_windows[@file_index].selected = true
  115.         return
  116.       end
  117.     end
  118.     # 按下方向键上的情况下
  119.     if Input.repeat?(Input::UP)
  120.       # 方向键上的按下状态不是重复的情况下、
  121.       # 并且光标的位置在 0 以后的情况下
  122.       if Input.trigger?(Input::UP) or @file_index > 0
  123.         # 演奏光标 SE
  124.         $game_system.se_play($data_system.cursor_se)
  125.         # 光标向上移动
  126.         @savefile_windows[@file_index].selected = false
  127.         @file_index = (@file_index + 3) % 4
  128.         @savefile_windows[@file_index].selected = true
  129.         return
  130.       end
  131.     end
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 生成文件名
  135.   #   file_index : 文件名的索引 (0~3)
  136.   #--------------------------------------------------------------------------
  137.   def make_filename(file_index)
  138.     return "Save#{file_index + 1}.rxdata"
  139.   end
  140. end

  141. #==============================================================================
  142. # ■ Scene_Load
  143. #------------------------------------------------------------------------------
  144. #  处理读档画面的类。
  145. #==============================================================================

  146. class Scene_Load < Scene_File
  147.   #--------------------------------------------------------------------------
  148.   # ● 初始化对像
  149.   #--------------------------------------------------------------------------
  150.   def initialize(save_max = SAVE_MAX)
  151.     # 再生成临时对像
  152.     $game_temp = Game_Temp.new
  153.     # 选择存档时间最新的文件
  154.     $game_temp.last_file_index = 0
  155.     latest_time = Time.at(0)
  156.     for i in 0..save_max
  157.       filename = make_filename(i)
  158.       if FileTest.exist?(filename)
  159.         begin
  160.           file = Zlib::GzipReader.open(filename)
  161.         rescue
  162.           next
  163.         end
  164.         if file.mtime > latest_time
  165.           latest_time = file.mtime
  166.           $game_temp.last_file_index = i
  167.         end
  168.         file.close
  169.       end
  170.     end
  171.     super("要载入哪个文件?","读取",save_max)
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 确定时的处理
  175.   #--------------------------------------------------------------------------
  176.   def on_decision(filename)
  177.     # 文件不存在的情况下
  178.     unless FileTest.exist?(filename)
  179.       # 演奏冻结 SE
  180.       $game_system.se_play($data_system.buzzer_se)
  181.       return
  182.     end
  183.     # 演奏读档 SE
  184.     $game_system.se_play($data_system.load_se)
  185.     # 写入存档数据
  186.     begin
  187.       file = Zlib::GzipReader.open(filename)
  188.       read_save_data(file)
  189.     rescue
  190.       # 演奏冻结 SE
  191.       $game_system.se_play($data_system.buzzer_se)
  192.       return
  193.     end
  194.     file.close
  195.     # 还原 BGM、BGS
  196.     $game_system.bgm_play($game_system.playing_bgm)
  197.     $game_system.bgs_play($game_system.playing_bgs)
  198.     # 刷新地图 (执行并行事件)
  199.     $game_map.update
  200.     # 切换到地图画面
  201.     $scene = Scene_Map.new
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 取消时的处理
  205.   #--------------------------------------------------------------------------
  206.   def on_cancel
  207.     # 演奏取消 SE
  208.     $game_system.se_play($data_system.cancel_se)
  209.     # 切换到标题画面
  210.     $scene = Scene_Title.new
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ● 读取存档数据
  214.   #   file : 读取用文件对像 (已经打开)
  215.   #--------------------------------------------------------------------------
  216.   def read_save_data(file)
  217.     # 读取描绘存档文件用的角色数据
  218.     characters = Marshal.load(file)
  219.     # 读取测量游戏时间用画面计数
  220.     Graphics.frame_count = Marshal.load(file)
  221.     # 读取校验
  222.     crcs = Marshal.load(file)
  223.     # 读取文档字串
  224.     strings = Marshal.load(file)
  225.     # 校验检测
  226.     key = SAVE_KEY
  227.     strings.each_index do |i|
  228.       key = Zlib.crc32(strings[i],key)
  229.       unless crcs[i] == key
  230.         file.close
  231.         raise "file check error"
  232.         return
  233.       end
  234.     end
  235.     # 读取各种游戏对像
  236.     $game_system = Marshal.load(Zlib::Inflate.inflate(strings[0]))
  237.     $game_variables = Marshal.load(Zlib::Inflate.inflate(strings[1]))
  238.     $game_self_switches = Marshal.load(Zlib::Inflate.inflate(strings[2]))
  239.     $game_switches = Marshal.load(Zlib::Inflate.inflate(strings[3]))
  240.     $game_troop = Marshal.load(Zlib::Inflate.inflate(strings[4]))
  241.     $game_map = Marshal.load(Zlib::Inflate.inflate(strings[5]))
  242.     $game_player = Marshal.load(Zlib::Inflate.inflate(strings[6]))
  243.     $game_screen = Marshal.load(Zlib::Inflate.inflate(strings[7]))
  244.     $game_actors = Marshal.load(Zlib::Inflate.inflate(strings[8]))
  245.     $game_party = Marshal.load(Zlib::Inflate.inflate(strings[9]))
  246.    
  247.     # 魔法编号与保存时有差异的情况下
  248.     # (加入编辑器的编辑过的数据)
  249.     if $game_system.magic_number != $data_system.magic_number
  250.       # 重新装载地图
  251.       $game_map.setup($game_map.map_id)
  252.       $game_player.center($game_player.x, $game_player.y)
  253.     end
  254.     # 刷新同伴成员
  255.     $game_party.refresh
  256.   end
  257. end

  258. #==============================================================================
  259. # 自定义存档菜单
  260. #==============================================================================

  261. #==============================================================================
  262. # ■ Scene_Save
  263. #------------------------------------------------------------------------------
  264. #  处理存档画面的类。
  265. #==============================================================================

  266. class Scene_Save < Scene_File
  267.   #--------------------------------------------------------------------------
  268.   # ● 初始化对像
  269.   #--------------------------------------------------------------------------
  270.   def initialize(save_max = SAVE_MAX)
  271.     super("要保存到这个文件吗?","存入",save_max)
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 确定时的处理
  275.   #--------------------------------------------------------------------------
  276.   def on_decision(filename)
  277.     # 演奏存档 SE
  278.     $game_system.se_play($data_system.save_se)
  279.     # 写入存档数据
  280.     file = Zlib::GzipWriter.open(filename,9)
  281.     write_save_data(file)
  282.     file.close
  283.     # 如果被事件调用
  284.     if $game_temp.save_calling
  285.       # 清除存档调用标志
  286.       $game_temp.save_calling = false
  287.       # 切换到地图画面
  288.       $scene = Scene_Map.new
  289.       return
  290.     end
  291.     # 切换到菜单画面
  292.     $scene = Scene_Menu.new(5)
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 取消时的处理
  296.   #--------------------------------------------------------------------------
  297.   def on_cancel
  298.     # 演奏取消 SE
  299.     $game_system.se_play($data_system.cancel_se)
  300.     # 如果被事件调用
  301.     if $game_temp.save_calling
  302.       # 清除存档调用标志
  303.       $game_temp.save_calling = false
  304.       # 切换到地图画面
  305.       $scene = Scene_Map.new
  306.       return
  307.     end
  308.     # 切换到菜单画面
  309.     $scene = Scene_Menu.new(5)
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ● 写入存档数据
  313.   #   file : 写入用文件对像 (已经打开)
  314.   #--------------------------------------------------------------------------
  315.   def write_save_data(file)   
  316.     # 生成描绘存档文件用的角色图形
  317.     characters = []
  318.     for i in 0...$game_party.actors.size
  319.       actor = $game_party.actors[i]
  320.       characters.push([actor.character_name, actor.character_hue,actor.id])
  321.     end
  322.    
  323.     strings = []
  324.    
  325.     # 写入描绘存档文件用的角色数据
  326.     Marshal.dump(characters,file)
  327.     # 写入测量游戏时间用画面计数
  328.     Marshal.dump(Graphics.frame_count,file)
  329.     # 增加 1 次存档次数
  330.     $game_system.save_count += 1
  331.     # 保存魔法编号
  332.     # (将编辑器保存的值以随机值替换)
  333.     $game_system.magic_number = $data_system.magic_number
  334.    
  335.     # 写入各种游戏对像
  336.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_system)))
  337.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_variables)))
  338.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_self_switches)))
  339.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_switches)))
  340.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_troop)))
  341.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_map)))
  342.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_player)))
  343.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_screen)))
  344.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_actors)))
  345.     strings.push(Zlib::Deflate.deflate(Marshal.dump($game_party)))
  346.    
  347.     # 计算校验值
  348.     crcs = []
  349.     key = SAVE_KEY
  350.     strings.each do |i|
  351.       key = Zlib.crc32(i,key)
  352.       crcs.push(key)
  353.     end
  354.     Marshal.dump(crcs,file)
  355.     Marshal.dump(strings,file)
  356.   end
  357. end

  358. #==============================================================================
  359. # ■ Window_SaveFile
  360. #------------------------------------------------------------------------------
  361. #  显示存档以及读档画面、保存文件的窗口。
  362. #==============================================================================

  363. class Window_SaveFile < Window_Base
  364.   #--------------------------------------------------------------------------
  365.   # ● 初始化对像
  366.   #   file_index : 存档文件的索引 (0~n)
  367.   #   filename   : 文件名
  368.   #--------------------------------------------------------------------------
  369.   def initialize(file_index, filename,viewport=nil)
  370.     super(0, 64 + file_index % 4 * 104, 640, 104)
  371.     self.contents = Bitmap.new(width - 32, height - 32)
  372.    
  373.     @file_index = file_index
  374.     @filename = "Save#{@file_index + 1}.rxdata"
  375.     @time_stamp = Time.at(0)
  376.     @file_exist = FileTest.exist?(@filename)
  377.    
  378.     if @file_exist
  379.       begin
  380.         file = Zlib::GzipReader.open(filename)
  381.         @time_stamp = file.mtime
  382.         @characters = Marshal.load(file)
  383.         @frame_count = Marshal.load(file)
  384.         @total_sec = @frame_count / Graphics.frame_rate
  385.         file.close
  386.       rescue
  387.         @file_exist = false
  388.       end
  389.     end
  390.    
  391.     self.refresh
  392.     @selected = false
  393.   end
  394. end
复制代码

使用时只需修改SAVE_KEY即可,一般人是无法轻易破解的


唉,6R上的朋友似乎对素材保护比较感兴趣,对作弊倒没什么防范。要是一个游戏可以作弊,那么正常通关的玩家还会有同样的成就感吗?其实反作弊也是在为玩家着想。
但是这两种反作弊还得配合加密技术才能发挥作用,而加解密居然是禁止讨论的,那些技术贴都加了阅读权限限制。而且这些都只是很简陋的加密,对高手来说不堪一击。它的目的并不是绝对保护,而是浪费一下那些无节操作弊玩家的时间和精力,让他们失去破解的信心。
买了正版RMMV的同学进来看一下,谢谢~
https://rpg.blue/thread-393237-1-1.html
梦石
0
星屑
3905
在线时间
1972 小时
注册时间
2013-1-3
回帖
9146
发表于 2013-8-13 13:03:58 | 显示全部楼层
其实那个存档密钥用起来不方便
因为需要这样加密的游戏一般比较高端,而自己重定义存档又太费劲…
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复

使用道具 举报

梦石
0
星屑
752
在线时间
800 小时
注册时间
2011-10-20
回帖
2257

开拓者

发表于 2013-8-13 13:57:10 | 显示全部楼层
云rm
欢迎您

点评

纯IE支持差评(好想给你减分  发表于 2013-8-14 12:54
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2013-8-14 12:06:10 | 显示全部楼层
百度的云平台告诉你修改是浮云
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

梦石
0
星屑
65
在线时间
391 小时
注册时间
2012-5-5
回帖
185
发表于 2013-8-14 16:47:47 | 显示全部楼层
本帖最后由 my.0lantulantu0 于 2013-8-14 17:12 编辑

其实Marshal的入口点还是蛮好找的比如04 08……
Zlib可以通过重写module Zlib实现XX……
加密算法时间:破解算法时间 大约在1:10~1:200左右吧
估计解下边这个也不太轻松:
加密算法时间:破解算法时间 大约在1:5~1:500左右吧
  1. Marshal.dump(_res).each_byte{|w|f=f+([w].pack(_packtype))}
  2. file.write([f].pack(_packtype2))
复制代码
回复

使用道具 举报

梦石
0
星屑
4756
在线时间
389 小时
注册时间
2012-11-8
回帖
235
发表于 2013-8-14 21:04:10 | 显示全部楼层
内存防修改可以hook api或者用api监控进程,前者容易报毒,后者改个进程名就好了。。。貌似没什么好的方法。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部