Browse Source

fixed encoding at shell

epsylon 9 months ago
parent
commit
9399ed0e53
6 changed files with 25 additions and 7 deletions
  1. 4 1
      core/crack.py
  2. 1 1
      core/curl.py
  3. 8 2
      core/main.py
  4. 4 1
      core/ocr.py
  5. 4 1
      mods/easy/easy_crack.py
  6. 4 1
      mods/easy/easy_ocr.py

+ 4 - 1
core/crack.py

@@ -127,7 +127,10 @@ class CIntruderCrack(object):
         words = {}
         for letter in letters:
             m = hashlib.md5()
-            m.update(str(letter))
+            try:
+                m.update(str(letter))
+            except:
+                m.update(str(letter).encode('utf-8'))
             im3 = im2.crop((letter[0], 0, letter[1], im2.size[1]))
             guess = []
             for image in imageset:

+ 1 - 1
core/curl.py

@@ -119,7 +119,7 @@ class CIntruderCurl(object):
             try:
                 errno, errstr = error
             except:
-                errno, errstr = "unknown!", "unknown!"
+                errno, errstr = "unknown!", "unknown!\n"
             print('\n[Error] Connection error... '+ str(errstr))
             return "exit"
  

+ 8 - 2
core/main.py

@@ -224,7 +224,10 @@ class cintruder():
         buf = self.optionCurl.request()
         if buf != "exit":
             m = hashlib.md5()
-            m.update(captcha.encode('utf-8')+str(datetime.datetime.now()))
+            try:
+                m.update(captcha.encode('utf-8')+str(datetime.datetime.now()))
+            except:
+                m.update(str(datetime.datetime.now()).encode('utf-8'))
             c = "%s.gif"%(m.hexdigest())
             h = "inputs/" + str(c)
             f = open(h, 'wb')
@@ -276,7 +279,10 @@ class cintruder():
                 print('-'*45)
             if buf != "exit":
                 m = hashlib.md5()
-                m.update(captcha.encode('utf-8')+str(datetime.datetime.now()))
+                try:
+                    m.update(captcha.encode('utf-8')+str(datetime.datetime.now()))
+                except:
+                    m.update(str(datetime.datetime.now()).encode('utf-8'))
                 h = "inputs/%s/%s.gif"%(self.domain, m.hexdigest())
                 f = open(h, 'wb')
                 f.write(buf.getvalue())

+ 4 - 1
core/ocr.py

@@ -112,7 +112,10 @@ class CIntruderOCR(object):
         count = 0
         for letter in letters:
             m = hashlib.md5()
-            m.update(str(letter))
+            try:
+                m.update(str(letter))
+            except:
+                m.update(str(letter).encode('utf-8'))
             im3 = im2.crop(( letter[0], 0, letter[1], im2.size[1] ))
             im3.save("outputs/words/%s.gif"%(m.hexdigest()))
             im3.save("core/images/previews/ocr/%s.gif"%(m.hexdigest()))

+ 4 - 1
mods/easy/easy_crack.py

@@ -122,7 +122,10 @@ class CIntruderCrack(object):
         words = {}
         for letter in letters:
             m = hashlib.md5()
-            m.update(str(letter))
+            try:
+                m.update(str(letter))
+            except:
+                m.update(str(letter).encode('utf-8'))
             im3 = im2.crop((letter[0], 0, letter[1], im2.size[1]))
             guess = []
             for image in imageset:

+ 4 - 1
mods/easy/easy_ocr.py

@@ -107,7 +107,10 @@ class CIntruderOCR(object):
         count = 0
         for letter in letters:
             m = hashlib.md5()
-            m.update(str(letter))
+            try:
+                m.update(str(letter))
+            except:
+                m.update(str(letter).encode('utf-8'))
             im3 = im2.crop(( letter[0], 0, letter[1], im2.size[1] ))
             im3.save("outputs/words/%s.gif"%(m.hexdigest()))
             im3.save("core/images/previews/ocr/%s.gif"%(m.hexdigest()))