forked from dmayer/idb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathi_device_syslog_thread.rb
45 lines (35 loc) · 991 Bytes
/
i_device_syslog_thread.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require_relative '../lib/tools'
class IDeviceSyslogThread < Qt::Object
signals "new_entry(QString)"
def initialize *args
super *args
$terminate_syslog_thread = false
if which('idevicesyslog').nil?
error = Qt::MessageBox.new
error.setInformativeText("This feature requires idevicesyslog to be installed on the host running idb. Try:<br>OS X: brew install libimobiledevice<br>Ubuntu: apt-get install libimobiledevice-utils")
error.setIcon(Qt::MessageBox::Critical)
error.exec
return false
end
start_log_thread
puts @log_thread
end
def stop
$terminate_syslog_thread = true
end
private
def start_log_thread
@log_thread = Thread.new do
@log = IO.popen("idevicesyslog")
@log.each do |line|
if $terminate_syslog_thread
break
end
emit new_entry(line)
end
puts "[*] Terminating thread"
Process.kill("INT", @log.pid)
@log.close
end
end
end