Skip to content

Commit 584a867

Browse files
authored
Merge pull request #271 from ninp0/master
pwn_diff_csv_files_w_column_exclude Driver - #more_bugfixes in producing actual diff CSV file
2 parents 4d4a72b + 58d287f commit 584a867

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
3737
$ rvm list gemsets
3838
$ gem install --verbose pwn
3939
$ pwn
40-
pwn[v0.4.686]:001 >>> PWN.help
40+
pwn[v0.4.688]:001 >>> PWN.help
4141
```
4242

4343
[![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.2.2@pwn
5252
$ gem uninstall --all --executables pwn
5353
$ gem install --verbose pwn
5454
$ pwn
55-
pwn[v0.4.686]:001 >>> PWN.help
55+
pwn[v0.4.688]:001 >>> PWN.help
5656
```
5757

5858

bin/pwn_diff_csv_files_w_column_exclude

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ def csv_diff(opts = {})
126126
# Write diff with redacted columns (to find differences we care about)
127127
CSV.open(diff_path, 'w', col_sep: ',', quote_char: '"', force_quotes: true) do |csv|
128128
larger_csv.each do |line_arr|
129-
csv.puts line_arr if smaller_csv.select { |sc| sc == line_arr }.empty?
129+
line = line_arr.join(',')
130+
csv.puts line_arr if smaller_csv.select { |sc| sc.join(',') == line }.empty?
130131
end
131132
end
132133
diff_csv = CSV.open(
@@ -138,17 +139,12 @@ def csv_diff(opts = {})
138139
).read
139140

140141
# Write diff again with all columns.
141-
csv_headers_orig = larger_csv_orig.first
142142
CSV.open(diff_path, 'w', col_sep: ',', quote_char: '"', force_quotes: true) do |csv|
143-
if no_headers
144-
larger_csv_orig.each_with_index do |line_arr, index|
145-
csv.puts line_arr if diff_csv.select { |dc| dc == larger_csv[index] }.any?
146-
end
147-
else
148-
csv.puts csv_headers_orig
149-
larger_csv_orig[1..-1].each_with_index do |line_arr, index|
150-
csv.puts line_arr if diff_csv.select { |dc| dc == larger_csv[index] }.any?
151-
end
143+
csv.puts larger_csv_orig.first unless no_headers
144+
larger_csv_orig.each_with_index do |line_arr, index|
145+
# Use larger_csv instead of orig to compare column redaction to diff_csv
146+
line = larger_csv[index].join(',')
147+
csv.puts line_arr if diff_csv.select { |dc| dc.join(',') == line }.any?
152148
end
153149
end
154150
end

lib/pwn/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module PWN
4-
VERSION = '0.4.686'
4+
VERSION = '0.4.688'
55
end

0 commit comments

Comments
 (0)