plympton 1.1.0 → 1.1.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
  SHA1:
3
- metadata.gz: 0c809128838470cc20b4ae9b7bac312bd736b33b
4
- data.tar.gz: a770fb56e21f7c3f0bf1abda87a6873629f87094
3
+ metadata.gz: aef250c09540302f8fbd9f4b99314e2814a7498e
4
+ data.tar.gz: a98d40ec8e34936fc41ea248fd7ef90c4db03be0
5
5
  SHA512:
6
- metadata.gz: 57781fabc6343ce5c5e3fb35dea0ad55525694026d2bbfd2da24302276f2ae9f3af4696c97f45235046d84c0586304097912a3536cfe68c5a39509b52d386386
7
- data.tar.gz: 6970e51b07c92beead632679de4b653ac6d0d4b82e1f690bb59a38600791049e5e6c6904036c07c2e1fc87038c967096c82c00da5ac1ebbcda70e01572a75eac
6
+ metadata.gz: d4503adfd993f6bbc19b8667fb0a2468201abb7fcbf15eb4a8edfe1c5e484f67a179f50da0ff347eeb273e3c9e00dc8a5840f8dad25f5aef6b7b78febeda3e46
7
+ data.tar.gz: 5a84bf8c76b7b7a8698b74f1bcd91c3556359e3bbb1fbecbadf741c8bb125fcb5fdc2f85563b1d813619b246a4d5af56062785c360438f1390d79b3110354e35
data/Gemfile CHANGED
@@ -12,4 +12,3 @@ end
12
12
  gem 'nokogiri', '~> 1.6'
13
13
  gem 'antlr3', '~> 1.10'
14
14
  gem 'narray', '~> 0.6'
