File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -33,22 +33,23 @@ def main():
33
33
if len (sys .argv ) >= 2 :
34
34
filenames = sys .argv [1 :]
35
35
36
+ filteredfilenames = list (filenames )
36
37
# Iterate for each filename passed in command line argument
37
38
for filename in filenames :
38
39
if not os .path .isfile (filename ): # Check the File exists
39
40
print ('[-] ' + filename + ' does not exist.' )
40
- filenames .remove (filename ) #remove non existing files from fileNames list
41
+ filteredfilenames .remove (filename ) #remove non existing files from fileNames list
41
42
continue
42
43
43
44
# Check you can read the file
44
45
if not os .access (filename , os .R_OK ):
45
46
print ('[-] ' + filename + ' access denied' )
46
47
# remove non readable fileNames
47
- filenames .remove (filename )
48
+ filteredfilenames .remove (filename )
48
49
continue
49
50
50
- # Read the content of each file
51
- for filename in filenames :
51
+ # Read the content of each file that both exists and is readable
52
+ for filename in filteredfilenames :
52
53
# Display Message and read the file contents
53
54
print ('[+] Reading from : ' + filename )
54
55
readfile (filename )
You can’t perform that action at this time.
0 commit comments