Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS feed plugin #8612

Merged
merged 3 commits into from
Jul 24, 2017
Merged

RSS feed plugin #8612

merged 3 commits into from
Jul 24, 2017

Conversation

mubix
Copy link
Contributor

@mubix mubix commented Jun 25, 2017

Loading

msf exploit(web_delivery) > load rss
[*] Successfully loaded plugin: rss

Serving the file

root at debian in ~/metasploit-framework on master [!?]
$ ruby -run -ehttpd . -p 80
[2017-06-25 18:42:51] INFO  WEBrick 1.3.1
[2017-06-25 18:42:51] INFO  ruby 2.4.1 (2017-03-22) [x86_64-linux]
[2017-06-25 18:42:51] INFO  WEBrick::HTTPServer#start: pid=11590 port=80
54.152.136.21 - - [25/Jun/2017:18:45:20 UTC] "GET /feed.rss HTTP/1.1" 200 920
- -> /feed.rss

But can obviously be done with Apache, or Nginx or python

The RSS feed is loaded in the current working directory as feed.rss. Making this modifiable by the user is v2, as well as serving out the RSS feed using Metasploit's HTTP server.

But it can be used for cool stuff like IFTTT:

screen shot 2017-06-25 at 1 38 48 pm

screen shot 2017-06-25 at 1 40 23 pm

2017-06-25 13 46 08

@mubix mubix added the feature label Jun 25, 2017
@egypt egypt self-assigned this Jun 25, 2017
@@ -0,0 +1,123 @@
#
# $Id$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't necessary.

super

@items = []
self.queue = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be an actual Queue object to avoid race conditions, since sessions come in at random times.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guarantees on that are questionable - VM assumptions. For completeness sake, given the mix of async evt callbacks and threaded calls, maybe we take a lock?

Copy link
Contributor

@sempervictus sempervictus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicks really, having to do with some of the oddities of our low level concurrency semantics. Works out of the box, so if they're annoying feel free to ignore. It's got my ACK. Thanks @mubix - now the world will learn of pwnage as it happens :).

end

def start_event_queue
self.queue_thread = Thread.new do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of consistency, and do reduce chance of losing thread handles if a new queue_thread is created, could we do this as Rex::ThreadFactory.spawn... ?

while(event = self.queue.shift)
generate_feed(event)
end
select(nil, nil, nil, 0.25)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to double check how the select call here actually traverses the overrides, but im leaning toward "this is a native select call" which may also have some issues esp in a GIL-free VM. Where have a Rex::ThreadSafe.select method which should handle those potential edge cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The man himself overloaded Kernel.select to avoid these calls being a problem - withdrawn.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that so? TIL!

super

@items = []
self.queue = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guarantees on that are questionable - VM assumptions. For completeness sake, given the mix of async evt callbacks and threaded calls, maybe we take a lock?

def stop_event_queue
self.queue_thread.kill if self.queue_thread
self.queue_thread = nil
self.queue = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad suggestion in Ruby terms, but given how we solve this concern elsewhere, can we GC.run here to clear out the nested object refs on the queue members?

while(event = self.queue.shift)
generate_feed(event)
end
select(nil, nil, nil, 0.25)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The man himself overloaded Kernel.select to avoid these calls being a problem - withdrawn.

@wvu wvu self-assigned this Jul 24, 2017
wvu added a commit to wvu/metasploit-framework that referenced this pull request Jul 24, 2017
@wvu wvu merged commit b66119b into rapid7:master Jul 24, 2017
@mubix mubix deleted the rssfeed_plugin branch July 24, 2017 22:41
@wvu
Copy link
Contributor

wvu commented Jul 24, 2017

f77554f

@alrosenthal-r7
Copy link

Release Notes

An RSS feed plugin has been added to the framework. The RSS feed is loaded in the current working directory as feed.rss. You can use the plugin to keep track of what Metasploit is doing and integrate with third-party services. For example, you could set up IFTTT to text you when you get a session.

@alrosenthal-r7
Copy link

@egypt GitHub is blaming me for unassigning you and I did no such thing. But it won't let me reassign you? 🙈

@alrosenthal-r7 alrosenthal-r7 added the rn-enhancement release notes enhancement label Jul 31, 2017
@busterb
Copy link
Member

busterb commented Aug 3, 2017

That was caused by some automated scripts. Will get that fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants