pwn 0.4.500 → 0.4.503

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: 1ddeb175b453fa39b85ee78df15d9e1d041a1e83b16b0fbb3ff12f40084a0e29
4
- data.tar.gz: c9a4bd815d7e80824d220ba4b36b81921866cec1c0bd449bb977e646ab1e4137
3
+ metadata.gz: b596bbfaab1c2c5442b6be7e46c63fa7b2d9b7c3daa370bc8cfdea68b7e0e039
4
+ data.tar.gz: 79137ee35bdb6a599eba227124da98567776d6dec5593f8b44681fa95f543f2f
5
5
  SHA512:
6
- metadata.gz: df0ab5450cafeb7e8f2af05a08f2c14170b5b9a0129d416d5e92db9ea0fa5e095278cc3abcdab2b4417b534e16a52a9be9877101871d18ce3abf591cab88d0ff
7
- data.tar.gz: 4849a551aa69d9774bbc798a2a3393987ac2a1eb527ff498ed50d653904cfb24edec414c037f49dd909bbc430cc3f6f2442095328c76fded221e82f3f8e7cc29
6
+ metadata.gz: ac749d01182f84dc41213be5d947d7f5ed18d4b35397ebebffe470a9f7cbd175d42d6b3e36f20274bac7565348659ceca01fa21af66af934d1cc4a79263e745e
7
+ data.tar.gz: 2cd0bbfe6ab55336a62a878b8b55c503f345c46c5cb2b7648fc39761d45b08f045c3ff4426cc6f734350ce5ef03988e08b7125d5e18e89f888f43434ab864eeb
@@ -0,0 +1,108 @@
1
+ e761590 Gemfile - include whois-parser gem
2
+ 9125ac9 Gemfile - include whois gem
3
+ 8e280b1 pwn_nessus_cloud_scan_crud Driver - add tags to assets #bugfix
4
+ 282d8b6 pwn_nessus_cloud_scan_crud Driver - add tags to assets #bugfix
5
+ e447047 pwn_nessus_cloud_scan_crud Driver - add tags to assets #bugfix
6
+ 15faf7b pwn_nessus_cloud_scan_crud Driver - add tags to assets
7
+ c468e7b pwn_nessus_cloud_scan_crud Driver - disable schedule by default
8
+ 45a5eb6 pwn_nessus_cloud_scan_crud Driver - timezone && starttime default to nil
9
+ 09fe8a6 pwn_nessus_cloud_scan_crud Driver - rrules default to FREQ=null
10
+ 3b4c6c2 pwn_nessus_cloud_scan_crud Driver - bugfix in UUID
11
+ e986c98 pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout #bugfix
12
+ 45113bc pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout #bugfix
13
+ 6c24858 pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout #bugfix
14
+ e4f9869 pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout #bugfix
15
+ b2a416c pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout
16
+ 13e7540 pwn_serial_son_micro_sm132_rfid Driver - slightly better output to stdout
17
+ a7efffd pwn_serial_son_micro_sm132_rfid Driver - initial commit
18
+ b8427fd pwn_serial_mar206 Driver - remove redundant edit card option in favor of load card from file
19
+ 41da7df PWN::Plugins::MSR206 module - slight #tweak to coercivity menu
20
+ 3281c7d PWN::Plugins::MSR206 module - begin supporting iso_alt and raw writing modes
21
+ 89fd44c PWN::Plugins::MSR206 module - support high and low coercivity writes in #write_card method
22
+ 6a58842 PWN::Plugins::MSR206 module - pretty print JSON data in backup file w/in #backup_card method
23
+ a9175b1 pwn_serial_msr206 Driver - working copy and load from file (i.e. write to card initial support)
24
+ e529993 pwn_serial_msr206 Driver - working copy and load from file (i.e. write to card initial support)
25
+ e0273b7 pwn_serial_msr206 Driver - implement alt ISO decoding and raw reading modes to support reading non-standard cards (e.g. metrocards)
26
+ b87c22e pwn_shodan_search - array of hashes in json output #tweak
27
+ e380835 pwn_shodan_search - array of hashes in json output
28
+ 1d8a0e8 pwn_shodan_search - bugfix in json output
29
+ c4e4fb9 pwn_shodan_search - intial working commit #bugfix
30
+ 17111dd pwn_shodan_search - intial working commit #bugfix
31
+ 8e1715a pwn_shodan_search - intial working commit
32
+ 38f3bd8 PWN::Plugins::Shodan module - symbolize key names in method responses
33
+ 045796f pwn_serial_msr206 Driver - Reserve yellow led for minor errors #bugfix
34
+ a051b7f pwn_serial_msr206 Driver - Reserve yellow led for minor errors
35
+ cf398ad pwn_serial_msr206 Driver - (B)ackup Card #working
36
+ 53256f4 pwn_serial_msr206 Driver - display configuration bits at start && bugfix with error handling
37
+ a56a1a2 pwn_serial_msr206 Driver - remove yellow_on debug output
38
+ 3dc8d41 pwn_serial_msr206 Driver - Working Card Read
39
+ 809e74b pwn_serial_msr206 Driver - Initial commit
40
+ 43755ab PWN::Plugins::BusPirate module - #bugfix in call to PWN::Plugins::Serial.request method
41
+ ccc167a PWN::Plugins::BusPirate module - #bugfix in call to PWN::Plugins::Serial.request method
42
+ c048f2c PWN::Plugins::Serial, PWN::Plugins::SonMicroRFID, & PWN::Plugins::MSR206 modules - cleanup some redudant methods, make requests over serial more reliable, and work towards better response output
43
+ f31caad PWN::Plugins::MSR206 module - more refinements
44
+ 4eb6060 PWN::Plugins::MSR206 module - implement #list_cmds && #exec methods #rubocop
45
+ 96de906 PWN::Plugins::MSR206 module - implement #list_cmds && #exec methods
46
+ 79fe42a PWN::Plugins::MSR206 module - initial non-working commit (redact msr gem in favor of 100% ruby native module)
47
+ 13b0e31 PWN::Plugins::MSR206 module - initial non-working commit
48
+ 15fb720 pwn_nessus_cloud_scan_crud && pwn_nessus_cloud_vulnscan Drivers - rename pwn_nessus_cloud_create_scan to reflect ability to create, read, update, & delete scans #bugfix
49
+ 68a92cc PWN::Plugins::NessusCloud module - implement HTTP PUT method in #nessus_cloud_rest_call
50
+ 267b389 pwn_nessus_cloud_scan_crud Driver - rename pwn_nessus_cloud_create_scan to reflect ability to create, read, update, & delete scans
51
+ 94bb346 pwn_nessus_cloud_create_scan Driver - add tag uuid to settinggs[:tag_targets] instead of tag name #bugfix
52
+ a33c3e0 pwn_nessus_cloud_create_scan Driver - add tag uuid to settinggs[:tag_targets] instead of tag name
53
+ d1ae4f6 pwn_nessus_cloud_create_scan Driver - add debugging to #get_tag_values call to understand condition required to trigger #create_tag method #bugfix
54
+ 2eb9500 pwn_nessus_cloud_create_scan Driver - add debugging to #get_tag_values call to understand condition required to trigger #create_tag method
55
+ f77a454 pwn_nessus_cloud_create_scan Driver - add debugging to #get_tag_values call to understand condition required to trigger #create_tag method
56
+ 486a5a2 PWN::Plugins::NessusCloud module - refactor #get_tags method #bugfix
57
+ a59ad8d PWN::Plugins::NessusCloud module - refactor #get_tags method #bugfix
58
+ 22c4559 PWN::Plugins::NessusCloud module - refactor #get_tags method #bugfix
59
+ 550779a PWN::Plugins::NessusCloud module - refactor #get_tags method #bugfix
60
+ f13218f PWN::Plugins::NessusCloud module - refactor #get_tags method
61
+ e9b1a1b pwn_nessus_cloud_create_scan Driver - add --tag-category-name feature #rubocop
62
+ 7e347e3 pwn_nessus_cloud_create_scan Driver - add --tag-category-name feature
63
+ 478ec25 pwn_nessus_cloud_create_scan Driver - add --tag-targets feature
64
+ a02f88b pwn_nessus_cloud_create_scan Driver - more code refinement
65
+ 1999189 pwn_nessus_cloud_create_scan Driver - more code refinement
66
+ 654c50d PWN::Plugins::NessusCloud module - #bugfix in #create_scan method
67
+ b752378 pwn_nessus_cloud_create_scan Driver - tag_targets_arr #bugfix
68
+ 7719f22 pwn_nessus_cloud_create_scan Driver - credentials key #bugfix
69
+ 906a607 pwn_nessus_cloud_create_scan Driver - migrate credentials && plugins objeects into YAML config since the structure is so diverse depending on the object used (e.g. Windows vs SSH vs etc.)
70
+ 3a6e477 pwn_nessus_cloud_create_scan Driver - closer to working commit
71
+ 3e264d8 pwn_nessus_cloud_create_scan Driver - get target network UUID for --target-network-name
72
+ 75b2d64 pwn_nessus_cloud_create_scan && pwn_nessus_cloud_vulscan Drivers - more additions and migrating certain logic to plugin in an effort to reduce code redundancy in drivers
73
+ 0cdc0ce pwn_nessus_cloud_create_scan Driver - more additions
74
+ cc95e2b pwn_nessus_cloud_create_scan Driver - add policy parameter
75
+ 2115eb3 pwn_nessus_cloud_create_scan Driver - add policy parameter
76
+ ac67b0f pwn_nessus_cloud_create_scan Driver - initial non-working commit #tweaks #bugfix
77
+ 84ac773 pwn_nessus_cloud_create_scan Driver - initial non-working commit #tweaks #rubocop_fixes
78
+ 8a841d8 pwn_nessus_cloud_create_scan Driver - initial non-working commit #tweaks
79
+ 3fd2f1b pwn_nessus_cloud_create_scan Driver - initial non-working commit #tweaks
80
+ 9119659 PWN::Plugins::NessusCloud - add #list_scan_templates method && pwn_nessus_cloud_create_scan Driver - initial non-working commit
81
+ a434c66 PWN::Plugins::CreditCard module - add #type method to aid in reversing weak generation methods used by some financial institutions #rubocop
82
+ 29fce17 PWN::Plugins::CreditCard module - add #type method to aid in reversing weak generation methods used by some financial institutions
83
+ a1f7bf1 PWN::Plugins::SerialPort module - fix missing method #wait_readable #bugfix
84
+ f4c91d6 pwn.gemspec - Specify requirements for only the minor Ruby version, not patch (i.e. 3.1.x)
85
+ baecc3b pwn.gemspec - Support ruby-3.1.2p20
86
+ 1e80a2b .ruby-version - Support ruby-3.1.2p20
87
+ bd770d0 .ruby-version - Support ruby-3.1.2p20
88
+ 68958e3 .ruby-version - Support ruby-3.1.2p20 - i.e. >= Preview 20
89
+ 947fbe3 PWN::VERSION - bump gem version
90
+ ac9387b PWN::SAST::Signature module - initial commit
91
+ 67e9cde Packer provisioners - include env when setting user var, PWN_PROVIDER #bugfix
92
+ 066da28 Packer provisioners - include env when setting user var, PWN_PROVIDER #bugfix
93
+ b1c87af *.sh in pwn repo root - bugfix in PWN_ROOT assignment when building within cloned ssrc
94
+ ab3eb54 *.sh in pwn repo root - bugfix in PWN_ROOT assignment when building within cloned ssrc
95
+ 31bfdb9 Packer & Vagrant - fix bug in PWN_ROOT assignment when generating /etc/profile.d/pwn_envs.sh AND redirect STDERR to /dev/null when assigining PWN_ROOT
96
+ 21db2bc Packer & Vagrant - fix bug in PWN_ROOT assignment when generating /etc/profile.d/pwn_envs.sh
97
+ 007dc4d Packer & Vagrant - fix bug in PWN_ROOT assignment when generating /etc/profile.d/pwn_envs.sh
98
+ 917a82b .ruby-version - address weird versioning issue
99
+ 41fa60e .ruby-version - Bump to 3.1.2 #rubocop_fixes
100
+ 5d51b69 .ruby-version - Bump to 3.1.2
101
+ a225371 PWN::SAST::* modules - fix NIST 800-53 links to show respective control desc for SAST module #bugfix
102
+ 321e5ea Packer && Vagrant - ensure PWN_ROOT reflects path of latest installed pwn gem
103
+ eb5e59d PWN::Banner::* - slight tweaks
104
+ 959941d Gemfile && PWN::Plugins::CreditCard - reinstate module w/ compatible version of credit_card_validations (i.e. 5.0.0)
105
+ 3133eb6 pwn REPL driver - implement welcome-banner command in REPL session to display example usage on demand
106
+ 831d253 PWN::SAST::HTTPAuthorizationHeader module - initial commit
107
+ 611bbf0 PWN::Plugins::RabbitMQHole to PWN::Plugins::RabbitMQ module - update rdoc to include port parameter
108
+ 87e1ef5 PWN REPL driver - regress colors back to ansi strings to avoid readline issues on prompt && rename PWN::Plugins::RabbitMQHole to PWN::Plugins::RabbitMQ and include a port parameter that can be passed to the #open method
data/Gemfile CHANGED
@@ -47,7 +47,7 @@ gem 'oily_png', '1.2.1'
47
47
  gem 'os', '1.1.4'
48
48
  gem 'packetfu', '1.1.13'
49
49
  gem 'pdf-reader', '2.10.0'
50
- gem 'pg', '1.3.5'
50
+ gem 'pg', '1.4.0'
51
51
  gem 'pry', '0.14.1'
52
52
  gem 'pry-doc', '1.3.0'
53
53
  gem 'rake', '13.0.6'
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.500]:001 >>> PWN.help
40
+ pwn[v0.4.503]: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.500]:001 >>> PWN.help
55
+ pwn[v0.4.503]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -91,11 +91,18 @@ begin
91
91
  # Record Call
92
92
  pid_to_kill = 0
93
93
  wav_file = "#{wav_archive}/#{target_num}-#{start_timestamp}.wav"
94
- sox_params = "-d #{wav_file} trim 0 #{seconds_to_record}"
95
94
 
96
95
  puts red
97
96
  puts "Recording Duration: #{seconds_to_record}s"
98
- system(sox_bin, sox_params)
97
+ system(
98
+ sox_bin,
99
+ '-d',
100
+ wav_file,
101
+ 'trim',
102
+ '0',
103
+ seconds_to_record.to_s
104
+ )
105
+
99
106
  puts 'Complete.'
100
107
  puts end_of_color
101
108
 
@@ -109,11 +116,27 @@ begin
109
116
 