15
- gem 'coveralls', require: false
data/README.md CHANGED
@@ -7,6 +7,15 @@ A gem to read program disassembly from a YAML dump. The YAML dump is generated
7
7
  [![Coverage Status](https://coveralls.io/repos/rogwfu/plympton/badge.png)](https://coveralls.io/r/rogwfu/plympton)
8
8
  [![Dependency Status](https://www.versioneye.com/user/projects/543603aab2a9c5dd3d000092/badge.svg?style=flat)](https://www.versioneye.com/user/projects/543603aab2a9c5dd3d000092)
9
9
 
10
+ ## Dependencies
11
+
12
+ The IDA Python auto analysis script requires YAML for serializing program information. To install:
13
+
14
+ ### Mac OS X
15
+ ```bash
16
+ sudo /usr/bin/easy_install-2.6 pyyaml
17
+ ```
18
+
10
19
  ## Contributing to plympton
11
20
 
12
21
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
@@ -413,8 +413,11 @@ yamlFilename = os.environ['PWD'] + "/" + GetInputFile() + ".fz"
413
413
  # Open the file
414
414
  yamlFile = open(yamlFilename, 'w')
415
415
 
416
- # Get the start and end of the text section
417
- textSegmentSelector = SegByName("__text")
416
+ # Get the start and end of the text section (__text Mac, .text Linux)
417
+ textSegmentSelector = SegByName(".text")
418
+ if textSegmentSelector == BADADDR:
419
+ textSegmentSelector = SegByName("__text")
420
+
418
421
  textSegmentStart = SegByBase(textSegmentSelector)
419
422
  textSegmentEnd = SegEnd(textSegmentStart)
420
423
 
@@ -40,6 +40,29 @@ module Plympton
40
40
  return(result)
41
41
  end
42
42
 
43
+ # Function to process hit tracing recorded by lldb
44
+ # @param [String] Path to a lldb trace file
45
+ def lldb_coverage(lldbTrace)
46
+ # Open the valgrind xml trace file
47
+ xmlFile = File.open(lldbTrace, "r")
48
+ xmlDoc = Nokogiri::XML(xmlFile)
49
+
50
+ # Delete any previous hit traces
51
+ @attributes.functionHitTrace.clear()
52
+
53
+ # Parse all the function hits
54
+ xmlDoc.xpath("//hit").each do |hit|
55
+ functionOffset = hit.search("offset").first().inner_text()
56
+ functionHits = hit.search("count").first().inner_text()
57
+ @attributes.functionHitTrace[functionOffset] = [functionHits.to_i()]
58
+ end
59
+
60
+ # FIXME: Add code to handle the markov matrix
61
+
62
+ # Cleanup open file
63
+ xmlFile.close()
64
+ end
65
+
43
66
  # Function to process hit tracing recorded by Valgrind tools (rufus and callgrind)
44
67
  # @param [String] Path to a valgrind trace file
45
68
  def valgrind_coverage(valgrindTrace)
@@ -79,7 +102,7 @@ module Plympton
79
102
  @attributes.functionHash[functionOffset].numTransitions += BigDecimal("#{numberOfCalls}")
80
103
 
81
104
  # Update the transition matrix
82
- @attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] = @attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] + BigDecimal("#{numberOfCalls}")
105
+ # @attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] = @attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] + BigDecimal("#{numberOfCalls}")
83
106
 
84
107
  # Keep track of call trace and number of times called
85
108
  @attributes.trace << "#{@attributes.functionHash[functionOffset].markovIdx}:#{@attributes.functionHash[calleeOffset].markovIdx}:#{numberOfCalls}"
@@ -47,7 +47,7 @@ module Plympton
47
47
  # Transition matrix persists across test case runs
48
48
  # dimension = @functionHash.size() + 1
49
49
  dimension = @functionHash.size()
50
- @transitionMatrix = NMatrix.object(dimension, dimension).fill!(BigDecimal("0"))
50
+ # @transitionMatrix = NMatrix.object(dimension, dimension).fill!(BigDecimal("0"))
51
51
 
52
52
  # Allocate a trace for Markov chains
53
53
  @trace = Array.new()
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: plympton 1.1.0 ruby lib
5
+ # stub: plympton 1.1.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "plympton"
9
- s.version = "1.1.0"
9
+ s.version = "1.1.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Roger Seagle"]
14
- s.date = "2014-10-09"
14
+ s.date = "2014-11-17"
15
15
  s.description = "A Gem to read program disassembly from a YAML dump. The YAML dump is generated from an ida pro python script. This script is included along with this Gem (func.py)"
16
16
  s.email = "roger.seagle@gmail.com"
17
17
  s.executables = ["func-auto.py", "func.py", "func.py.new", "idascript.py"]
@@ -66,7 +66,6 @@ Gem::Specification.new do |s|
66
66
  s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
67
67
  s.add_runtime_dependency(%q<antlr3>, ["~> 1.10"])
68
68
  s.add_runtime_dependency(%q<narray>, ["~> 0.6"])
69
- s.add_runtime_dependency(%q<coveralls>, [">= 0"])
70
69
  s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
71
70
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
72
71
  s.add_development_dependency(%q<rspec>, ["~> 3.1"])
@@ -75,7 +74,6 @@ Gem::Specification.new do |s|
75
74
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
76
75
  s.add_dependency(%q<antlr3>, ["~> 1.10"])
77
76
  s.add_dependency(%q<narray>, ["~> 0.6"])
78
- s.add_dependency(%q<coveralls>, [">= 0"])
79
77
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
80
78
  s.add_dependency(%q<yard>, ["~> 0.8"])
81
79
  s.add_dependency(%q<rspec>, ["~> 3.1"])
@@ -85,7 +83,6 @@ Gem::Specification.new do |s|
85
83
  s.add_dependency(%q<nokogiri>, ["~> 1.6"])
86
84
  s.add_dependency(%q<antlr3>, ["~> 1.10"])
87
85
  s.add_dependency(%q<narray>, ["~> 0.6"])
88
- s.add_dependency(%q<coveralls>, [">= 0"])
89
86
  s.add_dependency(%q<jeweler>, ["~> 2.0"])
90
87
  s.add_dependency(%q<yard>, ["~> 0.8"])
91
88
  s.add_dependency(%q<rspec>, ["~> 3.1"])
@@ -202,19 +202,19 @@ describe "PlymptonRefactor" do
202
202
  end
203
203
 
204
204
  # Test probability matrix calculation
205
- it "should correctly calculate probability matrix" do
206
- @object = Plympton::Disassembly.new(File.expand_path(File.dirname(__FILE__) + "/libFontParser.64.dylib.fz"), "U")
207
- @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
208
- onePass = @object.evaluate()
209
- # onePass.should == BigDecimal("0.000026097275191916865333298250824189")
210
-
211
- @object.initialize_solver("U")
212
- @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
213
- @object.attributes.trace.clear() # Simulate two independent traces
214
- @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
215
- twoPass = @object.evaluate()
216
-
217
- # Test Function Path Uniqueness
218
- onePass.should == twoPass
219
- end
205
+ # it "should correctly calculate probability matrix" do
206
+ # @object = Plympton::Disassembly.new(File.expand_path(File.dirname(__FILE__) + "/libFontParser.64.dylib.fz"), "U")
207
+ # @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
208
+ # onePass = @object.evaluate()
209
+ ## onePass.should == BigDecimal("0.000026097275191916865333298250824189")
210
+ #
211
+ # @object.initialize_solver("U")
212
+ # @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
213
+ # @object.attributes.trace.clear() # Simulate two independent traces
214
+ # @object.valgrind_coverage(File.expand_path(File.dirname(__FILE__) + "/steady-state.64bit.trace.xml"))
215
+ # twoPass = @object.evaluate()
216
+ #
217
+ # # Test Function Path Uniqueness
218
+ # onePass.should == twoPass
219
+ # end
220
220
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plympton
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Seagle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-09 00:00:00.000000000 Z
11
+ date: 2014-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: jeweler
71
57
  requirement: !ruby/object:Gem::Requirement