pwn 0.4.470 → 0.4.473

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ad8e01c4030cf4c3f607f364a80ace5949dac4b7062bcda6db3f11ba6d513cb
4
- data.tar.gz: 205350cec3feb50fda19fc04722a557ad13265b292ad7452eecb57302c723937
3
+ metadata.gz: 800a4481ec352e62a264e69979b18283eac032c9b4b4fa34a8785a6dd046bc7c
4
+ data.tar.gz: ee5c3d0a5bf0ef7347ea27cd54fd4ebd851039509e94b6ae3464bd28100126ef
5
5
  SHA512:
6
- metadata.gz: 4af78e112eb864b091a9031f59a5aa65136983eeb89ca2e9da27b44012ca75f49ec428440e7757886fdae13d8c589d4f211903e0ebeddd1fbc036aaf1c34ba6c
7
- data.tar.gz: f14b392ac1d3bd5eea6824bb6da94b5888b4fae3b0d60d1206feeb4d7b49a5dba68106b3d846da42e620209de36e6361f088ab7f75e44cef74983edefbed815d
6
+ metadata.gz: 1a6784dc075ec9dabae9bea756f0cbd16fea0494a5445e09a9cf7402aa652f207ee140430c1dc9c689bffdbb62ec1983cc9cca2bb5b6aa366fe4b52cfa60bccd
7
+ data.tar.gz: 5115ddcd05d4c3a2526727386e6b0a53a9fb8f5155dc4495d4e473bc7372517611d17fd06b9229a330c1cee907a7683b5a309c78e51c07339ef68a14c3dda30f
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.2@pwn
37
37
  $ rvm list gemsets
38
38
  $ gem install --verbose pwn
39
39
  $ pwn
40
- pwn[v0.4.470]:001 >>> PWN.help
40
+ pwn[v0.4.473]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
@@ -52,7 +52,7 @@ $ rvm use ruby-3.1.2@pwn
52
52
  $ gem uninstall --all --executables pwn
53
53
  $ gem install --verbose pwn
54
54
  $ pwn
55
- pwn[v0.4.470]:001 >>> PWN.help
55
+ pwn[v0.4.473]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ require 'pwn'
5
+ require 'optparse'
6
+ require 'yaml'
7
+ require 'json'
8
+
9
+ opts = {}
10
+ OptionParser.new do |options|
11
+ options.banner = "USAGE:
12
+ #{$PROGRAM_NAME} [opts]
13
+ "
14
+
15
+ options.on('-cYAML', '--config-yaml=YAML', '<Required - YAML config containing api_key from Shodan.io>') do |y|
16
+ opts[:yaml] = y
17
+ end
18
+
19
+ options.on('-qFILE', '--query-file=FILE', '<Required - File containing one Shodan.io query string per line>') do |q|
20
+ opts[:query_file] = q
21
+ end
22
+
23
+ options.on('-oFILE', '--output-results-file=FILE', '<Optional - Defaults to /tmp/shodan-results-Time.now.strftime("%y-%m-%d.%H:%M:%S").txt>') do |o|
24
+ opts[:output_results_file] = o
25
+ end
26
+ end.parse!
27
+
28
+ if opts.empty?
29
+ puts `#{$PROGRAM_NAME} --help`
30
+ exit 1
31
+ end
32
+
33
+ begin
34
+ yaml_file = opts[:yaml].to_s
35
+ raise "ERROR: #{yaml_file} does not exist." unless File.exist?(yaml_file)
36
+
37
+ yaml = YAML.load_file(yaml_file, symbolize_names: true)
38
+
39
+ api_key = yaml[:api_key]
40
+
41
+ query_file = opts[:query_file].to_s
42
+ raise "ERROR: #{query_file} does not exist." unless File.exist?(query_file)
43
+
44
+ queries = File.readlines(query_file)
45
+
46
+ timestamp = Time.now.strftime('%Y-%m-%d.%H:%M:%S')
47
+ query_results_file = opts[:output_results_file]
48
+ query_results_file ||= "/tmp/shodan-results-#{timestamp}.txt"
49
+ query_results_dir = File.dirname(query_results_file)
50
+
51
+ raw_query_results_file = "#{query_results_dir}/shodan-results-#{timestamp}-RAW.json"
52
+ File.open(raw_query_results_file, 'w') do |r|
53
+ File.open(query_results_file, 'w') do |f|
54
+ queries.each do |query_line|
55
+ query = query_line.chomp
56
+ print "QUERY: '#{query}'"
57
+ r.puts("QUERY: '#{query}'")
58
+ f.puts("QUERY: '#{query}'")
59
+ search_results = PWN::Plugins::Shodan.search(
60
+ api_key: api_key,
61
+ query: query
62
+ )
63
+ puts " >>> Matches: #{search_results[:total]}"
64
+ r.puts search_results.to_json
65
+
66
+ search_results[:matches].select do |m|
67
+ f.puts "ORG: #{m[:org]} | PUBIP: #{m[:ip_str]} #{'*' * 36}"
68
+ f.puts "Product: #{m[:product]}"
69
+ f.puts "TCP Port: #{m[:port]}"
70
+ f.puts "Data: #{m[:data]}\n\n\n"
71
+ end
72
+ end
73
+ end
74
+ end
75
+ rescue SystemExit, Interrupt
76
+ puts "\nGoodbye."
77
+ end
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.4.470'
4
+ VERSION = '0.4.473'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.470
4
+ version: 0.4.473
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2022-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -1018,6 +1018,7 @@ executables:
1018
1018
  - pwn_serial_check_voicemail
1019
1019
  - pwn_serial_msr206
1020
1020
  - pwn_serial_qualcomm_commands
1021
+ - pwn_shodan_search
1021
1022
  - pwn_simple_http_server
1022
1023
  - pwn_web_cache_deception
1023
1024
  - pwn_www_checkip
@@ -1078,6 +1079,7 @@ files:
1078
1079
  - bin/pwn_serial_check_voicemail
1079
1080
  - bin/pwn_serial_msr206
1080
1081
  - bin/pwn_serial_qualcomm_commands
1082
+ - bin/pwn_shodan_search
1081
1083
  - bin/pwn_simple_http_server
1082
1084
  - bin/pwn_web_cache_deception
1083
1085
  - bin/pwn_www_checkip