110
117
  puts cayan
111
118
  puts 'Generating Audio Spectrogram...'
112
- sox_params = "#{wav_file} -n spectrogram -o #{wav_file}-spectrogram.png -d #{seconds_to_record}"
113
- system(sox_bin, sox_params)
119
+ system(
120
+ sox_bin,
121
+ wav_file,
122
+ '-n',
123
+ 'spectrogram',
124
+ '-o',
125
+ "#{wav_file}-spectrogram.png",
126
+ '-d',
127
+ seconds_to_record.to_s
128
+ )
129
+
114
130
  puts 'Generating Audio Waveform...'
115
- waveform_params = "-c '#FF0000' -b '#000000' -F #{wav_file} #{wav_file}-waveform.png"
116
- system(waveform_bin, waveform_params)
131
+ system(
132
+ waveform_bin,
133
+ '-c',
134
+ '#FF0000',
135
+ '-b',
136
+ '#000000',
137
+ '-F',
138
+ "#{wav_file} #{wav_file}-waveform.png"
139
+ )
117
140
  puts 'Complete.'
118
141
  puts end_of_color
119
142
 
data/bin/pwn_arachni CHANGED
@@ -117,14 +117,39 @@ begin
117
117
  end
118
118
 
119
119
  # Kick off scan as defined by pwn_arachni flags
