Browse Source

release 0.3.1

psy 5 months ago
parent
commit
88cc450a0d
7 changed files with 98 additions and 20 deletions
  1. 7 3
      core/crack.py
  2. 15 2
      core/js/web.js
  3. 30 2
      core/main.py
  4. 8 5
      core/options.py
  5. 26 6
      core/webgui.py
  6. 7 0
      docs/CHANGELOG
  7. 5 2
      docs/README

+ 7 - 3
core/crack.py

@@ -3,7 +3,7 @@
 """
 This file is part of the cintruder project, http://cintruder.03c8.net
 
-Copyright (c) 2012/2016 psy <epsylon@riseup.net>
+Copyright (c) 2012/2019 psy <epsylon@riseup.net>
 
 cintruder is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -89,11 +89,15 @@ class CIntruderCrack(object):
             print "\nError during cracking!. Is that captcha supported?\n"
             return
         temp = {}
+        try:
+            setids = int(options.setids)
+        except:
+            setids = 3 # default pixel colour id
         for x in range(im.size[1]):
             for y in range(im.size[0]):
                 pix = im.getpixel((y, x))
                 temp[pix] = pix
-                if pix == 3: # pixel colour id 
+                if pix == setids: # pixel colour id 
                     im2.putpixel((y, x), 0)
         inletter = False
         foundletter = False
@@ -103,7 +107,7 @@ class CIntruderCrack(object):
         for y in range(im2.size[0]): # slice across
             for x in range(im2.size[1]): # slice down
                 pix = im2.getpixel((y, x))
-                if pix != 255:
+                if pix == 0: # != 255
                     inletter = True
             if foundletter == False and inletter == True:
                 foundletter = True

+ 15 - 2
core/js/web.js

@@ -1,7 +1,7 @@
 /*
 This file is part of the cintruder project, http://cintruder.03c8.net
 
-Copyright (c) 2012/2016 psy <epsylon@riseup.net>
+Copyright (c) 2012/2019 psy <epsylon@riseup.net>
 
 cintruder is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -131,6 +131,13 @@ function SetColourID() {
         document.getElementById("set_id").value ='';
         document.getElementById('ifMod_colour').style.display = 'none';
    }
+   if((document.getElementById('set_colour_id3').checked == true)) {
+        document.getElementById('ifMod_colour2').style.display = 'block';
+   }
+   else{
+        document.getElementById("set_id3").value ='';
+        document.getElementById('ifMod_colour2').style.display = 'none';
+   }
 }
 function SetCrackModule() {
    if((document.getElementById('set_module_crack').checked == true)) {
@@ -267,6 +274,12 @@ function CrackCaptchas(){
         }else {
          verbose="off";
         }
+        if(document.getElementById("set_colour_id3").checked)
+        {
+         colourID=document.getElementById("set_id3").value;
+        }else {
+         colourID="off";
+        }
         source_file=document.getElementById("SourceFile2").value;
         crack_url=document.getElementById("crack_url").value;
         if((source_file == "") && (crack_url == "")){
@@ -276,7 +289,7 @@ function CrackCaptchas(){
         if(source_file==""){
         source_file="off"
         }
-        params="crack_url="+escape(crack_url)+"&source_file="+escape(source_file)+"&module="+escape(module)+"&tor="+escape(tor)+"&verbose="+escape(verbose)+"&xml="+escape(xml);
+        params="crack_url="+escape(crack_url)+"&source_file="+escape(source_file)+"&colourID="+escape(colourID)+"&module="+escape(module)+"&tor="+escape(tor)+"&verbose="+escape(verbose)+"&xml="+escape(xml);
          }
          runCommandX("cmd_crack",params);
          if(source_file=="off"){

+ 30 - 2
core/main.py

@@ -3,7 +3,7 @@
 """
 This file is part of the cintruder project, http://cintruder.03c8.net
 
-Copyright (c) 2012/2016 psy <epsylon@riseup.net>
+Copyright (c) 2012/2019 psy <epsylon@riseup.net>
 
 cintruder is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -334,7 +334,35 @@ class cintruder():
                             subprocess.call("cat %s/%s"%(root, name), shell=True)
 
             print "\n[Info] List end...\n"
