diff --git a/home/.dot/.bash_aliases b/home/.dot/.bash_aliases index 9f18e78..f1d5c5e 100644 --- a/home/.dot/.bash_aliases +++ b/home/.dot/.bash_aliases @@ -617,8 +617,11 @@ alias docker_rm_all_volumes='docker volume ls -q | xargs --no-run-if-empty docke # remove all orphaned docker volumes alias docker_rm_all_orphaned_volumes='docker volume ls -qf dangling=true | xargs --no-run-if-empty docker volume rm' - - + +#show all container with internal IP +alias docker_net_info='sudo docker ps -q | xargs -n 1 sudo docker inspect --format "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}} {{ .Name }}" | sed "s/ \// /"' + + ########################### # Docker Compose shortcuts ########################### @@ -807,4 +810,8 @@ alias nmap_scanNetwork="scanNetwork_nmap" alias scanNetwork_arp="arp -a" #Host-Discovery mit ARP-scan -alias scanNetwork_arpScan="arp-scan --localnet" \ No newline at end of file +alias scanNetwork_arpScan="arp-scan --localnet" + +#influx get infos about the hdd size per measurment +alas influx_hdd_measurment = "sudo influx_inspect report-disk -detailed /data/var/lib/influxdb/ " +alas influx_hdd_measurment_save = "sudo influx_inspect report-disk -detailed /data/var/lib/influxdb/ > data.json " diff --git a/home/.dot/.bash_functions.sh b/home/.dot/.bash_functions.sh index fa5bfa1..044a920 100644 --- a/home/.dot/.bash_functions.sh +++ b/home/.dot/.bash_functions.sh @@ -2885,6 +2885,59 @@ function portscan_parallel (){ time seq 65535 | parallel -k --joblog portscan -j9 --pipe --cat -j200% -n9000 --tagstring '\033[30;3{=$_=++$::color%8=}m' 'nc -vz localhost $(head -n1 {})-$(tail -n1 {})' } +function portsD() { + if ! command -v netstat &> /dev/null; then + echo "Error: netstat is not installed. Please install it using your package manager." + return 1 # Exit the function with an error code + fi + + # Define a list of ports to ignore + IGNORE_PORTS=(53) + + echo "Processing netstat output and appending program paths and working directories..." + + # Print header with fixed column widths + printf "%-22s %-25s %-45s %-s\n" "Local Address" "PID/Program Name" "Program Path" "Working Directory" + + # Run netstat command and process the output + sudo netstat -lnpt4e | while read -r line; do + # Skip the header line + if [[ "$line" == *"Proto Recv-Q Send-Q"* ]]; then + continue + fi + + # Only process lines where state is LISTEN + if [[ "$line" == *LISTEN* ]]; then + # Extract the port number from Local Address + local_addr=$(echo "$line" | awk '{print $4}') + port=$(echo "$local_addr" | awk -F: '{print $NF}') + + # Check if the port is in the ignore list + if [[ " ${IGNORE_PORTS[@]} " =~ " $port " ]]; then + continue + fi + + # Extract PID/Program Name + pid_prog=$(echo "$line" | awk '{print $9}') + + # Extract PID from PID/Program Name + pid=$(echo "$pid_prog" | cut -d'/' -f1) + program_path="Unknown" + working_dir="Unknown" + + # Retrieve the full path of the program using the PID + if [[ "$pid" =~ ^[0-9]+$ ]]; then + program_path=$(sudo readlink -f /proc/$pid/exe 2>/dev/null || echo "Unknown") + working_dir=$(sudo readlink -f /proc/$pid/cwd 2>/dev/null || echo "Unknown") + fi + + # Print formatted output with fixed column widths + printf "%-22s %-25s %-45s %-s\n" "$local_addr" "$pid_prog" "$program_path" "$working_dir" + fi + done +} + + #mural function corganwashere(){ tput setaf 1;tput rev;h=$(tput lines);w=$[$(tput cols)/6];c=$(seq -ws '_____|' $[$w+1]|tr -d "0-9");for a in $(seq $[$h/2]);do echo $c;echo ${c//|___/___|};done;tput cup 0;toilet -t -f bigmono12 "?Corganwashere";tput cup $h diff --git a/home/.profile b/home/.profile index c380b06..ba24659 100644 --- a/home/.profile +++ b/home/.profile @@ -19,4 +19,4 @@ fi #[ ! -s ~/.plesk_banner ] || . ~/.plesk_banner -export PATH="$HOME/.cargo/bin:$PATH" +. "$HOME/.cargo/env"