rubypwn 0.0.2 → 0.0.3

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asm.rb +14 -0
  3. data/lib/basic.rb +15 -6
  4. data/lib/rubypwn.rb +1 -0
  5. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9962b7cffbe5ccc0ed33633318562a04d8546423
4
- data.tar.gz: 65b62ac0d97b32d7f38d66312e4739cae6213bb0
3
+ metadata.gz: d865abbc807e6fbc199682a1e9566c4f5a70debc
4
+ data.tar.gz: e472c7e2a94c64990cea313c8d8ee5518317dfbd
5
5
  SHA512:
6
- metadata.gz: 7d96c8c5befd905cb66f4093285838c039594a60b81c4294103374d2360352092c6d01adb5469c304a5d44fc2045db52fbc3e26b8645031dd3aeca2b0a63ac12
7
- data.tar.gz: f3ca9531138e226d40d4185d7c70909d0f6244cc414994f6779123f3bd6ce7a398d2c6ad73f423efaba2a99c366d6562f590656411b890338d1c561f5f222658
6
+ metadata.gz: 6b0f1e99c8aa6e9a7f1aa724f9a0246593913bca33e5f9ed3b5114b3996c0fe42d0d4fd79e1d38886d617a666ef896e2271c9124544a48ff247d2ef9ca107d91
7
+ data.tar.gz: bd3eb79562e975d77d2e945be7c02ae144a103fe693adaeb00956a59aac63dd39dcc72e2cd043ca6635befc6c67f9a1dc6fe5774697dd75d5d04927a7ace9a62
data/lib/asm.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'rest-client'
2
+ require 'json'
3
+
4
+ class Asm
5
+ def self.compile(code, arch="i386", format="hex")
6
+ r = RestClient.post 'http://atdog.tw/asm/compile', :code => code, :arch => arch, :format => format
7
+ r = JSON.parse r
8
+ if r['result'] == 1
9
+ return r['code']
10
+ else
11
+ raise "asm compile error. [code]: #{code}"
12
+ end
13
+ end
14
+ end
data/lib/basic.rb CHANGED
@@ -1,11 +1,20 @@
1
- def i64(int)
2
- [int].pack("Q<")
1
+ def i16(int)
2
+ [int].pack("S<")
3
3
  end
4
4
 
5
5
  def i32(int)
6
6
  [int].pack("L<")
7
7
  end
8
8
 
9
+ def i64(int)
10
+ [int].pack("Q<")
11
+ end
12
+
13
+ def s16(int)
14
+ str = str.ljust(2, "\x00")
15
+ str.unpack("S<")[0]
16
+ end
17
+
9
18
  def s32(str)
10
19
  str = str.ljust(4, "\x00")
11
20
  str.unpack("L<")[0]
@@ -16,10 +25,6 @@ def s64(str)
16
25
  str.unpack("Q<")[0]
17
26
  end
18
27
 
19
- def i16(int)
20
- [int].pack("S<")
21
- end
22
-
23
28
  def c(int)
24
29
  [int].pack("C")
25
30
  end
@@ -27,3 +32,7 @@ end
27
32
  def hex(str)
28
33
  str.unpack("H*")[0]
29
34
  end
35
+
36
+ def nop()
37
+ "\x90"
38
+ end
data/lib/rubypwn.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require_relative 'basic'
2
+ require_relative 'asm'
2
3
  require_relative 'netcat'
3
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - atdog
@@ -16,6 +16,7 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - lib/asm.rb
19
20
  - lib/basic.rb
20
21
  - lib/exec.rb
21
22
  - lib/netcat.rb