Jump to content

blaze1993

Member
  • Posts

    7
  • Joined

  • Last visited

Awards

This user doesn't have any awards

Recent Profile Visitors

224 profile views

blaze1993's Achievements

  1. Issue now fixed. Moved the done part of the loop to the bottom. Simple when I thought about it!
  2. Hi all Hoping someone can help. I am trying to automate an openvas scan. I have created an IP text file and I am trying to input this into the openvas cli. Each ip within the file is on a separate line and I need the command to be run on each IP on each line if that makes sense. My code is below; while read ip do echo "$ip" done < ip-test.txt TARGET_RETURN=$(omp -u admin -w admin -h 127.0.01 -p 9390 --xml="<create_target><name>tar$ip</name><hosts>$ip</hosts></create_target>") echo $TARGET_RETURN echo "$TARGET_RETURN" | grep -m1 'resource created' || exit 1 function sindex { x="${1%%$2*}" [[ $x = $1 ]] && echo -1 || echo ${#x} } T_ID_INDEX=$(sindex "$TARGET_RETURN" "id=") T_ID_INDEX=$((T_ID_INDEX + 4)) T_ID=${TARGET_RETURN:T_ID_INDEX:36} C_ID=$(omp -h 127.0.0.1 -p 9390 -u admin -w admin -g | grep -i "Full and fast") C_ID=${C_ID:0:36} echo "creating task" # Create task T_ID=$(omp -u admin -w admin -h 127.0.0.1 -p 9390 -C -n "$ip" --target="$T_ID" --config="$C_ID") echo "running task" # Start task R_ID=$(omp -u admin -w admin -h 127.0.0.1 -p 9390 -S "$T_ID") echo "generating report" F_ID=$(omp -u admin -w admin -h 127.0.0.1 -p 9390 -F | grep -i "HTML") F_ID=${F_ID:0:36} omp -u admin -w admin -h 127.0.0.1 -p 9390 -R "$R_ID" -f "$F_ID" > ./$ip-report.html
  3. Ahh I borrowed this and It now works o1=$(echo $ip | cut -d '.' -f4); o2=$(echo $ip | cut -d '.' -f3); o3=$(echo $ip | cut -d '.' -f2); o4=$(echo $ip | cut -d '.' -f1); echo "$o4.$o3.$o2.0" #This echos the ip address with the last character as a 0
  4. Thanks for the quick reply. Looking into this a bit more, it looks like you need to specify the ip address. Unless I am reading this wrong?
  5. Hi all I have been set with the task of creating an automated pen test box for work. Now the device needs to obtain the IP address range automatically and I am struggling on how I can achieve this without user input. The reason I need the IP range is so I can pump this to NMAP and Fping to check for live devices. Now I have used the following command to obtain the IP address from ifconfig /sbin/ifconfig $adapter | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'" Now when I run the above directly in a terminal I get the IP address only, however when I put this into a bash script , it shows be the following output : "192.168.0.39 Bcast" Below is my bash script #Varibles adapter="enp0s3" ipaddress="/sbin/ifconfig $adapter | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'" ip=$(eval $ipaddress) #Runs the command above echo $ip I also need this script to pull the broadcast address, which I am also struggling with. However when I obtain the IP address I need to change the last digit after the 3 dot to a 0. Im also hoping I can use a IF statement to translate the broadcast address to /24 for example Anyhelp would be appreciated!!
×