pwn 0.4.514 → 0.4.517

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +17 -11
  3. data/Gemfile +10 -9
  4. data/README.md +2 -2
  5. data/bin/pwn_fuzz_net_app_proto +4 -1
  6. data/bin/pwn_phone +124 -0
  7. data/bin/pwn_sast +7 -2
  8. data/lib/pwn/plugins/baresip.rb +632 -0
  9. data/lib/pwn/plugins/serial.rb +1 -1
  10. data/lib/pwn/plugins/sock.rb +32 -0
  11. data/lib/pwn/plugins/thread_pool.rb +19 -5
  12. data/lib/pwn/plugins.rb +1 -0
  13. data/lib/pwn/reports/phone.rb +294 -0
  14. data/lib/pwn/reports.rb +1 -0
  15. data/lib/pwn/sast/amqp_connect_as_guest.rb +1 -1
  16. data/lib/pwn/sast/apache_file_system_util_api.rb +1 -1
  17. data/lib/pwn/sast/aws.rb +1 -1
  18. data/lib/pwn/sast/banned_function_calls_c.rb +1 -1
  19. data/lib/pwn/sast/base64.rb +1 -1
  20. data/lib/pwn/sast/beef_hook.rb +5 -2
  21. data/lib/pwn/sast/cmd_execution_java.rb +1 -1
  22. data/lib/pwn/sast/cmd_execution_python.rb +1 -1
  23. data/lib/pwn/sast/cmd_execution_ruby.rb +1 -1
  24. data/lib/pwn/sast/cmd_execution_scala.rb +1 -1
  25. data/lib/pwn/sast/csrf.rb +3 -2
  26. data/lib/pwn/sast/deserial_java.rb +12 -2
  27. data/lib/pwn/sast/emoticon.rb +4 -1
  28. data/lib/pwn/sast/eval.rb +3 -2
  29. data/lib/pwn/sast/factory.rb +7 -2
  30. data/lib/pwn/sast/http_authorization_header.rb +1 -1
  31. data/lib/pwn/sast/inner_html.rb +4 -3
  32. data/lib/pwn/sast/keystore.rb +5 -2
  33. data/lib/pwn/sast/location_hash.rb +3 -2
  34. data/lib/pwn/sast/log4j.rb +1 -1
  35. data/lib/pwn/sast/logger.rb +1 -1
  36. data/lib/pwn/sast/outer_html.rb +3 -2
  37. data/lib/pwn/sast/password.rb +1 -1
  38. data/lib/pwn/sast/pom_version.rb +5 -2
  39. data/lib/pwn/sast/port.rb +1 -1
  40. data/lib/pwn/sast/private_key.rb +1 -1
  41. data/lib/pwn/sast/redirect.rb +1 -1
  42. data/lib/pwn/sast/redos.rb +1 -1
  43. data/lib/pwn/sast/shell.rb +1 -1
  44. data/lib/pwn/sast/signature.rb +1 -1
  45. data/lib/pwn/sast/sql.rb +1 -1
  46. data/lib/pwn/sast/ssl.rb +9 -2
  47. data/lib/pwn/sast/sudo.rb +1 -1
  48. data/lib/pwn/sast/task_tag.rb +1 -1
  49. data/lib/pwn/sast/throw_errors.rb +3 -2
  50. data/lib/pwn/sast/token.rb +7 -2
  51. data/lib/pwn/sast/version.rb +6 -2
  52. data/lib/pwn/sast/window_location_hash.rb +3 -2
  53. data/lib/pwn/version.rb +1 -1
  54. data/spec/lib/pwn/reports/phone_spec.rb +15 -0
  55. metadata +43 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6ef21821ecefa8074e3373780a936233ffa7bf83b0ce1b9db05d0b6cbf2553d
4
- data.tar.gz: 1f1133a5f30eec2a0281563c7f0566b039061f66934abf6226f9f17b96d658e5
3
+ metadata.gz: c8e3f58022b83a3829453c781e95a45ac2d388795c1b3916a4ecd02ba16da233
4
+ data.tar.gz: efe0ee32060320d6dcee8f93cd0f6cb450066634f7e573e8d839aca2bdabb29b
5
5
  SHA512:
