Changes to nmap scripts
This commit is contained in:
parent
459fe8cf6d
commit
4fd0c63515
3 changed files with 42 additions and 5 deletions
6
bin/.bin/nmap/nmap-clean
Executable file
6
bin/.bin/nmap/nmap-clean
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cat | grep -v 'host down' |\
|
||||||
|
grep -v Increa |\
|
||||||
|
grep -v Ignoring |\
|
||||||
|
grep -v '^#'
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cat | grep -v 'host down' |\
|
|
||||||
grep -v Increa |\
|
|
||||||
grep -v Ignoring |\
|
|
||||||
grep -v '^#' |\
|
|
||||||
awk -v RS="\n\n" -v ORS="\n\n" '{if ($0 ~ "'"$1"'" ) print $0}'
|
|
||||||
|
|
||||||
|
cat | awk -v RS="\n\n" -v ORS="\n" '{gsub("\n","§",$0); print $0}' | grep "$@" | sed 's/$/\n/' | sed 's/§/\n/g'
|
||||||
|
|
|
@ -38,6 +38,37 @@ function print_basic_info(){
|
||||||
#| [select(."@attributes".protocol)]
|
#| [select(."@attributes".protocol)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function print_with_match(){
|
||||||
|
local match=$1
|
||||||
|
echo $json | # Echo the full json file
|
||||||
|
jq ' if ( .host | type ) == "object" then [ .host ] else .host end ' | # Get the hosts as an array (even if there is only one
|
||||||
|
#jq '.[9]'
|
||||||
|
#jq '[ .[9] | {
|
||||||
|
# address: .address."@attributes".addr,
|
||||||
|
# domains: .hostnames.hostname."@attributes".name,
|
||||||
|
# port: {
|
||||||
|
# tcp : (try ( [ .ports.port[] | select( ."@attributes".protocol == "tcp" ) | select( .service."@attributes".name | test("'"$match"'; "i") ) | {
|
||||||
|
# port: ."@attributes".portid,
|
||||||
|
# service: .service."@attributes",
|
||||||
|
# } ] ) catch null ),
|
||||||
|
# udp : (try ( [ .ports.port[] | select( ."@attributes".protocol == "udp" ) | {
|
||||||
|
# port: ."@attributes".portid,
|
||||||
|
# service: .service."@attributes",
|
||||||
|
# } ] ) catch null )
|
||||||
|
# }
|
||||||
|
#} ]'
|
||||||
|
jq '[ .[9] | {
|
||||||
|
address: .address."@attributes".addr,
|
||||||
|
domains: .hostnames.hostname."@attributes".name,
|
||||||
|
port: {
|
||||||
|
tcp : [ .ports.port | {
|
||||||
|
port: .,
|
||||||
|
service: .service."@attributes",
|
||||||
|
} ],
|
||||||
|
}
|
||||||
|
} ]'
|
||||||
|
}
|
||||||
|
|
||||||
if [ -n "$1" ] ; then
|
if [ -n "$1" ] ; then
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
|
@ -48,5 +79,9 @@ if [ -n "$1" ] ; then
|
||||||
print_basic_info
|
print_basic_info
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
print_with_match "$@"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue