forked from root/threadr.lostcave.ddnss.de
made variable grabbler more verbose
parent
d76179bad3
commit
53ea4b6053
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python2
|
||||||
|
|
||||||
print """
|
print """
|
||||||
Variable Grabbler - version 1.1
|
Variable Grabbler - version 1.4
|
||||||
-------------------------------"""
|
-------------------------------"""
|
||||||
|
|
||||||
# definitions
|
# definitions
|
||||||
|
@ -13,19 +13,21 @@ fext = "*.php"
|
||||||
print "Opening config file..."
|
print "Opening config file..."
|
||||||
config = open("variable_grabbler.cfg","r")
|
config = open("variable_grabbler.cfg","r")
|
||||||
parsed = json.load(config)
|
parsed = json.load(config)
|
||||||
|
config.close()
|
||||||
|
|
||||||
for x in parsed:
|
for x in parsed:
|
||||||
for path, dirs, files in os.walk(dir):
|
for path, dirs, files in os.walk(dir):
|
||||||
for fname in fnmatch.filter(files, fext):
|
for fname in fnmatch.filter(files, fext):
|
||||||
fpath = os.path.join(path, fname)
|
file_path = os.path.join(path, fname)
|
||||||
file_in = open(fpath, "r")
|
|
||||||
|
print "Working on file: "+file_path
|
||||||
|
|
||||||
|
file_in = open(file_path, "r")
|
||||||
file_content = file_in.read()
|
file_content = file_in.read()
|
||||||
file_in.close()
|
file_in.close()
|
||||||
|
|
||||||
file_content = file_content.decode('utf-8').replace("%" + x + "%", parsed[x]).encode('utf-8')
|
file_content = file_content.decode('utf-8').replace("%" + x + "%", parsed[x]).encode('utf-8')
|
||||||
|
|
||||||
file_out = open(fpath, "w")
|
file_out = open(file_path, "w")
|
||||||
file_out.write(file_content)
|
file_out.write(file_content)
|
||||||
file_out.close()
|
file_out.close()
|
||||||
|
|
||||||
config.close()
|
|
||||||
|
|
Loading…
Reference in New Issue