File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed
Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 11# Script Name : check_file.py
2+
23# Author : Craig Richards
34# Created : 20 May 2013
45# Last Modified :
78# Modifications : with statement added to ensure correct file closure
89
910# Description : Check a file exists and that we can read the file
10-
1111from __future__ import print_function
1212import sys # Import the Modules
1313import os # Import the Modules
@@ -21,8 +21,8 @@ def usage():
2121# Readfile Functions which open the file that is passed to the script
2222def readfile (filename ):
2323 with open (filename , 'r' ) as f : # Ensure file is correctly closed under all circumstances
24- line = f .read ()
25- print (line )
24+ file = f .read ()
25+ print (file )
2626
2727def main ():
2828 if len (sys .argv ) >= 2 : # Check the arguments passed to the script
Original file line number Diff line number Diff line change @@ -37,5 +37,4 @@ def isSQLite3(filename):
3737 log .write ("[+] '%s' **** is a SQLITE database file **** " % files + '\n ' )
3838 else :
3939 log .write ("[-] '%s' is NOT a sqlite database file" % os .path .join (r ,files )+ '\n ' )
40- log .write ("[-] '%s' is NOT a sqlite database file" % files + '\n ' )
41-
40+ log .write ("[-] '%s' is NOT a sqlite database file" % files + '\n ' )
Original file line number Diff line number Diff line change 66# Modifications :
77
88# Description : Tests to see if the directory testdir exists, if not it will create the directory for you
9-
9+ from __future__ import print_function
1010import os #Import the OS Module
1111CheckDir = raw_input ("Enter the name of the directory to check : " )
1212print
1313if os .path .exists (CheckDir ):#Checks if the dir exists
14- print "The directory exists"
14+ print ( "The directory exists" )
1515else :
16- print "No directory found for " + CheckDir #Output if no directory
16+ print ( "No directory found for " + CheckDir ) #Output if no directory
1717 print
1818 os .makedirs (CheckDir )#Creates a new dir for the given name
19- print "Directory created for " + CheckDir
19+ print ( "Directory created for " + CheckDir )
Original file line number Diff line number Diff line change 1+ from __future__ import print_function
12import SimpleHTTPServer
23import SocketServer
34
78
89httpd = SocketServer .TCPServer (("" , PORT ), Handler )
910
10- print "serving at port" , PORT
11+ print ( "serving at port" , PORT )
1112httpd .serve_forever ()
You can’t perform that action at this time.
0 commit comments