Advertisement
Guest User

append

a guest
Dec 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import os
  2.  
  3. path = "payload-list"
  4.  
  5. def isListExists(port):
  6. global path
  7. with open(path, "r") as f:
  8. files = f.readlines()
  9.  
  10. for fi in files:
  11. if port in fi.strip():
  12. return True
  13. else:
  14. return False
  15. return False
  16.  
  17. def appendList(port):
  18. global path
  19. if os.path.exists(path):
  20. if isListExists(port) == False:
  21. with open("payload-list", "a") as file:
  22. file.write("{}\n".format(port))
  23. else:
  24. createList()
  25. appendList(port)
  26. def createList():
  27. global path
  28. f = open(path, "w+")
  29. f.close()
  30.  
  31.  
  32. appendList("4445")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement