Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13b424a

Browse files
committed
important bug fix and minor code restyling
1 parent b477c56 commit 13b424a

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

extra/shutils/regressiontest.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from lib.core.revision import getRevisionNumber
2222

23-
TIME = time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
23+
START_TIME = time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
2424
SQLMAP_HOME = "/opt/sqlmap"
2525
REVISION = getRevisionNumber()
2626

@@ -30,7 +30,7 @@
3030
3131
3232
33-
SUBJECT = "Regression test on %s using revision %s" % (TIME, REVISION)
33+
SUBJECT = "Regression test on %s using revision %s" % (START_TIME, REVISION)
3434

3535
def prepare_email(content):
3636
global FROM
@@ -71,16 +71,14 @@ def main():
7171
test_counts = []
7272
attachments = {}
7373

74-
proc = subprocess.Popen("cd /opt/sqlmap/ ; python /opt/sqlmap/sqlmap.py --update", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
75-
proc.wait()
76-
stdout, stderr = proc.communicate()
74+
updateproc = subprocess.Popen("cd /opt/sqlmap/ ; python /opt/sqlmap/sqlmap.py --update", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
75+
stdout, stderr = updateproc.communicate()
7776

7877
if stderr:
7978
failure_email("Update of sqlmap failed with error:\n\n%s" % stderr)
8079

81-
proc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
82-
proc.wait()
83-
stdout, stderr = proc.communicate()
80+
regressionproc = subprocess.Popen("python /opt/sqlmap/sqlmap.py --live-test", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
81+
stdout, stderr = regressionproc.communicate()
8482

8583
if stderr:
8684
failure_email("Execution of regression test failed with error:\n\n%s" % stderr)
@@ -149,12 +147,12 @@ def main():
149147

150148
if __name__ == "__main__":
151149
log_fd = open("/tmp/sqlmapregressiontest.log", "wb")
152-
log_fd.write("Regression test started at %s\n" % TIME)
150+
log_fd.write("Regression test started at %s\n" % START_TIME)
153151

154152
try:
155153
main()
156154
except Exception, e:
157155
log_fd.write("An exception has occurred:\n%s" % str(traceback.format_exc()))
158156

159-
log_fd.write("Regression test finished at %s\n\n" % TIME)
157+
log_fd.write("Regression test finished at %s\n\n" % time.strftime("%H:%M:%S %d-%m-%Y", time.gmtime())
160158
log_fd.close()

0 commit comments

Comments
 (0)