one_gadget 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 698ac48e3e7980de7f6c1b5b8bb4085a0466702cd80a427c33612191b6bda47c
4
- data.tar.gz: 55bad01393fc60e1872becf2f0b3e9d2b92a5269683428617f8fb09d1f3776a7
3
+ metadata.gz: 223aa849cee41952e27731d2ae1e0aeced46e45c9c902d88501a896443934486
4
+ data.tar.gz: 9f5a11874255fba6cfc3e9a344e2ebc1a15e7388bcff81ffc83e9859d1480fb7
5
5
  SHA512:
6
- metadata.gz: 6069d1f1c95628d2fd5a30430ce5f3b80ddd6256a2df0d5a94bede26aa034c5e796cb0682496f94835d31b5c359f78dc42fc7e3c942305b3c3bc597d5a5c722f
7
- data.tar.gz: 8d69884a81539655aa360af17a6c443f65985235e422a9ea45f2a693cf0dff4387436c4e4340d9160e73166dc686067a87c025a466d71623a86c9ba600895880
6
+ metadata.gz: 000f6fc6ae7e4e1d714b95fb2d958a40798dc867f991f74050cce746ba3edbc4ab5f41f00de973f4b6237c00f1a714ed6c0f895d5a89de667899da40a4b5d313
7
+ data.tar.gz: 6c2a1e22e24a3b9cfbdd0f166c4686894686c8805479fc4cfd152e2b5e37841e05178172b4121bdfbe187ec5378ed744955cd0ebeb898ac6d5aebc10889e9e59
@@ -78,12 +78,19 @@ module OneGadget
78
78
  case expr
79
79
  when / & 0xf/ then 0.95
80
80
  when /GOT address/ then 0.9
81
- when /^writable/ then 0.81
82
- when / == NULL$/ then calculate_null_score(expr.slice(0...expr.rindex(' == NULL')))
83
- when / <= 0$/ then calculate_null_score(expr.slice(0...expr.rindex(' <= ')))
81
+ when /^writable/ then calculate_writable_score(expr.sub('writable: ', ''))
82
+ when / == NULL$/ then calculate_null_score(expr.sub(' == NULL', ''))
83
+ when / <= 0$/ then calculate_null_score(expr.sub(' <= 0', ''))
84
84
  end
85
85
  end
86
86
 
87
+ def calculate_writable_score(identity)
88
+ lmda = OneGadget::Emulators::Lambda.parse(identity)
89
+ return 0.81 if lmda.deref_count != 0
90
+
91
+ OneGadget::ABI.stack_register?(lmda.obj) ? 0.95 : 0.81
92
+ end
93
+
87
94
  def calculate_null_score(identity)
88
95
  # remove <CAST>
89
96
  identity.sub!(/^\([s|u]\d+\)/, '')
@@ -2,5 +2,5 @@
2
2
 
3
3
  module OneGadget
4
4
  # Current gem version.
5
- VERSION = '1.8.0'
5
+ VERSION = '1.8.1'
6
6
  end
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.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - david942j
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-20 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elftools