one_gadget 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/one_gadget.rb +3 -0
- data/lib/one_gadget/emulators/instruction.rb +1 -1
- data/lib/one_gadget/logger.rb +1 -1
- data/lib/one_gadget/update.rb +61 -0
- data/lib/one_gadget/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a6779c684ad439f1cf8fe2decda8d8bc59ef190
|
4
|
+
data.tar.gz: 125913223a512eab64d76c52026e03e7c2535ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460f93ea54b9a0b8c5554bfcd941e58bbc901a54c5072ea036246e0e6c18f1bb0d135db9b255de50c8d7341970db11af5042a501447582805165ee19dab45a87
|
7
|
+
data.tar.gz: a1ae45ffd14c9a2a432bf0b4f7411cdadf9e005440ca74eb62b1cb83a196714932096743491176960cbfb635f98cde59757d544a9a15070f3131afbafaaea00c
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Note: require ruby version >= 2.1.0, you can use `ruby --version` to check.
|
|
28
28
|
|
29
29
|
## Implementation
|
30
30
|
|
31
|
-
OneGadget
|
31
|
+
OneGadget uses simple self-implement symbolic execution to find the constraints of gadgets to success.
|
32
32
|
|
33
33
|
The article introducing how I develop this tool can be found [here](https://david942j.blogspot.com/2017/02/project-one-gadget-in-glibc.html).
|
34
34
|
|
data/lib/one_gadget.rb
CHANGED
data/lib/one_gadget/logger.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
require 'one_gadget/helper'
|
4
|
+
require 'one_gadget/logger'
|
5
|
+
require 'one_gadget/version'
|
6
|
+
|
7
|
+
module OneGadget
|
8
|
+
# For automatically check update.
|
9
|
+
module Update
|
10
|
+
# At least 7 days between check for new version.
|
11
|
+
FREQUENCY = 7 * 24 * 60 * 60
|
12
|
+
# Path to cache file.
|
13
|
+
CACHE_FILE = File.join(ENV['HOME'], '.cache', 'one_gadget', 'update').freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
# Check if new releases have been drafted.
|
17
|
+
#
|
18
|
+
# @return [void]
|
19
|
+
def check!
|
20
|
+
return unless need_check?
|
21
|
+
FileUtils.touch(cache_file)
|
22
|
+
OneGadget::Logger.info("Checking for new versions of OneGadget\n" \
|
23
|
+
"To disable this functionality, do\n$ echo never > #{CACHE_FILE}\n\n")
|
24
|
+
latest = Helper.latest_tag[1..-1] # remove 'v'
|
25
|
+
if Gem::Version.new(latest) <= Gem::Version.new(OneGadget::VERSION)
|
26
|
+
return OneGadget::Logger.info("You have the latest version of OneGadget (#{latest})!\n\n")
|
27
|
+
end
|
28
|
+
|
29
|
+
# show update message
|
30
|
+
msg = format("A newer version of OneGadget is available (%s --> %s).\n", OneGadget::VERSION, latest)
|
31
|
+
msg << "Update with: $ gem update one_gadget\n\n"
|
32
|
+
OneGadget::Logger.info(msg)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
# check ~/.cache/one_gadget/update
|
38
|
+
def need_check?
|
39
|
+
cache = cache_file
|
40
|
+
return false if cache.nil? # cache file fails, no update check.
|
41
|
+
return false if IO.binread(cache).strip == 'never'
|
42
|
+
Time.now >= last_check + FREQUENCY
|
43
|
+
end
|
44
|
+
|
45
|
+
def last_check
|
46
|
+
cache = cache_file
|
47
|
+
return Time.now if cache.nil?
|
48
|
+
File.open(cache, &:mtime)
|
49
|
+
end
|
50
|
+
|
51
|
+
def cache_file
|
52
|
+
dir = File.dirname(CACHE_FILE)
|
53
|
+
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
54
|
+
IO.binwrite(CACHE_FILE, '') unless File.exist?(CACHE_FILE)
|
55
|
+
CACHE_FILE
|
56
|
+
rescue # prevent dir is not writable
|
57
|
+
return nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/one_gadget/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: one_gadget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- david942j
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elftools
|
@@ -775,6 +775,7 @@ files:
|
|
775
775
|
- lib/one_gadget/gadget.rb
|
776
776
|
- lib/one_gadget/helper.rb
|
777
777
|
- lib/one_gadget/logger.rb
|
778
|
+
- lib/one_gadget/update.rb
|
778
779
|
- lib/one_gadget/version.rb
|
779
780
|
homepage: https://github.com/david942j/one_gadget
|
780
781
|
licenses:
|
@@ -796,7 +797,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
796
797
|
version: '0'
|
797
798
|
requirements: []
|
798
799
|
rubyforge_project:
|
799
|
-
rubygems_version: 2.
|
800
|
+
rubygems_version: 2.5.2
|
800
801
|
signing_key:
|
801
802
|
specification_version: 4
|
802
803
|
summary: one_gadget
|