sploit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ require "autotest/restart"
2
+
3
+ Autotest.add_hook :initialize do |at|
4
+ at.testlib = "minitest/autorun"
5
+ end
@@ -0,0 +1,3 @@
1
+ === 1.0.0 / 2010-07-13
2
+
3
+ * Birthday!
@@ -0,0 +1,7 @@
1
+ .autotest
2
+ CHANGELOG.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ bin/sploit
7
+ lib/sploit.rb
@@ -0,0 +1,64 @@
1
+ = Sploit!
2
+
3
+ * http://github.com/jbarnette/sploit
4
+
5
+ == Description
6
+
7
+ Grab and eval Ruby code via HTTP. You don't care about security, right?
8
+
9
+ This gem is Dr. Nic's fault. We were looking for an easy way to run
10
+ Ruby code that was publicly available on a web server, and though
11
+ we've all written something to do this a time or two, we couldn't find
12
+ a convenient gem.
13
+
14
+ I hacked up a quick example:
15
+
16
+ ruby -rubygems -ropen-uri -e \
17
+ 'eval open("http://gist.github.com/raw/473222/snippet.rb").read' \
18
+ jbarnette dr-nic-magic-awesome
19
+
20
+ ...but why use a simple Ruby one-liner when we can go overboard and
21
+ package it as a gem? While we're at it, why not add a tiny bit of
22
+ extra sugar for Gists?
23
+
24
+ This is not an original idea. It's been done a ton of times before,
25
+ but this one is ours. Don't use it for anything real or it'll melt
26
+ your face.
27
+
28
+ == Examples
29
+
30
+ # eval the contents of a URL
31
+ $ sploit http://jbarnette.com/hello.rb
32
+
33
+ # eval a file in a gist
34
+ $ sploit -g 474087 second.rb
35
+
36
+ # eval the first unnamed file (gistfile1.txt) in a gist
37
+ $ sploit -g 47087
38
+
39
+ == Installation
40
+
41
+ $ gem install sploit
42
+
43
+ == License
44
+
45
+ Copyright 2010 John Barnette, Dr. Nic Williams
46
+
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of this software and associated documentation files (the
49
+ 'Software'), to deal in the Software without restriction, including
50
+ without limitation the rights to use, copy, modify, merge, publish,
51
+ distribute, sublicense, and/or sell copies of the Software, and to
52
+ permit persons to whom the Software is furnished to do so, subject to
53
+ the following conditions:
54
+
55
+ The above copyright notice and this permission notice shall be
56
+ included in all copies or substantial portions of the Software.
57
+
58
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
59
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
61
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
62
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
63
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
64
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ require "hoe"
2
+
3
+ Hoe.plugins.delete :rubyforge
4
+ Hoe.plugin :doofus, :git
5
+
6
+ Hoe.spec "sploit" do
7
+ developer "John Barnette", "jbarnette@rubygems.org"
8
+ developer "Dr. Nic Williams", "drnicwilliams@gmail.com"
9
+
10
+ self.extra_rdoc_files = Dir["*.rdoc"]
11
+ self.history_file = "CHANGELOG.rdoc"
12
+ self.readme_file = "README.rdoc"
13
+ self.testlib = :minitest
14
+ end
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "optparse"
4
+ require "sploit"
5
+
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: #$0 [options] url..."
8
+
9
+ gist = nil
10
+
11
+ opts.on "--gist id", "-g", "URLs are inside a Gist." do |id|
12
+ gist = id
13
+ end
14
+
15
+ opts.on "--help", "-h", "-?", "Show this help." do
16
+ puts opts
17
+ exit
18
+ end
19
+
20
+ opts.on "--version", "-V", "Prints #{Sploit::VERSION}." do
21
+ puts Sploit::VERSION
22
+ exit
23
+ end
24
+
25
+ begin
26
+ opts.parse! ARGV
27
+ rescue OptionParser::ParseError => e
28
+ warn e.message
29
+ abort opts.to_s
30
+ end
31
+
32
+ if gist
33
+ ARGV.unshift "gistfile1.txt" if ARGV.empty?
34
+ ARGV.collect! { |url| File.join "http://gist.github.com/raw", gist, url }
35
+ end
36
+
37
+ if ARGV.empty?
38
+ abort opts.to_s
39
+ end
40
+
41
+ begin
42
+ Sploit.run *ARGV
43
+ rescue SocketError => e
44
+ abort e.message
45
+ end
46
+ end
@@ -0,0 +1,20 @@
1
+ require "open-uri"
2
+
3
+ # You've got to be joking.
4
+
5
+ class Sploit
6
+
7
+ # Duh.
8
+
9
+ VERSION = "1.0.0"
10
+
11
+ # Runs.
12
+
13
+ def self.run *urls
14
+ results = urls.collect do |url|
15
+ eval open(url).read, nil, url, 1
16
+ end
17
+
18
+ results.length == 1 ? results.first : results
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sploit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 0
10
+ version: 1.0.0
11
+ platform: ruby
12
+ authors:
13
+ - John Barnette
14
+ - Dr. Nic Williams
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-07-13 00:00:00 -07:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: hoe
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 21
31
+ segments:
32
+ - 2
33
+ - 6
34
+ - 1
35
+ version: 2.6.1
36
+ type: :development
37
+ version_requirements: *id001
38
+ description: |-
39
+ Grab and eval Ruby code via HTTP. You don't care about security, right?
40
+
41
+ This gem is Dr. Nic's fault. We were looking for an easy way to run
42
+ Ruby code that was publicly available on a web server, and though
43
+ we've all written something to do this a time or two, we couldn't find
44
+ a convenient gem.
45
+
46
+ I hacked up a quick example:
47
+
48
+ ruby -rubygems -ropen-uri -e \
49
+ 'eval open("http://gist.github.com/raw/473222/snippet.rb").read' \
50
+ jbarnette dr-nic-magic-awesome
51
+
52
+ ...but why use a simple Ruby one-liner when we can go overboard and
53
+ package it as a gem? While we're at it, why not add a tiny bit of
54
+ extra sugar for Gists?
55
+
56
+ This is not an original idea. It's been done a ton of times before,
57
+ but this one is ours. Don't use it for anything real or it'll melt
58
+ your face.
59
+ email:
60
+ - jbarnette@rubygems.org
61
+ - drnicwilliams@gmail.com
62
+ executables:
63
+ - sploit
64
+ extensions: []
65
+
66
+ extra_rdoc_files:
67
+ - Manifest.txt
68
+ - CHANGELOG.rdoc
69
+ - README.rdoc
70
+ files:
71
+ - .autotest
72
+ - CHANGELOG.rdoc
73
+ - Manifest.txt
74
+ - README.rdoc
75
+ - Rakefile
76
+ - bin/sploit
77
+ - lib/sploit.rb
78
+ has_rdoc: true
79
+ homepage: http://github.com/jbarnette/sploit
80
+ licenses: []
81
+
82
+ post_install_message:
83
+ rdoc_options:
84
+ - --main
85
+ - README.rdoc
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ requirements: []
107
+
108
+ rubyforge_project: sploit
109
+ rubygems_version: 1.3.7
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Grab and eval Ruby code via HTTP
113
+ test_files: []
114
+