6
- metadata.gz: 7de7ae8a8b6d03a7873996163d7661feefd60e8ca6fb7d05583859dd70f1a00f9bddec1848c82991ecf6c838dd97ca170c2f7b682a3b2f700db19e9b9657bfd3
7
- data.tar.gz: 54a965b58711de0e4df07880ca22d66e7296299ce478d9fe0b13615b71593a3e59b7a9b13d1e9ad977d6c5700570a660d4897dc8284dd723d32727ffc8ef4c54
6
+ metadata.gz: c10feee36edd3037ea8a1ca3edccb12ed8629d9f3c64c70eb429cf0706b14721bf6b6900d5ecf08eb231b51b58fc5dcd222a2c7cd5de65ce39367ae23996f5cb
7
+ data.tar.gz: cf61e7be071b16c3ec493bd293f096008cfe4d71b57c0b2d2d2084a649c699bdc9eb25b9266b7f036ec4daa41bce0f0bd6a3e84c6f37c0171f469e83ec98efed
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-07-08 17:25:42 UTC using RuboCop version 1.31.2.
3
+ # on 2022-07-28 21:42:33 UTC using RuboCop version 1.31.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -17,42 +17,48 @@ Layout/LineContinuationSpacing:
17
17
  - 'packer/provisioners/wpscan.rb'
18
18
  - 'vagrant/provisioners/beef.rb'
19
19
 
20
- # Offense count: 258
20
+ # Offense count: 1
21
+ # This cop supports unsafe autocorrection (--autocorrect-all).
22
+ Lint/NonAtomicFileOperation:
23
+ Exclude:
24
+ - 'lib/pwn/plugins/baresip.rb'
25
+
26
+ # Offense count: 264
21
27
  Lint/UselessAssignment:
22
28
  Enabled: false
23
29
 
24
- # Offense count: 260
30
+ # Offense count: 263
25
31
  # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
26
32
  Metrics/AbcSize:
27
33
  Max: 328
28
34
 
29
- # Offense count: 64
35
+ # Offense count: 66
30
36
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
31
37
  # IgnoredMethods: refine
32
38
  Metrics/BlockLength:
33
39
  Max: 196
34
40
 
35
- # Offense count: 45
41
+ # Offense count: 44
36
42
  # Configuration parameters: CountBlocks.
37
43
  Metrics/BlockNesting:
38
44
  Max: 5
39
45
 
40
- # Offense count: 91
46
+ # Offense count: 94
41
47
  # Configuration parameters: IgnoredMethods.
42
48
  Metrics/CyclomaticComplexity:
43
49
  Max: 231
44
50
 
45
- # Offense count: 472
51
+ # Offense count: 481
46
52
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
47
53
  Metrics/MethodLength:
48
54
  Max: 466
49
55
 
50
- # Offense count: 34
56
+ # Offense count: 44
51
57
  # Configuration parameters: CountComments, CountAsOne.
52
58
  Metrics/ModuleLength:
53
59
  Max: 1186
54
60
 
55
- # Offense count: 83
61
+ # Offense count: 86
56
62
  # Configuration parameters: IgnoredMethods.
57
63
  Metrics/PerceivedComplexity:
58
64
  Max: 51
@@ -81,12 +87,12 @@ Style/RedundantCondition:
81
87
  - 'bin/pwn_simple_http_server'
82
88
  - 'lib/pwn/plugins/packet.rb'
83
89
 
84
- # Offense count: 44
90
+ # Offense count: 43
85
91
  # This cop supports unsafe autocorrection (--autocorrect-all).
86
92
  Style/SlicingWithRange:
87
93
  Enabled: false
88
94
 
89
- # Offense count: 555
95
+ # Offense count: 564
90
96
  # This cop supports safe autocorrection (--autocorrect).
91
97
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
92
98
  # URISchemes: http, https
data/Gemfile CHANGED
@@ -18,13 +18,14 @@ gem 'aws-sdk', '3.1.0'
18
18
  gem 'bettercap', '1.6.2'
19
19
  gem 'brakeman', '5.2.3'
20
20
  gem 'bson', '4.15.0'
21
- gem 'bundler', '>=2.3.18'
21
+ gem 'bundler', '>=2.3.19'
22
22
  gem 'bundler-audit', '0.9.1'
23
23
  gem 'bunny', '2.19.0'
24
24
  gem 'colorize', '0.8.1'
25
25
  gem 'credit_card_validations', '5.0.0'
26
26
  gem 'eventmachine', '1.2.7'
27
27
  gem 'faye-websocket', '0.11.1'
28
+ gem 'fftw3', '0.3'
28
29
  gem 'gdb', '1.0.0'
29
30
  gem 'gist', '6.0.0'
30
31
  gem 'htmlentities', '4.3.4'
@@ -36,18 +37,18 @@ gem 'jsonpath', '1.1.2'
36
37
  gem 'jwt', '2.4.1'
37
38
  gem 'luhn', '1.0.2'
38
39
  gem 'mail', '2.7.1'
39
- gem 'mongo', '2.17.1'
40
+ gem 'mongo', '2.18.1'
40
41
  gem 'msfrpc-client', '1.1.2'
41
42
  gem 'net-ldap', '0.17.1'
42
43
  gem 'net-openvpn', '0.8.7'
