Skip to content

Instantly share code, notes, and snippets.

/code.rb Secret

Created October 31, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c04f2f505667786dda0b13da3bcba26c to your computer and use it in GitHub Desktop.
Save anonymous/c04f2f505667786dda0b13da3bcba26c to your computer and use it in GitHub Desktop.
require 'open3'
require 'yaml'
class LeakDetection
def parseAppList filename
File.foreach(filename).with_index do |line, line_num|
bob = line
bob.encode("UTF-8")
cho = YAML.load(bob)
puts cho.inspect
end
end
# Need to return and store tye errors. then later process to get all reachable paths
def detect_leak inp
Open3.popen3("./droidinfer.sh ../#{inp}", :chdir=>"/home/aliarslan/paper93/artifact/binary") {|i,o,e,t|
result = o.read.chomp #=> "/"
}
# Check if successful exec
if !(result.include? "Total running")
puts "Failed to analyze app...skipping"
end
app = App.new "inp"
# Now read result from file and parse it...
File.open("/home/aliarslan/paper93/artifact/#{inp}/type_errors.txt", "r") do |f|
f.each_line do |line|
# te = TypeError.new() # parse this and store types one at a time
# perform cf explain here and store - CHECK IF BFS COMPLETE!
end
end
end
end
lD = LeakDetection.new
lD.parseAppList 'eoeappDetails.txt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment