Source Code for network and port scanner, TRW algorithm, and reduction method implementations.

123456789101112131415161718192021222324252627282930313233343536373839
  1. # ratioHash = {}
  2. # sampleHash = {}
  3. #
  4. # sip = "sara"
  5. # posA = 'alexandra'
  6. #
  7. # connection = [1,1]
  8. #
  9. # print 10/5
  10. #
  11. # for i in range (0, 2):
  12. # if sip in ratioHash:
  13. # sampleHash[posA][0]+=connection[0]
  14. # sampleHash[posA][1]+= connection[1]
  15. # else:
  16. # sampleHash[posA] = [connection[0], connection[1]]
  17. # ratioHash[sip] = sampleHash
  18. # #print (posA
  19. #
  20. # print ratioHash
  21. #
  22. # import json
  23. # #PATH = '/Users/Sara/Documents/Univ Classes/Investigacion/Programas/newFlow.txt'
  24. # PATH = '/mnt/c/Users/Sara/Documents/Univ Classes/Investigacion/Programas/newFlow.txt'
  25. #
  26. # myFile = open(PATH, 'r')
  27. # ip = myFile.read()
  28. # flow = json.loads(ip)
  29. #
  30. # for i in flow['flows']:
  31. # flags = i["tcpflags"].split(",")
  32. # print flags[0]
  33. hashi = {}
  34. if 'hola' in hashi:
  35. hashi['hola'][0]+= 1
  36. else:
  37. hashi = {'hola': [0, 1]}
  38. print hashi['hola']