43
44
  gem 'net-smtp', '0.3.1'
44
45
  gem 'nexpose', '7.3.0'
45
- gem 'nokogiri', '1.13.7'
46
+ gem 'nokogiri', '1.13.8'
46
47
  gem 'oily_png', '1.2.1'
47
48
  gem 'os', '1.1.4'
48
49
  gem 'packetfu', '1.1.13'
49
50
  gem 'pdf-reader', '2.10.0'
50
- gem 'pg', '1.4.1'
51
+ gem 'pg', '1.4.2'
51
52
  gem 'pry', '0.14.1'
52
53
  gem 'pry-doc', '1.3.0'
53
54
  gem 'rake', '13.0.6'
@@ -56,20 +57,20 @@ gem 'rbvmomi', '3.0.0'
56
57
  gem 'rdoc', '6.4.0'
57
58
  gem 'rest-client', '2.1.0'
58
59
  gem 'rex', '2.0.13'
59
- gem 'rmagick', '4.2.5'
60
+ gem 'rmagick', '4.2.6'
60
61
  gem 'rspec', '3.11.0'
61
62
  gem 'rtesseract', '3.1.2'
62
- gem 'rubocop', '1.31.2'
63
+ gem 'rubocop', '1.33.0'
63
64
  gem 'rubocop-rake', '0.6.0'
64
65
  gem 'rubocop-rspec', '2.12.1'
65
66
  gem 'ruby-audio', '1.6.1'
66
67
  gem 'ruby-nmap', '0.10.0'
67
68
  gem 'ruby-saml', '1.14.0'
68
69
  gem 'rvm', '1.11.3.9'
69
- gem 'savon', '2.12.1'
70
- gem 'selenium-devtools', '0.103.1'
70
+ gem 'savon', '2.13.0'
71
+ gem 'selenium-devtools', '0.104.0'
71
72
  gem 'serialport', '1.3.2'
72
- gem 'sinatra', '2.2.0'
73
+ gem 'sinatra', '2.2.2'
73
74
  gem 'slack-ruby-client', '1.1.0'
74
75
  gem 'socksify', '1.7.1'
75
76
  gem 'spreadsheet', '1.3.0'
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.514]:001 >>> PWN.help
40
+ pwn[v0.4.517]: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.514]:001 >>> PWN.help
55
+ pwn[v0.4.517]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -102,7 +102,10 @@ mutex = Mutex.new
102
102
  slice = max_threads * 3
103
103
  File.open(fuzz_file, "rb:#{char_encoding}") do |file|
104
104
  file.each_slice(slice) do |payload_batch_arr|