120
- system("sudo /bin/bash --login -c \"#{arachni_cmd_str}\"")
120
+ system(
121
+ 'sudo',
122
+ '/bin/bash',
123
+ '--login',
124
+ '-c',
125
+ arachni_cmd_str
126
+ )
121
127
 
122
128
  # Report Scan Results
123
- system("sudo /bin/bash --login -c \"arachni_reporter #{output_dir}/arachni_results.afr --reporter=html:outfile=#{output_dir}/arachni_results.html.zip\"")
124
- system("sudo /bin/bash --login -c \"arachni_reporter #{output_dir}/arachni_results.afr --reporter=json:outfile=#{output_dir}/arachni_results.json\"")
129
+ system(
130
+ 'sudo',
131
+ '/bin/bash',
132
+ '--login',
133
+ '-c',
134
+ "arachni_reporter #{output_dir}/arachni_results.afr --reporter=html:outfile=#{output_dir}/arachni_results.html.zip"
135
+ )
136
+
137
+ system(
138
+ 'sudo',
139
+ '/bin/bash',
140
+ '--login',
141
+ '-c',
142
+ "arachni_reporter #{output_dir}/arachni_results.afr --reporter=json:outfile=#{output_dir}/arachni_results.json"
143
+ )
125
144
 
126
145
  # Unzip Results in Output Dir
127
- system("sudo /bin/bash --login -c \"cd #{output_dir} && unzip -o arachni_results.html.zip\"")
146
+ system(
147
+ 'sudo',
148
+ '/bin/bash',
149
+ '--login',
150
+ '-c',
151
+ "cd #{output_dir} && unzip -o arachni_results.html.zip"
152
+ )
128
153
  rescue StandardError, SystemExit, Interrupt => e
129
154
  raise e
130
155
  ensure
@@ -145,5 +145,12 @@ if start_reporting_server
145
145
  end
146
146
  puts "For Scan Results Navigate to: http://127.0.0.1:#{listen_port}/pwn_fuzz_net_app_proto.html"
147
147
  simple_http_server_params = "-i #{listen_ip} -p #{listen_port}"
148
- system("cd #{dir_path} && pwn_simple_http_server #{simple_http_server_params}")
148
+ Dir.chdir(dir_path)
149
+ system(
150
+ 'pwn_simple_http_server',
151
+ '-i',
152
+ listen_ip,
153
+ '-p',
154
+ listen_port.to_s
155
+ )
149
156
  end
