Advertisement
Guest User

aaeww

a guest
Jun 17th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import urllib
  2. import urllib2
  3. import hashlib
  4.  
  5. def mid(s, offset, amount):
  6.     return s[offset-1:offset+amount-1]
  7.  
  8. def find_str(s, char):
  9.     index = 0
  10.  
  11.     if char in s:
  12.         c = char[0]
  13.         for ch in s:
  14.             if ch == c:
  15.                 if s[index:index+len(char)] == char:
  16.                     return index
  17.  
  18.             index += 1
  19.  
  20.     return -1
  21.  
  22. def computeMD5hash(my_string):
  23.     m = hashlib.md5()
  24.     m.update(my_string.encode('utf-8'))
  25.     return m.hexdigest()
  26.  
  27. req = urllib2.Request("http://docker.hackthebox.eu:33843")
  28. res = urllib2.urlopen(req)
  29. data = res.read()
  30.  
  31. x = find_str(data, "<h3 align='center'>")
  32. y = find_str(data, "</h3><center>")
  33.  
  34. hashstr = mid(data, x+len("<h3 align='center'>")+1, y-(x+len("<h3 align='center'>")))
  35. print (hashstr+"\n")
  36. hashmd5 = computeMD5hash(hashstr)
  37. print (hashmd5)
  38.  
  39. data = urllib.urlencode({'hash' : hashmd5})
  40. content = urllib2.urlopen(url="http://docker.hackthebox.eu:33843", data=data).read()
  41.  
  42. print (content)
  43.  
  44. if (find_str(content, "Too slow") > 0):
  45.     print ("NOIS")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement