Guest User

Untitled

a guest
Aug 27th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. import json
  2. import requests
  3. import time
  4.  
  5.  
  6.  
  7. def loesung(url_chall_7, url_sol_7) -> object:
  8.  
  9.     def search(listoo, k):
  10.         for index1 in listoo:
  11.             set = index1
  12.             for index2 in listoo:
  13.                 if index2 == set:
  14.                   pass
  15.                 else:
  16.                     if set + index2 == k:
  17.                         v1 = listoo.index(set)
  18.                         v2 = listoo.index(index2)
  19.                         return [v1, v2] #match gefunden
  20.                     else:
  21.                          pass
  22.  
  23.  
  24.     roh = requests.get(url=url_chall_7)
  25.     json_roh = roh.json()
  26.     k = int(json_roh['k'])
  27.     lists: object = json_roh['list']
  28.  
  29.     solution = search(lists,k)
  30.  
  31.     dat = {"token": solution}
  32.  
  33.     result = requests.post(url=url_sol_7, data=json.dumps(dat))
  34.     print(result.text)  # success.ausgeben falls richtig
  35.  
  36.  
  37. #Main
  38. start = time.time()
  39. m = 100
  40. for i in range(m):
  41.     loesung("https://cc.the-morpheus.de/challenges/7/", "https://cc.the-morpheus.de/solutions/7/")
  42. print((time.time() - start) / m)
Advertisement
Add Comment
Please, Sign In to add comment