-            return #sys.exit(2)    
+            return
+        if options.track_list:
+            print "=============================="
+            print "Listing last tracked captchas:"
+            print "==============================\n"
+            top = 'inputs/'
+            tracked_captchas = []
+            for root, dirs, files in os.walk(top, topdown=False):
+                for name in files:
+                    path = os.path.relpath(os.path.join(root, name))
+                    if self.os_sys == "Windows": #check for win32 sys
+                        atime = os.path.getatime(path)
+                    else:
+                        date = os.stat(path)
+                        atime = time.ctime(date.st_atime)
+                    tracked_captchas.append([atime,str(" + "+name),str("   |-> "+path)])
+            tracked_captchas=sorted(tracked_captchas,key=lambda x:x[0]) # sorted by accessed time
+            ca = 0 # to control max number of results
+            for t in tracked_captchas:
+                ca = ca + 1
+                print "-------------------------"
+                for c in t:
+                    if ca < 26:
+                        print c
+                    else:
+                        break
+                print "-------------------------"
+            print "\n[Info] List end...\n"
+            return 
         captchas = self.try_running(self.get_attack_captchas, "\nInternal error getting -captchas-. look at the end of this Traceback.")
         captchas = self.sanitize_captchas(captchas)
         captchas2track = captchas

+ 8 - 5
core/options.py

@@ -3,7 +3,7 @@
 """
 This file is part of the cintruder project, http://cintruder.03c8.net
 
-Copyright (c) 2012/2016 psy <epsylon@riseup.net>
+Copyright (c) 2012/2019 psy <epsylon@riseup.net>
 
 cintruder is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -25,7 +25,7 @@ class CIntruderOptions(optparse.OptionParser):
         optparse.OptionParser.__init__(self, 
                            description='Captcha Intruder - OCR Bruteforcing Toolkit - by psy',
                            prog='cintruder.py',
-			   version='\nCIntruder v0.3 - 2016 - (GPLv3.0) -> by psy\n',
+			   version='\nCIntruder v0.3.1 - 2019 - (GPLv3.0) -> by psy\n',
                            usage= '\n\ncintruder [OPTIONS]')
         self.add_option("-v", "--verbose", action="store_true", dest="verbose", help="active verbose mode output results")
         self.add_option("--proxy", action="store", dest="proxy", help="use proxy server (tor: http://localhost:8118)")
@@ -34,17 +34,20 @@ class CIntruderOptions(optparse.OptionParser):
         group1 = optparse.OptionGroup(self, "->Tracking")
         group1.add_option("--track", action="store", dest="track", help="download captchas from url (to: 'inputs/')")
         group1.add_option("--track-num", action="store", dest="s_num", help="set number of captchas to download (default: 5)")
+        group1.add_option("--tracked-list", action="store_true", dest="track_list", help="list tracked captchas (from: 'inputs/')")
         self.add_option_group(group1)
+        group6 = optparse.OptionGroup(self, "->Configuration (training/cracking)")
+        group6.add_option("--set-id", action="store", dest="setids", help="set colour's ID manually (use -v for details)")
+        self.add_option_group(group6)
         group2 = optparse.OptionGroup(self, "->Training")
         group2.add_option("--train", action="store", dest="train", help="train using common OCR techniques")
-        group2.add_option("--set-id", action="store", dest="setids", help="set colour's ID manually (use -v for details)")
         self.add_option_group(group2)
         group3 = optparse.OptionGroup(self, "->Cracking")
         group3.add_option("--crack", action="store", dest="crack", help="brute force using local dictionary")
         self.add_option_group(group3)
         group4 = optparse.OptionGroup(self, "->Modules (training/cracking)")
-        group4.add_option("--list", action="store_true", dest="listmods", help="list available modules (from: 'mods/')")
         group4.add_option("--mod", action="store", dest="name", help="set a specific OCR exploiting module")
+        group4.add_option("--mods-list", action="store_true", dest="listmods", help="list available modules (from: 'mods/')")
         self.add_option_group(group4)
         group5 = optparse.OptionGroup(self, "->Post-Exploitation (cracking)")
         group5.add_option("--xml", action="store", dest="xml", help="export result to xml format")
@@ -54,7 +57,7 @@ class CIntruderOptions(optparse.OptionParser):
     def get_options(self, user_args=None):
         (options, args) = self.parse_args(user_args)
         options.args = args
-        if (not options.train and not options.crack and not options.track and not options.listmods and not options.web and not options.update):
+        if (not options.train and not options.crack and not options.track and not options.track_list and not options.listmods and not options.web and not options.update):
             print '='*75
             print ""
             print "        o8%8888,    "

+ 26 - 6
core/webgui.py

@@ -3,7 +3,7 @@
 """
 This file is part of the cintruder project, http://cintruder.03c8.net
 
-Copyright (c) 2012/2016 psy <epsylon@riseup.net>
+Copyright (c) 2012/2019 psy <epsylon@riseup.net>
 
 cintruder is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -109,7 +109,6 @@ Crack: <input type="radio" onclick="javascript:OptionsCheck();" name="options" i
 </center>
 </td>
    <td><center>
-
 <div id="ifTrack" style="display:none">
 <table border="1" cellpadding="10" cellspacing="5">
 <tr>
@@ -120,13 +119,13 @@ Crack: <input type="radio" onclick="javascript:OptionsCheck();" name="options" i
  <td><center><input type="submit" value="Download!" onclick="TrackCaptchas()"></center></td>
 </tr></table>
 </div>
-
 <div id="ifTrain" style="display:none">
 <table border="1" cellpadding="5" cellspacing="5">
 <tr>
  <td><center>
 LOCAL: <input type="radio" onclick="javascript:TrainSourcesCheck();" name="training_sources" id="training_local"/ CHECKED>
 URL: <input type="radio" onclick="javascript:TrainSourcesCheck();" name="training_sources" id="training_url"/>
+ <br><br><a href='javascript:runCommandX("cmd_tracklist");javascript:showResults()'>List Last Tracked</a><br><br>
 </center></td>
 <td>
 <div id="ifLocal" style="display:none">
@@ -181,13 +180,13 @@ URL: <input type="radio" onclick="javascript:TrainSourcesCheck();" name="trainin
 </tr>
 </table>
 </div>
-
 <div id="ifCrack" style="display:none">
 <table border="1" cellpadding="5" cellspacing="5">
 <tr>
  <td><center>
 LOCAL: <input type="radio" onclick="javascript:CrackingCheck();" name="cracking_sources" id="cracking_local"/ CHECKED>
 URL: <input type="radio" onclick="javascript:CrackingCheck();" name="cracking_sources" id="cracking_url"/>
+ <br><br><a href='javascript:runCommandX("cmd_tracklist");javascript:showResults()'>List Last Tracked</a><br><br>
 </center></td>
 <td>
 <div id="ifCrackLocal" style="display:none">
@@ -230,6 +229,17 @@ URL: <input type="radio" onclick="javascript:CrackingCheck();" name="cracking_so
  </td>
 </tr>
 <tr>
+<td align="right">Advanced OCR: <input type="checkbox" onclick="javascript:SetColourID();" name="set_colour_id3" id="set_colour_id3"></td>
+ <td align="center">
+<div id="ifMod_colour2" style="display:none">
+<table cellpadding="5" cellspacing="5">
+<tr>
+ <td>Set Colour ID: <input type="text" name="set_id3" id="set_id3" size="2" placeholder="Ex: 1"></td>
+</tr></table>
+</div>
+</td>
+</tr>
+<tr>
 <td align="right">Export to XML: <input type="checkbox" onclick="javascript:SetXML();" name="set_xml" id="set_xml"></td>
  <td align="center">
 <div id="ifMod_xml" style="display:none">
