meka 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/bin/meka +4 -0
  3. data/lib/meka/version.rb +3 -0
  4. data/lib/meka.rb +34 -0
  5. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bf3f2490039d94922ad01d3a56e76dab20d927167aac2b48ff381a32b960381a
4
+ data.tar.gz: 8b605d85ad5646882287ebd9d502891c7a5772307a6be36d34c8a996d7e11468
5
+ SHA512:
6
+ metadata.gz: 1790311ba5491fb1dbf2b0309ab16207a019eae6b240e3c074221bc7b78983c85f4db60e9537e63b88448bad1804f170252c84899bb44dac9322bddc6967c3b8
7
+ data.tar.gz: d58777a297d733af88cdcae51c9a02d2eb5c20b9477dd2467e6547b64f8ea19dc76e1a04234664745cd38b40aba117dd3eee9502592dc5d3a43b1dac9836509c
data/bin/meka ADDED
@@ -0,0 +1,4 @@
1
+ #!usr/bin/env ruby
2
+ require 'meka'
3
+
4
+
@@ -0,0 +1,3 @@
1
+ module Meka
2
+ VERSION = "0.0.0"
3
+ end
data/lib/meka.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'socket'
2
+ require 'timeout'
3
+
4
+ module Meka
5
+ open_ports = []
6
+ addr = ARGV[0] || '127.0.0.1'
7
+ timeout = addr == '127.0.0.1' ? 0.4 : 2
8
+
9
+ test_ports = []
10
+ if ARGV.length > 1
11
+ ARGV[1..].each do |port|
12
+ test_ports << port
13
+ end
14
+ end
15
+ if addr != '127.0.0.1' && test_ports.empty?
16
+ puts 'remote server scanning requires ports to be provided'
17
+ exit(0)
18
+ end
19
+
20
+ if addr == '127.0.0.1' && test_ports.empty?
21
+ test_ports = (1..65535).to_a
22
+ end
23
+
24
+ test_ports.each do |p|
25
+ s = Socket.new Socket::AF_INET, Socket::SOCK_STREAM, 0
26
+ print "#{p}\r"
27
+ $stdout.flush
28
+ Timeout::timeout(timeout) { s.connect Socket.pack_sockaddr_in(p, addr) }
29
+ open_ports << p
30
+ rescue StandardError
31
+ end
32
+ puts
33
+ puts "open ports #{open_ports}"
34
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meka
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kaíque Kandy Koga
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Port Scanner
14
+ email:
15
+ executables:
16
+ - meka
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/meka
21
+ - lib/meka.rb
22
+ - lib/meka/version.rb
23
+ homepage: https://github.com/kaiquekandykoga/meka
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.2.32
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: meka
46
+ test_files: []