美文网首页
Ruby self.send方法

Ruby self.send方法

作者: clive0x | 来源:发表于2019-07-28 17:52 被阅读0次

在看Nginx chunked size exploit代码时,self.send()方法怎么也看不懂,一直以为是metasploit代码,后面才发现是Ruby自身语法,调用对应方法,和self.respond_to?是一体的,后者测试是否有对应方法。Ruby写的还是太少。

def dereference_got

    unless self.respond_to?(target[:store_callback]) and self.respond_to?(target[:dereference_got_callback])

      fail_with(Failure::NoTarget, "Invalid target specified: no callback functions defined")

    end

    buf = ""

    command = payload.encoded

    i = 0

    while i < command.length

      buf << self.send(target[:store_callback], target['Writable'] + i, command[i, 4].ljust(4, ";"))

      i = i + 4

    end

    buf << self.send(target[:dereference_got_callback])

    return buf

  end

https://ruby-doc.org/core-2.6.3/Object.html#method-i-respond_to-3F

相关文章

  • Ruby self.send方法

    在看Nginx chunked size exploit代码时,self.send()方法怎么也看不懂,一直以为是...

  • From Objective-C to Ruby(4)-类和模块

    类 定义类 OC: ruby: 初始化方法 OC: ruby: 实例变量和属性 OC: ruby: 类方法和对象方...

  • From Objective-C to Ruby(3)-方法和块

    方法 定义方法 OC: ruby: 调用方法 OC: ruby: 参数的默认值 OC: 方法的返回值 OC: ru...

  • 器-用:ruby高效能方法 — reduce方法

    一、reduce方法的作用 reduce方法是ruby中的一个重要的方法,也叫inject方法(Ruby1.9之前...

  • ruby 数据类型

    1. Ruby 字符串(String) 2. Ruby 数组 3. Ruby 哈希 哈希的内置方法 4. Ruby...

  • Ruby、RVM-使用总结

    Ruby、RVM-使用总结 安装或更新Ruby 方法一:使用Homebrew安装Ruby Homebrew 是什么...

  • Ruby方法

    Ruby 方法与其他编程语言中的函数类似。Ruby 方法用于捆绑一个或多个重复的语句到一个单元中。方法名应以小写字...

  • Ruby 方法

  • Ruby 方法

    Ruby 方法用于捆绑一个或多个重复的语句到一个单元中。方法名应以小写字母开头。如果您以大写字母作为方法名的开头,...

  • 常用的Ruby方法

    1 当你发送消息到Ruby对象时,Ruby查询与消息同名的方法来调用。Ruby进行方法调用主要有两种方式,obj...

网友评论

      本文标题:Ruby self.send方法

      本文链接:https://www.haomeiwen.com/subject/stuprctx.html