Skip to content

Commit d36822b

Browse files
committed
PWN::Plugins::NmapIt module - implement #diff_xml_results method
1 parent 1af07d5 commit d36822b

File tree

11 files changed

+43
-89
lines changed

11 files changed

+43
-89
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ gem 'nexpose', '7.3.0'
5151
gem 'nokogiri', '1.15.0'
5252
gem 'nokogiri-diff', '0.2.0'
5353
gem 'oily_png', '1.2.1'
54+
gem 'open3', '0.1.2'
5455
gem 'os', '1.1.4'
5556
gem 'packetfu', '1.1.13'
5657
gem 'pdf-reader', '2.11.0'

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.699]:001 >>> PWN.help
40+
pwn[v0.4.700]: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.699]:001 >>> PWN.help
55+
pwn[v0.4.700]:001 >>> PWN.help
5656
```
5757

5858

bin/pwn_diff_xml_files

Lines changed: 0 additions & 74 deletions
This file was deleted.

lib/pwn/plugins/nmap_it.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require 'nmap/command'
44
require 'nmap/xml'
5+
require 'open3'
56

67
module PWN
78
module Plugins
@@ -57,6 +58,29 @@ module NmapIt
5758
raise e
5859
end
5960

61+
# Supported Method Parameters::
62+
# PWN::Plugins::NmapIt.diff_xml_results(
63+
# xml_a: 'required - path to nmap xml results',
64+
# xml_b: 'required - path to nmap xml results',
65+
# diff: 'required - path to nmap xml results diff'
66+
# )
67+
public_class_method def self.diff_xml_results(opts = {})
68+
xml_a = opts[:xml_a].to_s.scrub.strip.chomp
69+
xml_b = opts[:xml_b].to_s.scrub.strip.chomp
70+
diff = opts[:diff].to_s.scrub.strip.chomp
71+
72+
stdout, _stderr, _status = Open3.capture3(
73+
'ndiff',
74+
'--xml',
75+
xml_a,
76+
xml_b
77+
)
78+
79+
File.write(diff, stdout)
80+
rescue StandardError => e
81+
raise e
82+
end
83+
6084
# Author(s):: 0day Inc. <[email protected]>
6185

6286
public_class_method def self.authors
@@ -98,6 +122,12 @@ module NmapIt
98122
end
99123
end
100124
125+
#{self}.diff_xml_results(
126+
xml_a: 'required - path to nmap xml results',
127+
xml_b: 'required - path to nmap xml results',
128+
diff: 'required - path to nmap xml results diff'
129+
)
130+
101131
#{self}.authors
102132
"
103133
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.699'
4+
VERSION = '0.4.700'
55
end

packer/kali_rolling_aws_ami.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"provisioners/apache2.sh",
106106
"provisioners/tor.sh",
107107
"provisioners/toggle_tor.sh",
108-
"provisioners/nmap_all_live_hosts.sh",
108+
"provisioners/nmap.sh",
109109
"provisioners/arachni.sh",
110110
"provisioners/eyewitness.sh",
111111
"provisioners/afl.sh",

packer/kali_rolling_qemu_kvm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"provisioners/apache2.sh",
110110
"provisioners/tor.sh",
111111
"provisioners/toggle_tor.sh",
112-
"provisioners/nmap_all_live_hosts.sh",
112+
"provisioners/nmap.sh",
113113
"provisioners/arachni.sh",
114114
"provisioners/eyewitness.sh",
115115
"provisioners/afl.sh",

packer/kali_rolling_virtualbox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"provisioners/apache2.sh",
137137
"provisioners/tor.sh",
138138
"provisioners/toggle_tor.sh",
139-
"provisioners/nmap_all_live_hosts.sh",
139+
"provisioners/nmap.sh",
140140
"provisioners/arachni.sh",
141141
"provisioners/eyewitness.sh",
142142
"provisioners/afl.sh",

packer/kali_rolling_vmware.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"provisioners/apache2.sh",
118118
"provisioners/tor.sh",
119119
"provisioners/toggle_tor.sh",
120-
"provisioners/nmap_all_live_hosts.sh",
120+
"provisioners/nmap.sh",
121121
"provisioners/arachni.sh",
122122
"provisioners/eyewitness.sh",
123123
"provisioners/afl.sh",

packer/provisioners/nmap.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
source /etc/profile.d/globals.sh
3+
4+
$screen_cmd "${apt} install -y nmap ncat ndiff ${assess_update_errors}"
5+
grok_error

0 commit comments

Comments
 (0)