@@ -218,7 +218,15 @@ unless nmap_path == ''
218
218
  # Eyewitness Nmap XML Results
219
219
  unless eyewitness_path == ''
220
220
  print "#{@green}Eyewitness Nmap XML Results...#{@end_of_color}"
221
- system("#{eyewitness_path} -x '#{nmap_xml_results}' -d '#{output_dir}/#{nmap_target}-#{@runtime_timestamp}' --no-prompt --all-protocols")
221
+ system(
222
+ eyewitness_path,
223
+ '-x',
224
+ nmap_xml_results,
225
+ '-d',
226
+ "#{output_dir}/#{nmap_target}-#{@runtime_timestamp}",
227
+ '--no-prompt',
228
+ '--all-protocols'
229
+ )
222
230
  end
223
231
 
224
232
  PWN::Plugins::NmapIt.parse_xml_results(xml_file: nmap_xml_results) do |xml|
data/bin/pwn_sast CHANGED
@@ -147,7 +147,7 @@ begin
147
147
 
148
148
  # Start Simple HTTP Server (If Requested)
149
149
  if start_reporting_server
150
- listen_port = Random.rand(1_025..65_535)
150
+ listen_port = Random.rand(1_025..65_535).to_s
151
151
 
152
152
  if pwn_provider == 'docker'
153
153
  listen_ip = '0.0.0.0'
@@ -156,7 +156,14 @@ begin
156
156
  end
157
157
 
158
158
  puts "For Scan Results Navigate to: http://127.0.0.1:#{listen_port}/pwn_scan_git_source.html"
159
- system("cd #{dir_path} && pwn_simple_http_server -i #{listen_ip} -p #{listen_port}")
159
+ Dir.chdir(dir_path)
160
+ system(
161
+ 'pwn_simple_http_server',
162
+ '-i',
163
+ listen_ip,
164
+ '-p',
165
+ listen_port
166
+ )
160
167
  end
161
168
  rescue SystemExit, Interrupt
162
169
  puts "\nGoodbye."
@@ -35,7 +35,17 @@ else
35
35
  end
36
36
 
37
37
  begin
38
- system("thin start --adapter file --address #{bind_ip} --port #{port} --threaded --debug")
38
+ system(
39
+ 'thin',
40
+ 'start',
41
+ '--adapter file',
42
+ '--address',
43
+ bind_ip,
44
+ '--port',
45
+ port.to_s,
46
+ '--threaded',
47
+ '--debug'
48
+ )
39
49
  rescue RuntimeError
40
50
  puts "WARNING: Service Already Listening on TCP #{port}..."
41
51
  port = Random.rand(1_025..65_535)
@@ -21,6 +21,9 @@ if (( $# == 3 )); then
21
21
  this_version=`ruby -r 'pwn' -e 'print PWN::VERSION'`
22
22
  echo "Tagging: ${this_version}"
23
23
  git tag $this_version
24
+ last_tag=$(git tag | tail -n 2 | head -n 1)
25
+ this_tag=$(git tag | tail -n 1)
26
+ git log $last_tag...$this_tag --oneline > CHANGELOG_BETWEEN_TAGS.txt
24
27
  fi
25
28
  else
26
29
  usage
@@ -8,7 +8,6 @@ module PWN
8
8
  module BusPirate
9
9
  # Supported Method Parameters::
10
10
  # PWN::Plugins::BusPirate.connect_via_screen(
11
- # screen_bin: 'optional - defaults to /usr/bin/screen'
12
11
  # block_dev: 'optional - serial block device path (defaults to /dev/ttyUSB0)'
13
12
  # )
14
13
 
@@ -17,19 +16,19 @@ module PWN
17
16
  opts[:block_dev].to_s
18
17
  )
19
18
 
20
- block_dev = '/dev/ttyUSB0' if opts[:block_dev].nil?
21
-
22
- if opts[:screen_bin].nil?
23
- screen_bin = '/usr/bin/screen'
24
- else
25
- screen_bin = opts[:screen_bin].to_s.strip.chomp.scrub
26
- end
19
+ block_dev ||= '/dev/ttyUSB0'
27
20
 
21
+ screen_bin = '/usr/bin/screen'
28
22
  raise "ERROR: #{screen_bin} not found." unless File.exist?(screen_bin)
29
23
 
30
- screen_params = "#{block_dev} 115200 8 N 1"
31
- screen_cmd = "#{screen_bin} #{screen_params}"
32
- system(screen_cmd)
24
+ system(
25
+ screen_bin,
26
+ block_dev,
27
+ '115200',
28
+ '8',
29
+ 'N',
30
+ '1'
31
+ )
33
32
  rescue StandardError => e
34
33
  raise e
35
34
  end
@@ -120,7 +119,6 @@ module PWN
120
119
  public_class_method def self.help
121
120
  puts "USAGE:
122
121
  #{self}.connect_via_screen(
123
- screen_bin: 'optional - defaults to /usr/bin/screen'
124
122
  block_dev: 'optional serial block device path (defaults to /dev/ttyUSB0)'
125
123
  )
