SHARE
TWEET

aaeww

a guest Jun 17th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top