OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
ruby
/
2.5.0
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
English.rb
6.31 KB
08/25/2017 03:47:04 PM
rw-r--r--
📄
abbrev.rb
3.49 KB
02/09/2017 04:12:00 PM
rw-r--r--
📄
base64.rb
3.3 KB
02/10/2017 12:58:47 AM
rw-r--r--
📄
benchmark.rb
17.89 KB
01/03/2017 02:00:01 AM
rw-r--r--
📁
bigdecimal
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📁
cgi
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
cgi.rb
9.8 KB
02/18/2017 05:52:16 AM
rw-r--r--
📄
cmath.rb
9.49 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
csv.rb
82.88 KB
09/12/2017 08:38:06 AM
rw-r--r--
📄
date.rb
1003 bytes
05/15/2023 11:41:43 AM
rw-r--r--
📄
debug.rb
29.97 KB
01/05/2017 01:00:01 AM
rw-r--r--
📄
delegate.rb
10.44 KB
12/12/2017 11:56:25 AM
rw-r--r--
📁
digest
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
digest.rb
2.83 KB
05/15/2023 11:41:43 AM
rw-r--r--
📁
drb
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
drb.rb
50 bytes
12/16/2015 05:07:31 AM
rw-r--r--
📄
e2mmap.rb
3.94 KB
03/01/2017 11:37:30 AM
rw-r--r--
📄
erb.rb
27.46 KB
01/03/2018 06:11:47 PM
rw-r--r--
📄
expect.rb
2.17 KB
05/15/2023 11:41:43 AM
rw-r--r--
📁
fiddle
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
fiddle.rb
1.68 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
fileutils.rb
44.15 KB
12/22/2017 08:00:10 AM
rw-r--r--
📄
find.rb
2.47 KB
09/15/2017 05:00:49 PM
rw-r--r--
📁
forwardable
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
forwardable.rb
8.49 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
getoptlong.rb
15.42 KB
09/02/2017 02:05:34 AM
rw-r--r--
📁
io
-
02/10/2020 11:55:58 AM
rwxr-xr-x
📄
ipaddr.rb
19.51 KB
12/12/2017 11:56:25 AM
rw-r--r--
📁
irb
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
irb.rb
20.48 KB
02/21/2018 06:00:51 AM
rw-r--r--
📁
json
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
json.rb
1.77 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
kconv.rb
5.77 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
logger.rb
23.54 KB
12/21/2017 05:07:43 AM
rw-r--r--
📁
matrix
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
matrix.rb
53.2 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
mkmf.rb
84.38 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
monitor.rb
7.26 KB
10/08/2017 07:00:01 AM
rw-r--r--
📄
mutex_m.rb
2.02 KB
10/08/2017 07:00:01 AM
rw-r--r--
📁
net
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
observer.rb
5.83 KB
01/13/2017 12:08:29 PM
rw-r--r--
📄
open-uri.rb
25.11 KB
12/21/2017 02:15:04 PM
rw-r--r--
📄
open3.rb
20.94 KB
10/21/2017 07:00:58 AM
rw-r--r--
📁
openssl
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
openssl.rb
469 bytes
05/15/2023 11:41:43 AM
rw-r--r--
📄
optionparser.rb
59 bytes
12/16/2015 05:07:31 AM
rw-r--r--
📁
optparse
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
optparse.rb
57.25 KB
07/24/2017 01:56:04 AM
rw-r--r--
📄
ostruct.rb
10.16 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
pathname.rb
16.09 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
pp.rb
14.36 KB
12/18/2017 01:51:53 AM
rw-r--r--
📄
prettyprint.rb
15.89 KB
11/10/2015 11:48:14 AM
rw-r--r--
📄
prime.rb
12.48 KB
05/20/2017 10:21:44 AM
rw-r--r--
📄
profile.rb
235 bytes
01/15/2017 02:56:04 AM
rw-r--r--
📄
profiler.rb
4.54 KB
01/18/2017 12:35:10 PM
rw-r--r--
📄
pstore.rb
14.7 KB
01/17/2017 12:47:38 PM
rw-r--r--
📁
psych
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
psych.rb
16.54 KB
05/15/2023 11:41:43 AM
rw-r--r--
📁
racc
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📁
rdoc
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
rdoc.rb
5.03 KB
12/23/2017 11:33:09 PM
rw-r--r--
📄
resolv-replace.rb
1.76 KB
11/14/2015 08:25:30 AM
rw-r--r--
📄
resolv.rb
72.73 KB
12/20/2017 04:25:01 AM
rw-r--r--
📁
rexml
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📁
rinda
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📁
ripper
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
ripper.rb
2.44 KB
05/15/2023 11:41:43 AM
rw-r--r--
📁
rss
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
rss.rb
2.87 KB
12/16/2015 05:07:31 AM
rw-r--r--
📁
rubygems
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
rubygems.rb
36.57 KB
03/19/2018 08:27:04 AM
rw-r--r--
📄
scanf.rb
23.56 KB
10/21/2017 12:34:13 PM
rw-r--r--
📄
securerandom.rb
8.61 KB
10/25/2017 07:28:22 AM
rw-r--r--
📄
set.rb
24.01 KB
11/22/2017 09:13:51 PM
rw-r--r--
📁
shell
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
shell.rb
11.37 KB
11/05/2016 11:58:02 PM
rw-r--r--
📄
shellwords.rb
6.66 KB
11/05/2016 04:58:48 AM
rw-r--r--
📄
singleton.rb
4.04 KB
10/08/2017 07:00:01 AM
rw-r--r--
📄
socket.rb
43.51 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
sync.rb
7.29 KB
09/18/2016 10:24:48 AM
rw-r--r--
📁
syslog
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
tempfile.rb
11.14 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
thwait.rb
3.33 KB
10/08/2017 07:00:01 AM
rw-r--r--
📄
time.rb
22.38 KB
05/15/2023 11:41:43 AM
rw-r--r--
📄
timeout.rb
3.81 KB
12/12/2017 11:56:25 AM
rw-r--r--
📄
tmpdir.rb
4.12 KB
03/28/2018 12:54:26 PM
rw-r--r--
📄
tracer.rb
6.42 KB
10/08/2017 07:00:01 AM
rw-r--r--
📄
tsort.rb
14.3 KB
11/14/2015 08:46:11 AM
rw-r--r--
📄
un.rb
9.78 KB
07/05/2017 09:05:53 AM
rw-r--r--
📁
unicode_normalize
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📁
uri
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
uri.rb
3.1 KB
12/16/2015 05:07:31 AM
rw-r--r--
📄
weakref.rb
1.44 KB
10/24/2017 06:08:00 PM
rw-r--r--
📁
webrick
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
webrick.rb
6.72 KB
12/23/2015 03:43:23 AM
rw-r--r--
📁
yaml
-
05/09/2024 07:14:11 AM
rwxr-xr-x
📄
yaml.rb
1.73 KB
12/12/2017 11:56:25 AM
rw-r--r--
Editing: observer.rb
Close
# frozen_string_literal: true # # Implementation of the _Observer_ object-oriented design pattern. The # following documentation is copied, with modifications, from "Programming # Ruby", by Hunt and Thomas; http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_patterns.html. # # See Observable for more info. # The Observer pattern (also known as publish/subscribe) provides a simple # mechanism for one object to inform a set of interested third-party objects # when its state changes. # # == Mechanism # # The notifying class mixes in the +Observable+ # module, which provides the methods for managing the associated observer # objects. # # The observable object must: # * assert that it has +#changed+ # * call +#notify_observers+ # # An observer subscribes to updates using Observable#add_observer, which also # specifies the method called via #notify_observers. The default method for # #notify_observers is #update. # # === Example # # The following example demonstrates this nicely. A +Ticker+, when run, # continually receives the stock +Price+ for its <tt>@symbol</tt>. A +Warner+ # is a general observer of the price, and two warners are demonstrated, a # +WarnLow+ and a +WarnHigh+, which print a warning if the price is below or # above their set limits, respectively. # # The +update+ callback allows the warners to run without being explicitly # called. The system is set up with the +Ticker+ and several observers, and the # observers do their duty without the top-level code having to interfere. # # Note that the contract between publisher and subscriber (observable and # observer) is not declared or enforced. The +Ticker+ publishes a time and a # price, and the warners receive that. But if you don't ensure that your # contracts are correct, nothing else can warn you. # # require "observer" # # class Ticker ### Periodically fetch a stock price. # include Observable # # def initialize(symbol) # @symbol = symbol # end # # def run # last_price = nil # loop do # price = Price.fetch(@symbol) # print "Current price: #{price}\n" # if price != last_price # changed # notify observers # last_price = price # notify_observers(Time.now, price) # end # sleep 1 # end # end # end # # class Price ### A mock class to fetch a stock price (60 - 140). # def self.fetch(symbol) # 60 + rand(80) # end # end # # class Warner ### An abstract observer of Ticker objects. # def initialize(ticker, limit) # @limit = limit # ticker.add_observer(self) # end # end # # class WarnLow < Warner # def update(time, price) # callback for observer # if price < @limit # print "--- #{time.to_s}: Price below #@limit: #{price}\n" # end # end # end # # class WarnHigh < Warner # def update(time, price) # callback for observer # if price > @limit # print "+++ #{time.to_s}: Price above #@limit: #{price}\n" # end # end # end # # ticker = Ticker.new("MSFT") # WarnLow.new(ticker, 80) # WarnHigh.new(ticker, 120) # ticker.run # # Produces: # # Current price: 83 # Current price: 75 # --- Sun Jun 09 00:10:25 CDT 2002: Price below 80: 75 # Current price: 90 # Current price: 134 # +++ Sun Jun 09 00:10:25 CDT 2002: Price above 120: 134 # Current price: 134 # Current price: 112 # Current price: 79 # --- Sun Jun 09 00:10:25 CDT 2002: Price below 80: 79 module Observable # # Add +observer+ as an observer on this object. So that it will receive # notifications. # # +observer+:: the object that will be notified of changes. # +func+:: Symbol naming the method that will be called when this Observable # has changes. # # This method must return true for +observer.respond_to?+ and will # receive <tt>*arg</tt> when #notify_observers is called, where # <tt>*arg</tt> is the value passed to #notify_observers by this # Observable def add_observer(observer, func=:update) @observer_peers = {} unless defined? @observer_peers unless observer.respond_to? func raise NoMethodError, "observer does not respond to `#{func}'" end @observer_peers[observer] = func end # # Remove +observer+ as an observer on this object so that it will no longer # receive notifications. # # +observer+:: An observer of this Observable def delete_observer(observer) @observer_peers.delete observer if defined? @observer_peers end # # Remove all observers associated with this object. # def delete_observers @observer_peers.clear if defined? @observer_peers end # # Return the number of observers associated with this object. # def count_observers if defined? @observer_peers @observer_peers.size else 0 end end # # Set the changed state of this object. Notifications will be sent only if # the changed +state+ is +true+. # # +state+:: Boolean indicating the changed state of this Observable. # def changed(state=true) @observer_state = state end # # Returns true if this object's state has been changed since the last # #notify_observers call. # def changed? if defined? @observer_state and @observer_state true else false end end # # Notify observers of a change in state *if* this object's changed state is # +true+. # # This will invoke the method named in #add_observer, passing <tt>*arg</tt>. # The changed state is then set to +false+. # # <tt>*arg</tt>:: Any arguments to pass to the observers. def notify_observers(*arg) if defined? @observer_state and @observer_state if defined? @observer_peers @observer_peers.each do |k, v| k.send v, *arg end end @observer_state = false end end end