126
124
 
@@ -0,0 +1,136 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module PWN
6
+ module Plugins
7
+ # This plugin is used for interacting w/ Github's REST API using
8
+ # the 'rest' browser type of PWN::Plugins::TransparentBrowser.
9
+ module Github
10
+ @@logger = PWN::Plugins::PWNLogger.create
11
+
12
+ # Supported Method Parameters::
13
+ # github_rest_call(
14
+ # http_method: 'optional HTTP method (defaults to GET)
15
+ # rest_call: 'required rest call to make per the schema',
16
+ # params: 'optional params passed in the URI or HTTP Headers',
17
+ # http_body: 'optional HTTP body sent in HTTP methods that support it e.g. POST'
18
+ # )
19
+
20
+ private_class_method def self.github_rest_call(opts = {})
21
+ http_method = if opts[:http_method].nil?
22
+ :get
23
+ else
24
+ opts[:http_method].to_s.scrub.to_sym
25
+ end
26
+ rest_call = opts[:rest_call].to_s.scrub
27
+ params = opts[:params]
28
+ http_body = opts[:http_body].to_s.scrub
29
+ base_gist_api_uri = 'https://api.github.com'
30
+
31
+ rest_client = PWN::Plugins::TransparentBrowser.open(browser_type: :rest)::Request
32
+
33
+ case http_method
34
+ when :get
35
+ response = rest_client.execute(
36
+ method: :get,
37
+ url: "#{base_gist_api_uri}/#{rest_call}",
38
+ headers: {
39
+ content_type: 'application/json; charset=UTF-8',
40
+ params: params
41
+ },
42
+ verify_ssl: false
43
+ )
44
+
45
+ when :post
46
+ response = rest_client.execute(
47
+ method: :post,
48
+ url: "#{base_gist_api_uri}/#{rest_call}",
49
+ headers: {
50
+ content_type: 'application/json; charset=UTF-8',
51
+ params: params
52
+ },
53
+ payload: http_body,
54
+ verify_ssl: false
55
+ )
56
+
57
+ else
58
+ raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
59
+ end
60
+
61
+ response
62
+ rescue RestClient::Forbidden
63
+ raise response
64
+ rescue RestClient::BadRequest, RestClient::NotFound, StandardError => e
65
+ raise
66
+ end
67
+
68
+ # Supported Method Parameters::
69
+ # response_json = PWN::Plugins::Github.download_all_gists(
70
+ # username: 'required - username of gists to backup',
71
+ # target_dir: 'required - target directory to save respective gists'
72
+ # )
73
+
74
+ public_class_method def self.download_all_gists(opts = {})
75
+ username = opts[:username].to_s.scrub
76
+ target_dir = opts[:target_dir].to_s.scrub
77
+
78
+ raise "ERROR: #{target_dir} Does Not Exist." unless Dir.exist?(target_dir)
79
+
80
+ params = {}
81
+ page = 1
82
+ response_json = [{}]
83
+ while response_json.any?
84
+ params[:page] = page
85
+ response_body = github_rest_call(
86
+ rest_call: "users/#{username}/gists",
87
+ params: params
88
+ ).body
89
+
90
+ Dir.chdir(target_dir)
91
+ response_json = JSON.parse(response_body, symbolize_names: true)
92
+ response_json.each do |gist_hash|
93
+ clone_dir = gist_hash[:id]
94
+ clone_uri = gist_hash[:git_pull_url]
95
+ next if Dir.exist?(clone_dir)
96
+
97
+ print "Cloning: #{clone_uri}..."
98
+ system(
99
+ 'git',
100
+ 'clone',
101
+ clone_uri
102
+ )
103
+ puts 'complete.'
104
+ end
105
+
106
+ page += 1
107
+ end
108
+
109
+ response_json
110
+ rescue StandardError => e
111
+ raise e
112
+ end
113
+
114
+ # Author(s):: 0day Inc. <request.pentest@0dayinc.com>
115
+
116
+ public_class_method def self.authors
117
+ "AUTHOR(S):
118
+ 0day Inc. <request.pentest@0dayinc.com>
119
+ "
120
+ end
121
+
122
+ # Display Usage for this Module
123
+
124
+ public_class_method def self.help
125
+ puts "USAGE:
126
+ response_json = #{self}.download_all_gists(
127
+ username: 'required - username of gists to download',
128
+ target_dir: 'required - target directory to save respective gists'
129
+ )
130
+
131
+ #{self}.authors
132
+ "
133
+ end
134
+ end
135
+ end
136
+ end
@@ -1107,31 +1107,73 @@ module PWN
1107
1107
  my_os = PWN::Plugins::DetectOS.type
