File tree 4 files changed +10
-10
lines changed
4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1
1
# Script Name : check_file.py
2
+
2
3
# Author : Craig Richards
3
4
# Created : 20 May 2013
4
5
# Last Modified :
7
8
# Modifications : with statement added to ensure correct file closure
8
9
9
10
# Description : Check a file exists and that we can read the file
10
-
11
11
from __future__ import print_function
12
12
import sys # Import the Modules
13
13
import os # Import the Modules
@@ -21,8 +21,8 @@ def usage():
21
21
# Readfile Functions which open the file that is passed to the script
22
22
def readfile (filename ):
23
23
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 )
26
26
27
27
def main ():
28
28
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):
37
37
log .write ("[+] '%s' **** is a SQLITE database file **** " % files + '\n ' )
38
38
else :
39
39
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 6
6
# Modifications :
7
7
8
8
# 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
10
10
import os #Import the OS Module
11
11
CheckDir = raw_input ("Enter the name of the directory to check : " )
12
12
print
13
13
if os .path .exists (CheckDir ):#Checks if the dir exists
14
- print "The directory exists"
14
+ print ( "The directory exists" )
15
15
else :
16
- print "No directory found for " + CheckDir #Output if no directory
16
+ print ( "No directory found for " + CheckDir ) #Output if no directory
17
17
print
18
18
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
1
2
import SimpleHTTPServer
2
3
import SocketServer
3
4
7
8
8
9
httpd = SocketServer .TCPServer (("" , PORT ), Handler )
9
10
10
- print "serving at port" , PORT
11
+ print ( "serving at port" , PORT )
11
12
httpd .serve_forever ()
You can’t perform that action at this time.
0 commit comments