mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 13:55:25 +01:00 
			
		
		
		
	Fix problem when nmap file has .txt extension
This addresses a bug filed in #1935 in 3.1dev when the supplied file has a .txt extension. In this scenario the input file was nulled as from the input file in nmap format an internal input file was generated which has a .txt extension, in the same directory. The idea was to persist the file for the user. Now, this internal input file is ephemeral and only written to $TEMPDIR.
This commit is contained in:
		
							
								
								
									
										15
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -21368,17 +21368,12 @@ nmap_to_plain_file() { | ||||
|      else | ||||
|           fatal "Nmap file $FNAME is not in grep(p)able format (-oG filename.g(n)map)" $ERR_FNAMEPARSE | ||||
|      fi | ||||
|      # strip extension and create output file *.txt in same folder | ||||
|      # create ${FNAME%.*}.txt in $TEMPDIR | ||||
|      target_fname="${FNAME%.*}.txt" | ||||
|      > "${target_fname}" | ||||
|      if [[ $? -ne 0 ]]; then | ||||
|           # try to just create ${FNAME%.*}.txt in the same dir as the gnmap file failed. | ||||
|           # backup is using one in $TEMPDIR | ||||
|           target_fname="${target_fname##*\/}"     # strip path (Unix) | ||||
|           target_fname="${target_fname##*\\}"     # strip path (Dos) | ||||
|           target_fname="$TEMPDIR/$target_fname" | ||||
|           > "${target_fname}" || fatal "Cannot create \"${target_fname}\"" $ERR_FCREATE | ||||
|      fi | ||||
|      target_fname="${target_fname##*\/}"     # strip path (Unix) | ||||
|      target_fname="${target_fname##*\\}"     # strip path (Dos) | ||||
|      target_fname="$TEMPDIR/$target_fname" | ||||
|      > "${target_fname}" || fatal "Cannot create \"${target_fname}\"" $ERR_FCREATE | ||||
| 
 | ||||
|      # Line x:   "Host: AAA.BBB.CCC.DDD (<FQDN>) Status: Up" | ||||
|      # Line x+1: "Host: AAA.BBB.CCC.DDD (<FQDN>) Ports: 443/open/tcp//https///" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dirk
					Dirk