Skip to content

Commit

Permalink
Added print lock
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoardoVignati committed Feb 24, 2020
1 parent 8d0697d commit a6b1ad5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions response-thief.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
summary={}
maxUrl=0
lock = threading.Lock()
print_lock = threading.Lock()
filter_status=None


Expand Down Expand Up @@ -82,6 +83,7 @@ def counted(url, status):
done+=1
padding=(" " *(maxUrl-len(url)+27))

print_lock.acquire()
sys.stdout.write("Visited... " + str(("{:.2f}").format(round((done/total)*100,2))) + "%" + padding + "\r")
sys.stdout.flush()

Expand All @@ -101,6 +103,7 @@ def counted(url, status):
print("Visited " + colored(str(done) + "/" + str(total),"green") + " -> " + colored(url,"red") + padding)
else:
print("Visited " + colored(str(done) + "/" + str(total),"green") + " -> " + url + padding)
print_lock.release()
lock.release()
return done

Expand Down Expand Up @@ -199,6 +202,7 @@ def printSummary():
print("Output saved in '" + os.path.abspath(outputfile) + "'")



if __name__ == "__main__":

inputfile=None
Expand Down

0 comments on commit a6b1ad5

Please sign in to comment.