rubypwn 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a207e6e227905907382290db94def954f6983672
4
- data.tar.gz: 85170d9ff5ed184fd027f7ff8e6e5249b18af5d5
3
+ metadata.gz: 0230be847e64b6c91c72eeb6c50cb38904449926
4
+ data.tar.gz: 10e0200ccb28a4238b26ac3103c88b02b1cdfc80
5
5
  SHA512:
6
- metadata.gz: 621f1c24935b6c9d98ed915d3e270dc9940e5047c010cd0ac7d246ae56571d13ee07652ece120df2d2817b4c0161aea9762b972cb7fc09fccb009fff657f6e05
7
- data.tar.gz: d74eb88e94e20ec13b032250973cd4370d8a10f68c66746a82bc733943a76ae6b7f9f5fb85c69294636f649602740b5884afe50f78f310df31ff06f1f3f12add
6
+ metadata.gz: de4b9670f16be050ff566c4b568edf9419e5d6654fce81361f0d3255427e7dfcebc36014eb1700fa5f918f95dd3e4b429b26840fea16ae58fb6349c6144e2a56
7
+ data.tar.gz: 2c38ec0f826cfc621eeb3ceb4ec9b452c59458df51248c80bc25b28c9fe2faab90c62bd0768dfb8a8edcccdeb9691b095874bf3c868b03d5ab1f7ce7f720d314
@@ -0,0 +1,20 @@
1
+ Format String
2
+ ====================================
3
+
4
+ Basic Usage
5
+ ------------------------
6
+
7
+ String Ext ::
8
+
9
+ 2.2.3 :001 > require 'rubypwn'
10
+ => true
11
+ 2.2.3 :002 > str = "prefix_str_"
12
+ => "prefix_str_"
13
+ 2.2.3 :003 > str.fmtstr
14
+ str.fmtstr
15
+ 2.2.3 :003 > str.fmtstr i32(0x601808), 10, bytes: 2
16
+ => "prefix_str_%6152c%10$hn%59480c%11$hn"
17
+ 2.2.3 :004 > str.fmtstr "system", 12, bytes: 2
18
+ => "prefix_str_%6152c%10$hn%59480c%11$hn%30995c%12$hn%64256c%13$hn%63730c%14$hn"
19
+ 2.2.3 :005 > "test".fmtstr i64(0x3121), 1, fmt_size: 100
20
+ => "test%189c%1$hhn%16c%2$hhn%207c%3$hhn%4$hhn%5$hhn%6$hhn%7$hhn%8$hhn"
@@ -12,6 +12,7 @@ Getting Started
12
12
 
13
13
  about
14
14
  getting_started
15
+ format_string
15
16
 
16
17
  Module Index
17
18
  ------------
@@ -1,26 +1,30 @@
1
1
  require 'open3'
2
+ require 'rainbow/ext/string'
2
3
 
3
4
  class Exec
5
+ attr_accessor :debug, :color
6
+
4
7
  public
5
- def initialize(cmd)
8
+ def initialize(cmd, **options)
6
9
  handle_exception
7
10
  @i, @o, s = Open3.popen2(cmd)
11
+ # Debug msg
12
+ @debug = (options.has_key? :debug) ? options[:debug] : true
13
+ # Log color
14
+ Rainbow.enabled = false if options[:color] == false
8
15
  end
9
16
 
10
17
  def read(size)
11
- data = @o.read size
12
- write_flush $stdout, data
13
- data
18
+ @o.read(size).tap {|data| write_flush $stdout, data.color(:cyan) if @debug}
14
19
  end
15
20
 
16
21
  def readpartial(size)
17
- data = @o.readpartial size
18
- write_flush $stdout, data
19
- data
22
+ @o.readpartial(size).tap {|data| write_flush $stdout, data.color(:cyan) if @debug}
20
23
  end
21
24
 
22
25
  def write(data)
23
- write_flush $stdout, data
26
+ data = data.to_s if data.is_a? Integer
27
+ write_flush $stdout, data.color(:yellow) if @debug
24
28
  write_flush @i, data
25
29
  end
26
30
 
@@ -37,7 +41,7 @@ class Exec
37
41
  loop do
38
42
  result << @o.read(1)
39
43
  if result.end_with? str
40
- write_flush $stdout, result
44
+ write_flush $stdout, result if @debug
41
45
  return result
42
46
  end
43
47
  end
@@ -1,7 +1,7 @@
1
1
  require_relative 'exec'
2
2
 
3
3
  class Netcat < Exec
4
- def initialize(ip, port)
5
- super("nc #{ip} #{port}")
4
+ def initialize(ip, port, **options)
5
+ super("nc #{ip} #{port}", options)
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rubypwn'
3
- s.version = '0.0.15'
4
- s.date = '2015-10-22'
3
+ s.version = '0.0.16'
4
+ s.date = '2015-10-28'
5
5
  s.summary = "ruby pwn tools"
6
6
  s.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
7
7
  A simple library for CTF pwning challenges.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - atdog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -109,6 +109,7 @@ files:
109
109
  - docs/source/basic.rst
110
110
  - docs/source/conf.py
111
111
  - docs/source/elf.rst
112
+ - docs/source/format_string.rst
112
113
  - docs/source/getting_started.rst
113
114
  - docs/source/index.rst
114
115
  - docs/source/patch_alarm.rst
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  requirements: []
142
143
  rubyforge_project:
143
- rubygems_version: 2.4.5.1
144
+ rubygems_version: 2.4.8
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: ruby pwn tools