105
- PWN::Plugins::ThreadPool.fill(enumerable_array: payload_batch_arr, max_threads: max_threads) do |payload|
105
+ PWN::Plugins::ThreadPool.fill(
106
+ enumerable_array: payload_batch_arr,
107
+ max_threads: max_threads
108
+ ) do |payload|
106
109
  socket_fuzz_results_arr = PWN::Plugins::Fuzz.socket(
107
110
  target: target,
108
111
  port: port,
data/bin/pwn_phone ADDED
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pwn'
5
+ require 'optparse'
6
+ require 'fileutils'
7
+ require 'ruby-audio'
8
+ require 'fftw3'
9
+ require 'waveform'
10
+
11
+ opts = {}
12
+ OptionParser.new do |options|
13
+ options.banner = "USAGE:
14
+ #{$PROGRAM_NAME} [opts]
15
+ "
16
+
17
+ options.on('-tPATH', '--target-file=PATH', '<Required - File Containing List of Targets to Dial>') do |t|
18
+ opts[:target_file] = t
19
+ end
20
+
21
+ options.on('-sSEC', '--seconds-to-record=SEC', '<Optional - Seconds to Record (Defaults to 60)>') do |s|
22
+ opts[:seconds_to_record] = s
23
+ end
24
+
25
+ options.on('-TTHREADS', '--max-threads=THREADS', '<Optional # Calls to Run Simultaneously (Defaults to 3 - update "call_max_calls" in ~/.baresip/config if > 4)>') do |t|
26
+ opts[:max_threads] = t
27
+ end
28
+
29
+ options.on('-bPATH', '--baresip-binary=PATH', '<Optional - Path to baresip Binary (Defaults to /usr/bin/baresip)>') do |bs|
30
+ opts[:baresip_bin] = bs
31
+ end
32
+
33
+ options.on('-SSOX', '--sox-path=SOX', '<Optional - Path to SoX Binary, the Swiss Army knife of Audio (Defaults to /usr/bin/sox)>') do |sox|
34
+ opts[:sox_bin] = sox
35
+ end
36
+
37
+ options.on('-rDIR', '--session-root=DIR', '<Optional - Directory to Store Session Files (Defaults to Present Working Directory))>') do |sr|
38
+ opts[:session_root] = sr
39
+ end
40
+
41
+ options.on('-R', '--[no-]randomize', '<Optional - Randomize Number Range (Defaults to false)>') do |r|
42
+ opts[:randomize] = r
43
+ end
44
+
45
+ options.on('-h', '--[no-]start-reporting-server', '<Optional - Start Simple HTTP Server for Reporting>') do |s|
46
+ opts[:start_reporting_server] = s
47
+ end
48
+
49
+ options.on('-xRULES', '--source-num-rules=RULES', '<Optional - Comma-delimited list of rules for src_num format (i.e. self, same_country, same_area, and/or same_prefix [Defaults to random src_num w/ same length as target_num])>') do |x|
50
+ opts[:src_num_rules] = x
51
+ end
52
+
53
+ # TODO: Add an hours of operation flag.
54
+ # TODO: Add a resume feature to resume session following an interruption.
55
+ # TODO: Append results to pwn_phone_results.json as things are running #save_memory.
56
+ end.parse!
57
+
58
+ if opts.empty?
59
+ puts `#{$PROGRAM_NAME} --help`
60
+ exit 1
61
+ end
62
+
63
+ begin
64
+ pwn_provider = ENV.fetch('PWN_PROVIDER') if ENV.fetch('PWN_PROVIDER')
65
+ $stdout.sync = true
66
+
67
+ # Required Flag Variables
68
+ target_file = opts[:target_file]
69
+ max_threads = opts[:max_threads]
70
+ seconds_to_record = opts[:seconds_to_record]
71
+ baresip_bin = opts[:baresip_bin]
72
+ sox_bin = opts[:sox_bin]
73
+ session_root = opts[:session_root]
74
+ session_root ||= Dir.pwd
75
+
76
+ # Optional Flag Variables
77
+ randomize = opts[:randomize]
78
+ start_reporting_server = opts[:start_reporting_server]
79
+ src_num_rules = opts[:src_num_rules]
80
+
81
+ # Initiallize Phone Reconaissance
82
+ results_hash = PWN::Plugins::BareSIP.recon(
83
+ baresip_bin: baresip_bin,
84
+ session_root: session_root,
85
+ target_file: target_file,
86
+ randomize: randomize,
87
+ src_num_rules: src_num_rules,
88
+ seconds_to_record: seconds_to_record,
89
+ sox_bin: sox_bin
90
+ )
91
+
92
+ # Generate HTML Report
93
+ print "#{$PROGRAM_NAME} Generating Report..."
94
+ PWN::Reports::Phone.generate(
95
+ dir_path: session_root,
96
+ results_hash: results_hash
97
+ )
98
+ puts 'complete.'
99
+
100
+ # Start Simple HTTP Server (If Requested)
101
+ if start_reporting_server
102
+ listen_port = Random.rand(1_025..65_535).to_s
103
+
104
+ if pwn_provider == 'docker'
105
+ listen_ip = '0.0.0.0'
106
+ else
107
+ listen_ip = '127.0.0.1'
108
+ end
109
+
110
+ puts "For Scan Results Navigate to: http://127.0.0.1:#{listen_port}/pwn_phone.html"
111
+ Dir.chdir(session_root)
112
+ system(
113
+ 'pwn_simple_http_server',
114
+ '-i',
115
+ listen_ip,
116
+ '-p',
117
+ listen_port
118
+ )
119
+ end
120
+ rescue StandardError => e
121
+ raise e.message
122
+ rescue SystemExit, Interrupt
123
+ puts "\nGoodbye."
124
+ end
data/bin/pwn_sast CHANGED
@@ -49,7 +49,9 @@ begin
49
49
  green = "\e[32m"
50
50
  end_of_color = "\e[0m"
51
51
 
52
- dir_path = opts[:dir_path].to_s.scrub
52
+ dir_path = opts[:dir_path]
53
+ dir_path ||= '.'
54
+
53
55
  uri_source_root = opts[:uri_source_root].to_s.scrub
54
56
  max_threads = opts[:max_threads]
55
57
  chosen_test_cases = opts[:chosen_test_cases]
@@ -121,7 +123,10 @@ begin
121
123
 
122
124
  mutex = Mutex.new
123
125
 
124
- PWN::Plugins::ThreadPool.fill(enumerable_array: test_cases, max_threads: max_threads) do |test_case|
126
+ PWN::Plugins::ThreadPool.fill(
127
+ enumerable_array: test_cases,
128
+ max_threads: max_threads
129
+ ) do |test_case|
125
130
  sca_arr = PWN::SAST.const_get(
126
131
  test_case.to_s.scrub
127
132
  ).scan(