soba3kofta-shamshama 0.0.0.pre28 → 0.0.0.pre29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8355a24fd54be77021771d8bf28b88f2655a7b7
4
- data.tar.gz: 73ca0261f6517c41cb7f343af992e169b875adb9
3
+ metadata.gz: ebee30d547340e72d58c71d2f90b241ead369a95
4
+ data.tar.gz: 758f90616b24bdce796c4222ef18618af9d3fe63
5
5
  SHA512:
6
- metadata.gz: 058c7c683e0eaf8205495e79f0de9df694e52422929355e55aaae8162d29b208028177641ec27302236c6b0c897793f2f03942cbf85d22b9f15a8881a204319e
7
- data.tar.gz: dfed770e034aec09ca60b70044dfbd165c805c3b205969c834235bbf536b67130e2fa6198d00bdbfc539a5e2893030e28e9cf8f1c253f0ff321ae2ad7e327aa5
6
+ metadata.gz: 0a9419fdf0b3d6be1c1d71c856873ab8ce969910201ea6e9915ad44aaad4c3fa86e5f745327ac6472f8f824a0b314b72f4e3735ea6fb5ae49f697016b50e9eca
7
+ data.tar.gz: c81320d0427a21fcac71232ac686d99a8701fe48e0209464934d7bf1a4d4eeeeb068c77b0dceb4376b1792af737b3fa44b8ff7893ed8a5c26612d58f73d3fd0a
@@ -18,7 +18,7 @@ Soba3kofta::Env.register do
18
18
  end
19
19
 
20
20
  module Soba3kofta
21
- class Shamshama
21
+ class Shamshama < Soba3kofta::Middleware
22
22
  def initialize(app, opts={},params={})
23
23
  @app = app
24
24
  @opts = opts
@@ -0,0 +1,25 @@
1
+ require 'socket' #socket library
2
+ @open_ports = []
3
+ def open_port(host, port)
4
+ p "Trying #{port} on #{host}"
5
+ sock = Socket.new(:INET, :STREAM)
6
+ raw = Socket.sockaddr_in(port, host)
7
+ if sock.connect(raw)
8
+ puts "#{port} open." #if sock.connect(raw)
9
+ @open_ports << port
10
+ end
11
+ rescue (Errno::ECONNREFUSED)
12
+ rescue(Errno::ETIMEDOUT)
13
+ end
14
+
15
+ def main(host, start_port, end_port)
16
+ threads = (start_port..end_port).map do |i|
17
+ Thread.new(i) do |i|
18
+ open_port(host, i)
19
+ end
20
+ end
21
+ threads.each {|t| t.join;}
22
+ p "#################### #{@open_ports} #####################"
23
+ end
24
+
25
+ main ARGV[0], ARGV[1].to_i, ARGV[2].to_i
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soba3kofta-shamshama
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.pre28
4
+ version: 0.0.0.pre29
5
5
  platform: ruby
6
6
  authors:
7
7
  - theotherstupidguy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2014-05-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: shamshama
14
14
  email:
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - lib/soba3kofta-shamshama.rb
21
21
  - lib/soba3kofta-shamshama/base.rb
22
+ - lib/soba3kofta-shamshama/scan.rb
22
23
  homepage: https://github.com/theotherstupidguy/soba3kofta-shamshama
23
24
  licenses:
24
25
  - MIT