1108
1108
  case my_os
1109
1109
  when :linux
1110
- ipfilter = 'sudo iptables'
1111
- chain_action = '-C'
1112
- ipfilter_rule = "OUTPUT --protocol tcp --source #{pkt.ip_saddr} --destination #{pkt.ip_daddr} --destination-port #{pkt.tcp_dst} --tcp-flags RST RST -j DROP"
1113
-
1114
- ipfilter_cmd = "#{ipfilter} #{chain_action} #{ipfilter_rule}"
1115
-
1116
- unless system(ipfilter_cmd, out: File::NULL, err: File::NULL)
1117
- chain_action = '-A'
1118
- ipfilter_cmd = "#{ipfilter} #{chain_action} #{ipfilter_rule}"
1119
-
1110
+ system_resp = system(
1111
+ 'sudo',
1112
+ 'iptables',
1113
+ '-C',
1114
+ 'OUTPUT',
1115
+ '--protocol',
1116
+ 'tcp',
1117
+ '--source',
1118
+ pkt.ip_saddr,
1119
+ '--destination',
1120
+ pkt.ip_daddr,
1121
+ '--destination-port',
1122
+ pkt.tcp_dst.to_s,
1123
+ '--tcp-flags',
1124
+ 'RST',
1125
+ 'RST',
1126
+ '-j',
1127
+ 'DROP',
1128
+ out: File::NULL,
1129
+ err: File::NULL
1130
+ )
1131
+
1132
+ unless system_resp
1120
1133
  puts 'Preventing kernel from misbehaving when manipulating packets.'
1121
- puts 'Creating the following iptables rule:'
1122
- puts ipfilter_cmd
1123
- system(ipfilter_cmd)
1124
-
1125
- puts "Be sure to delete iptables rule, once completed. Here's how:"
1126
- chain_action = '-D'
1127
- ipfilter_cmd = "#{ipfilter} #{chain_action} #{ipfilter_rule}"
1128
- puts ipfilter_cmd
1134
+ system(
1135
+ 'sudo',
1136
+ 'iptables',
1137
+ '-A',
1138
+ 'OUTPUT',
1139
+ '--protocol',
1140
+ 'tcp',
1141
+ '--source',
1142
+ pkt.ip_saddr,
1143
+ '--destination',
1144
+ pkt.ip_daddr,
1145
+ '--destination-port',
1146
+ pkt.tcp_dst.to_s,
1147
+ '--tcp-flags',
1148
+ 'RST',
1149
+ 'RST',
1150
+ '-j',
1151
+ 'DROP'
1152
+ )
1129
1153
  end
1130
1154
 
1131
1155
  pkt.recalc
1132
1156
  pkt.to_w(iface)
1133
1157
 
1134
- system(ipfilter, "-D #{ipfilter_rule}")
1158
+ system(
1159
+ 'sudo',
1160
+ 'iptables',
1161
+ '-D',
1162
+ 'OUTPUT',
1163
+ '--protocol',
1164
+ 'tcp',
1165
+ '--source',
1166
+ pkt.ip_saddr,
1167
+ '--destination',
1168
+ pkt.ip_daddr,
1169
+ '--destination-port',
1170
+ pkt.tcp_dst.to_s,
1171
+ '--tcp-flags',
1172
+ 'RST',
1173
+ 'RST',
1174
+ '-j',
1175
+ 'DROP'
1176
+ )
1135
1177
  # when :osx
1136
1178
  # ipfilter = 'pfctl'
1137
1179
  # ipfilter_rule = "block out proto tcp from #{pkt.ip_saddr} to #{pkt.ip_daddr} port #{pkt.tcp_dst} flags R"
@@ -7,7 +7,6 @@ module PWN
7
7
  module RFIDler
8
8
  # Supported Method Parameters::
9
9
  # PWN::Plugins::RFIDler.connect_via_screen(
10
- # screen_bin: 'optional - defaults to /usr/bin/screen'
11
10
  # block_dev: 'optional - serial block device path (defaults to /dev/ttyUSB0)'
12
11
  # )
13
12
 
@@ -17,18 +16,18 @@ module PWN
17
16
  )
