From e0fa4a54726cf1af3c947ec33d577742365ecbe1 Mon Sep 17 00:00:00 2001 From: maldevel Date: Sat, 14 Mar 2020 17:48:12 +0200 Subject: [PATCH] grep host,ports and services --- ...hosts-open-ports-and-services-to-matrix.sh | 30 +++++++++++++++++++ ...st-hosts-open-ports-and-services-to-txt.sh | 29 ++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 grep/grep-list-hosts-open-ports-and-services-to-matrix.sh create mode 100755 grep/grep-list-hosts-open-ports-and-services-to-txt.sh diff --git a/grep/grep-list-hosts-open-ports-and-services-to-matrix.sh b/grep/grep-list-hosts-open-ports-and-services-to-matrix.sh new file mode 100755 index 0000000..a9ae496 --- /dev/null +++ b/grep/grep-list-hosts-open-ports-and-services-to-matrix.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# This file is part of PenTestKit +# Copyright (C) 2017-2020 @maldevel +# https://github.com/maldevel/PenTestKit +# +# PenTestKit - Useful tools for Penetration Testing. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# For more see the file 'LICENSE' for copying permission. + +if [ $# -eq 1 ]; then + + egrep -v "^#|Status: Up" *.gnmap|cut -d' ' -f2,4-|sed 's/Ignored.*//g' |sed 's/ /_/'| sed 's/, /,/g'| awk -v FS=_ '{printf $1 ";" NF ";"; $1=""; for(i=2; i<=NF; i++){ a=a""$i; }; split(a,s,","); for(e in s) { split(s[e],v,"/"); printf "%s(%s)[%s],", v[1], v[5], v[7]}; a=""; printf "\n"; }' + +else + echo "Please provide a directory path." +fi diff --git a/grep/grep-list-hosts-open-ports-and-services-to-txt.sh b/grep/grep-list-hosts-open-ports-and-services-to-txt.sh new file mode 100755 index 0000000..db59eb8 --- /dev/null +++ b/grep/grep-list-hosts-open-ports-and-services-to-txt.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# This file is part of PenTestKit +# Copyright (C) 2017-2020 @maldevel +# https://github.com/maldevel/PenTestKit +# +# PenTestKit - Useful tools for Penetration Testing. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# For more see the file 'LICENSE' for copying permission. + +if [ $# -eq 1 ]; then + + egrep -v "^#|Status: Up" $1/*.gnmap|cut -d' ' -f2,4-|sed 's/Ignored.*//g' |sed 's/ /'$'_''/'|sed 's/, /,/g'| awk -v FS=_ '{printf "Host: " $1 "\nOpen ports: " NF "\n"; $1=""; for(i=2; i<=NF; i++){ a=a""$i; }; split(a,s,","); for(e in s) { split(s[e],v,"/"); printf "%-10s%-20s%s\n", v[1], v[5], v[7]}; a=""; printf "\n"; }' +else + echo "Please provide a directory path." +fi