Skip to content

Commit c808fbd

Browse files
committed
check_file.py enhanced
1 parent cc6761d commit c808fbd

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

check_file.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Script Name : check_file.py
2+
23
# Author : Craig Richards
34
# Created : 20 May 2013
45
# Last Modified :
@@ -7,7 +8,6 @@
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-
1111
from __future__ import print_function
1212
import sys # Import the Modules
1313
import os # Import the Modules
@@ -21,8 +21,8 @@ def usage():
2121
# Readfile Functions which open the file that is passed to the script
2222
def 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

2727
def main():
2828
if len(sys.argv) >= 2: # Check the arguments passed to the script

check_for_sqlite_files.py

+1-2
Original file line numberDiff line numberDiff 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')

dir_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
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
1010
import os #Import the OS Module
1111
CheckDir = raw_input("Enter the name of the directory to check : ")
1212
print
1313
if os.path.exists(CheckDir):#Checks if the dir exists
14-
print "The directory exists"
14+
print("The directory exists")
1515
else:
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)

start-server.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import print_function
12
import SimpleHTTPServer
23
import SocketServer
34

@@ -7,5 +8,5 @@
78

89
httpd = SocketServer.TCPServer(("", PORT), Handler)
910

10-
print "serving at port", PORT
11+
print("serving at port", PORT)
1112
httpd.serve_forever()

0 commit comments

Comments
 (0)