18
17
 
19
18
  block_dev = '/dev/ttyUSB0' if opts[:block_dev].nil?
20
-
21
- if opts[:screen_bin].nil?
22
- screen_bin = '/usr/bin/screen'
23
- else
24
- screen_bin = opts[:screen_bin].to_s.strip.chomp.scrub
25
- end
19
+ screen_bin = '/usr/bin/screen'
26
20
 
27
21
  raise "ERROR: #{screen_bin} not found." unless File.exist?(screen_bin)
28
22
 
29
- screen_params = "#{block_dev} 9600 8 N 1"
30
- screen_cmd = "#{screen_bin} #{screen_params}"
31
- system(screen_cmd)
23
+ system(
24
+ screen_bin,
25
+ block_dev,
26
+ '9600',
27
+ '8',
28
+ 'N',
29
+ '1'
30
+ )
32
31
  rescue StandardError => e
33
32
  raise e
34
33
  end
@@ -46,7 +45,6 @@ module PWN
46
45
  public_class_method def self.help
47
46
  puts "USAGE:
48
47
  #{self}.connect_via_screen(
49
- screen_bin: 'optional - defaults to /usr/bin/screen'
50
48
  block_dev: 'optional serial block device path (defaults to /dev/ttyUSB0)'
51
49
  )
52
50
 
data/lib/pwn/plugins.rb CHANGED
@@ -25,6 +25,7 @@ module PWN
25
25
  autoload :FileFu, 'pwn/plugins/file_fu'
26
26
  autoload :Fuzz, 'pwn/plugins/fuzz'
27
27
  autoload :Git, 'pwn/plugins/git'
28
+ autoload :Github, 'pwn/plugins/github'
28
29
  autoload :HackerOne, 'pwn/plugins/hacker_one'
29
30
  autoload :IBMAppscan, 'pwn/plugins/ibm_appscan'
30
31
  autoload :IPInfo, 'pwn/plugins/ip_info'
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.500'
4
+ VERSION = '0.4.503'
5
5
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe PWN::Plugins::Github do
6
+ it 'should display information for authors' do
7
+ authors_response = PWN::Plugins::Github
8
+ expect(authors_response).to respond_to :authors
9
+ end
10
+
11
+ it 'should display information for existing help method' do
12
+ help_response = PWN::Plugins::Github
13
+ expect(help_response).to respond_to :help
14
+ end
15
+ 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.500
4
+ version: 0.4.503
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-16 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -506,14 +506,14 @@ dependencies:
506
506
  requirements:
507
507
  - - '='
508
508
  - !ruby/object:Gem::Version
509
- version: 1.3.5
509
+ version: 1.4.0
510
510
  type: :runtime
511
511
  prerelease: false
512
512
  version_requirements: !ruby/object:Gem::Requirement
513
513
  requirements:
514
514
  - - '='
515
515
  - !ruby/object:Gem::Version
516
- version: 1.3.5
516
+ version: 1.4.0
517
517
  - !ruby/object:Gem::Dependency
518
518
  name: pry
519
519
  requirement: !ruby/object:Gem::Requirement
@@ -1063,6 +1063,7 @@ files:
1063
1063
  - ".ruby-gemset"
1064
1064
  - ".ruby-version"
1065
1065
  - ".travis.yml"
1066
+ - CHANGELOG_BETWEEN_TAGS.txt
1066
1067
  - CODE_OF_CONDUCT.md
1067
1068
  - CONTRIBUTING.md
1068
1069
  - Gemfile
@@ -1557,6 +1558,7 @@ files:
1557
1558
  - lib/pwn/plugins/file_fu.rb
1558
1559
  - lib/pwn/plugins/fuzz.rb
1559
1560
  - lib/pwn/plugins/git.rb
1561
+ - lib/pwn/plugins/github.rb
1560
1562
  - lib/pwn/plugins/hacker_one.rb
1561
1563
  - lib/pwn/plugins/http_intercept_helper.rb
1562
1564
  - lib/pwn/plugins/ibm_appscan.rb
@@ -1855,6 +1857,7 @@ files:
1855
1857
  - spec/lib/pwn/plugins/file_fu_spec.rb
1856
1858
  - spec/lib/pwn/plugins/fuzz_spec.rb
1857
1859
  - spec/lib/pwn/plugins/git_spec.rb
1860
+ - spec/lib/pwn/plugins/github_spec.rb
1858
1861
  - spec/lib/pwn/plugins/hacker_one_spec.rb
1859
1862
  - spec/lib/pwn/plugins/ibm_appscan_spec.rb
1860
1863
  - spec/lib/pwn/plugins/ip_info_spec.rb