@@ -358,7 +368,7 @@ function runCommandX(cmd,params) {
                                 if(newcmd=="cmd_remove_ocr" || newcmd=="cmd_move_ocr" || newcmd=="cmd_dict"){ //do not refresh
                                     return;
                                 } else {
-                                if(newcmd=="cmd_list" || newcmd=="cmd_track" || newcmd=="cmd_crack" || newcmd=="cmd_train") newcmd=newcmd+"_update"
+                                if(newcmd=="cmd_list" || newcmd=="cmd_track" || newcmd == "cmd_tracklist" || newcmd=="cmd_crack" || newcmd=="cmd_train") newcmd=newcmd+"_update"
 								//do not refresh if certain text on response is found
 								if(newcmd.match(/update/) && 
 			 					(
@@ -473,7 +483,7 @@ function runCommandX(cmd,params) {
                     pass
         if page == "/cmd_list": # list mods
             self.pages["/cmd_list"] = "<pre>Waiting for a list of available modules...</pre>"
-            runcmd = "(python -i cintruder --list "+ "|tee /tmp/out) &"
+            runcmd = "(python -i cintruder --mods-list "+ "|tee /tmp/out) &"
         if page == "/cmd_list_update":
             if not os.path.exists('/tmp/out'):
                 open('/tmp/out', 'w').close()
@@ -491,6 +501,14 @@ function runCommandX(cmd,params) {
                 open('/tmp/out', 'w').close()
             with open('/tmp/out', 'r') as f:
                 self.pages["/cmd_track_update"] = "<pre>"+f.read()+"<pre>"
+        if page == "/cmd_tracklist": # list last tracks
+            self.pages["/cmd_tracklist"] = "<pre>Waiting for a list of last tracks...</pre>"
+            runcmd = "(python -i cintruder --tracked-list "+ "|tee /tmp/out) &"
+        if page == "/cmd_tracklist_update":
+            if not os.path.exists('/tmp/out'):
+                open('/tmp/out', 'w').close()
+            with open('/tmp/out', 'r') as f:
+                self.pages["/cmd_tracklist_update"] = "<pre>"+f.read()+"<pre>"
         if page == "/cmd_train": # training
             self.pages["/cmd_train"] = "<pre>Waiting for training results...</pre>"
             if pGet["tor"]=="on": 
@@ -517,6 +535,8 @@ function runCommandX(cmd,params) {
                 cmd_options = cmd_options + "--proxy 'http://localhost:8118' "
             if pGet["verbose"]=="on":
                 cmd_options = cmd_options + "--verbose "
+            if not pGet["colourID"]=="off":
+                cmd_options = cmd_options + "--set-id='" + pGet["colourID"] + "' "
             if not pGet["module"]=="off":
                 cmd_options = cmd_options + "--mod='" + pGet["module"] + "' "
             if not pGet["xml"]=="off":

+ 7 - 0
docs/CHANGELOG

@@ -3,6 +3,13 @@ Changelog: CIntruder v0.3 (cintruder.03c8.net)
 ==============================
 
 ===================
+January 17, 2019:
+===================
+
+- Added list of last tracked captchas
+- Added SetColourID to cracking options
+
+===================
 December 23, 2016:
 ===================
 

+ 5 - 2
docs/README

@@ -21,17 +21,20 @@ Options:
   ->Tracking:
     --track=TRACK      download captchas from url (to: 'inputs/')
     --track-num=S_NUM  set number of captchas to download (default: 5)
+    --tracked-list     list last tracked captchas (from: 'inputs/')
+
+  ->Configuration (training/cracking):
+    --set-id=SETIDS    set colour's ID manually (use -v for details)
 
   ->Training:
     --train=TRAIN      train using common OCR techniques
-    --set-id=SETIDS    set colour's ID manually (use -v for details)
 
   ->Cracking:
     --crack=CRACK      brute force using local dictionary
 
   ->Modules (training/cracking):
-    --list             list available modules (from: 'mods/')
     --mod=NAME         set a specific OCR exploiting module
+    --mods-list        list available modules (from: 'mods/')
 
   ->Post-Exploitation (cracking):
     --xml=XML          export result to xml format