diff --git a/ressourcen/jd/captcha/methods/protect-it.org/bgimages.xml b/ressourcen/jd/captcha/methods/protect-it.org/bgimages.xml
new file mode 100644
index 0000000000..6416e466c7
--- /dev/null
+++ b/ressourcen/jd/captcha/methods/protect-it.org/bgimages.xml
@@ -0,0 +1,133 @@
+
+
+
+
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/example.png b/ressourcen/jd/captcha/methods/protect-it.org/example.png
new file mode 100644
index 0000000000..864b68678e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/example.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/Disk.png b/ressourcen/jd/captcha/methods/protect-it.org/images/Disk.png
new file mode 100644
index 0000000000..643122b9d3
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/Disk.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/Roteherz.png b/ressourcen/jd/captcha/methods/protect-it.org/images/Roteherz.png
new file mode 100644
index 0000000000..139c5b4dd1
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/Roteherz.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/alteshaus.png b/ressourcen/jd/captcha/methods/protect-it.org/images/alteshaus.png
new file mode 100644
index 0000000000..e33aaced06
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/alteshaus.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/apfel.png b/ressourcen/jd/captcha/methods/protect-it.org/images/apfel.png
new file mode 100644
index 0000000000..1b1fabf6b1
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/apfel.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/azureuslogo.png b/ressourcen/jd/captcha/methods/protect-it.org/images/azureuslogo.png
new file mode 100644
index 0000000000..cbd0b6e32b
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/azureuslogo.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/baer.png b/ressourcen/jd/captcha/methods/protect-it.org/images/baer.png
new file mode 100644
index 0000000000..528b7fa9f7
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/baer.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/beschwerde.png b/ressourcen/jd/captcha/methods/protect-it.org/images/beschwerde.png
new file mode 100644
index 0000000000..6442901b78
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/beschwerde.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/blau.png b/ressourcen/jd/captcha/methods/protect-it.org/images/blau.png
new file mode 100644
index 0000000000..29870ee6b1
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/blau.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/bluetooth.png b/ressourcen/jd/captcha/methods/protect-it.org/images/bluetooth.png
new file mode 100644
index 0000000000..bf471840ff
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/bluetooth.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/bruecke.png b/ressourcen/jd/captcha/methods/protect-it.org/images/bruecke.png
new file mode 100644
index 0000000000..6db7f56e4e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/bruecke.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/eichhoernchen.png b/ressourcen/jd/captcha/methods/protect-it.org/images/eichhoernchen.png
new file mode 100644
index 0000000000..115b2d606b
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/eichhoernchen.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/erdnusflips.png b/ressourcen/jd/captcha/methods/protect-it.org/images/erdnusflips.png
new file mode 100644
index 0000000000..07232d7819
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/erdnusflips.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/fenster.png b/ressourcen/jd/captcha/methods/protect-it.org/images/fenster.png
new file mode 100644
index 0000000000..267169729d
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/fenster.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/feuerwerk.png b/ressourcen/jd/captcha/methods/protect-it.org/images/feuerwerk.png
new file mode 100644
index 0000000000..7fb2ac934b
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/feuerwerk.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/firefox.png b/ressourcen/jd/captcha/methods/protect-it.org/images/firefox.png
new file mode 100644
index 0000000000..bb96d06033
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/firefox.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/flashlogo.png b/ressourcen/jd/captcha/methods/protect-it.org/images/flashlogo.png
new file mode 100644
index 0000000000..9265e8a8bf
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/flashlogo.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/frosch.png b/ressourcen/jd/captcha/methods/protect-it.org/images/frosch.png
new file mode 100644
index 0000000000..6546030059
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/frosch.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/fuchs.png b/ressourcen/jd/captcha/methods/protect-it.org/images/fuchs.png
new file mode 100644
index 0000000000..5c43ff3de3
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/fuchs.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/fussspur.png b/ressourcen/jd/captcha/methods/protect-it.org/images/fussspur.png
new file mode 100644
index 0000000000..46165b7cae
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/fussspur.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/gelb.png b/ressourcen/jd/captcha/methods/protect-it.org/images/gelb.png
new file mode 100644
index 0000000000..6c58f72cf6
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/gelb.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/gelbentruck.png b/ressourcen/jd/captcha/methods/protect-it.org/images/gelbentruck.png
new file mode 100644
index 0000000000..64bd015d5e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/gelbentruck.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/hoernchen.png b/ressourcen/jd/captcha/methods/protect-it.org/images/hoernchen.png
new file mode 100644
index 0000000000..5a4802049e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/hoernchen.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/jestercap.png b/ressourcen/jd/captcha/methods/protect-it.org/images/jestercap.png
new file mode 100644
index 0000000000..ef53b7a2d0
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/jestercap.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/katze.png b/ressourcen/jd/captcha/methods/protect-it.org/images/katze.png
new file mode 100644
index 0000000000..c25610b48b
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/katze.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/kuhkopf.png b/ressourcen/jd/captcha/methods/protect-it.org/images/kuhkopf.png
new file mode 100644
index 0000000000..f302995e74
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/kuhkopf.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/lock.png b/ressourcen/jd/captcha/methods/protect-it.org/images/lock.png
new file mode 100644
index 0000000000..8931bc314e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/lock.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/lupenblume.png b/ressourcen/jd/captcha/methods/protect-it.org/images/lupenblume.png
new file mode 100644
index 0000000000..1db9001c4d
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/lupenblume.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/mario.png b/ressourcen/jd/captcha/methods/protect-it.org/images/mario.png
new file mode 100644
index 0000000000..cad7380acc
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/mario.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/maus.png b/ressourcen/jd/captcha/methods/protect-it.org/images/maus.png
new file mode 100644
index 0000000000..7494a1fbee
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/maus.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/moeye.png b/ressourcen/jd/captcha/methods/protect-it.org/images/moeye.png
new file mode 100644
index 0000000000..f1d4a904f9
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/moeye.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/quad.png b/ressourcen/jd/captcha/methods/protect-it.org/images/quad.png
new file mode 100644
index 0000000000..8a0a2d226f
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/quad.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/rot.png b/ressourcen/jd/captcha/methods/protect-it.org/images/rot.png
new file mode 100644
index 0000000000..e285cf98bf
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/rot.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/schildkroete.png b/ressourcen/jd/captcha/methods/protect-it.org/images/schildkroete.png
new file mode 100644
index 0000000000..754c926364
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/schildkroete.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/schlange.png b/ressourcen/jd/captcha/methods/protect-it.org/images/schlange.png
new file mode 100644
index 0000000000..aecfe524b0
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/schlange.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/schloss.png b/ressourcen/jd/captcha/methods/protect-it.org/images/schloss.png
new file mode 100644
index 0000000000..6d413b2196
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/schloss.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/tanne.png b/ressourcen/jd/captcha/methods/protect-it.org/images/tanne.png
new file mode 100644
index 0000000000..0408cf5567
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/tanne.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/tannenzapfen.png b/ressourcen/jd/captcha/methods/protect-it.org/images/tannenzapfen.png
new file mode 100644
index 0000000000..7480d64f3d
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/tannenzapfen.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/tracktor.png b/ressourcen/jd/captcha/methods/protect-it.org/images/tracktor.png
new file mode 100644
index 0000000000..a354018b3e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/tracktor.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/trompete.png b/ressourcen/jd/captcha/methods/protect-it.org/images/trompete.png
new file mode 100644
index 0000000000..2c99cd3ac7
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/trompete.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/wasser.png b/ressourcen/jd/captcha/methods/protect-it.org/images/wasser.png
new file mode 100644
index 0000000000..2987c31dac
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/wasser.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/windrad.png b/ressourcen/jd/captcha/methods/protect-it.org/images/windrad.png
new file mode 100644
index 0000000000..f520fdad2e
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/windrad.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/images/youtube.png b/ressourcen/jd/captcha/methods/protect-it.org/images/youtube.png
new file mode 100644
index 0000000000..2dda33ca42
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/images/youtube.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/jacinfo.xml b/ressourcen/jd/captcha/methods/protect-it.org/jacinfo.xml
new file mode 100644
index 0000000000..a6a2001ebc
--- /dev/null
+++ b/ressourcen/jd/captcha/methods/protect-it.org/jacinfo.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/letters.mth b/ressourcen/jd/captcha/methods/protect-it.org/letters.mth
new file mode 100644
index 0000000000..10a4d116cf
--- /dev/null
+++ b/ressourcen/jd/captcha/methods/protect-it.org/letters.mth
@@ -0,0 +1,41 @@
+
+
+00000|11101|11011|10111|01111|00000
+01110|01110|10101|10101|11011|11011|11011|11011
+01110|10101|11011|11011|10101|01110
+01110|01110|01010|01010|01010|01010|00100|10101
+01110|01110|01110|01110|01100|10010
+10111|10111|00001|10111|10111|10111|10110|11001
+00000|11011|11011|11011|11011|11011|11011|11011
+10001|01110|10011|11101|01110|10001
+10001|01110|01111|10011|11101|11110|01110|10001
+01001|00110|01111|01111|01111|01111
+00001|01110|01110|01110|00001|01011|01101|01110
+10001|01110|01110|01110|01110|01110|01010|10001|11110
+01001|00110|01110|01110|00110|01001|01111
+10001|01110|01110|01110|01110|10001
+01001|00110|01110|01110|01110|01110
+01110|00100|01010|01010|01110|01110|01110|01110
+001|101|101|101|101|101|101|000
+01111|01111|01101|01011|00111|01011|01101|01110
+01110|01110|01101|01011|00011|01101|01110|01110
+1110|1110|1110|1110|1110|1110|0110|1001
+001|101|101|101|101|000
+01111|01111|01001|00110|01110|01110|01110|01110
+01110|01110|01110|00000|01110|01110|01110|01110
+11110|10001|01110|01110|10001|01111|10001|01110
+10001|01110|01111|01111|01100|01110|01110|10001
+00000|01111|01111|00001|01111|01111|01111|01111
+11001|10110|10111|10111|00001|10111|10111|10111
+10001|01110|00000|01111|01111|10001
+00000|01111|01111|00001|01111|01111|01111|00000
+11110|11110|10010|01100|01110|01110|01100|10010
+00001|01110|01110|01110|01110|01110|01110|00001
+10001|01110|01111|01111|01110|10001
+10001|01110|01111|01111|01111|01111|01110|10001
+01111|01111|01001|00110|01110|01110|00110|01001
+00001|01110|01110|00001|01110|01110|01110|00001
+10001|11110|10000|01110|01100|10010
+11011|10101|01110|01110|00000|01110|01110|01110
+100|101|011
+
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852030683.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852030683.png
new file mode 100644
index 0000000000..f51508b627
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852030683.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852764590.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852764590.png
new file mode 100644
index 0000000000..cc81ec7c63
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852764590.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852866838.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852866838.png
new file mode 100644
index 0000000000..f774e1043f
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852866838.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852912310.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852912310.png
new file mode 100644
index 0000000000..ec8448a1e1
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852912310.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852953468.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852953468.png
new file mode 100644
index 0000000000..e042d63887
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_1250852953468.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_19674a58038c03176459809579a48c9c.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_19674a58038c03176459809579a48c9c.png
new file mode 100644
index 0000000000..dc84809d60
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_19674a58038c03176459809579a48c9c.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_c7c04b56d7c9721a12ca8aa3dfa5763c.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_c7c04b56d7c9721a12ca8aa3dfa5763c.png
new file mode 100644
index 0000000000..c3d0cc0bf2
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_c7c04b56d7c9721a12ca8aa3dfa5763c.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/mask_f2fbdcd60265f6ced0019a583441acee.png b/ressourcen/jd/captcha/methods/protect-it.org/mask_f2fbdcd60265f6ced0019a583441acee.png
new file mode 100644
index 0000000000..dbfcd2199b
Binary files /dev/null and b/ressourcen/jd/captcha/methods/protect-it.org/mask_f2fbdcd60265f6ced0019a583441acee.png differ
diff --git a/ressourcen/jd/captcha/methods/protect-it.org/script.jas b/ressourcen/jd/captcha/methods/protect-it.org/script.jas
new file mode 100644
index 0000000000..43a449ee16
--- /dev/null
+++ b/ressourcen/jd/captcha/methods/protect-it.org/script.jas
@@ -0,0 +1,41 @@
+#####-------------------------------------JAC-Script--------------------------------------#####
+##### Automatisch erstellt mit EasyCaptcha #####
+##### #####
+##### #####
+#####################################---EasyCaptcha--######################################
+
+
+param.simplifyFaktor = 1;
+param.trainOnlyUnknown=true;
+param.colorType = RGB;
+
+
+param.borderVarianceX=5;
+param.borderVarianceY=5;
+param.scanVarianceX=5;
+param.scanVarianceY=5;
+
+param.intersectionDimensionWeight=6.0;
+
+param.scanAngleLeft=0;
+param.scanAngleRight=0;
+param.scanAngleSteps=0;
+
+param.errorAWeight=4;
+param.errorBWeight=4;
+
+param.coverageFaktorAWeight=1;
+param.coverageFaktorBWeight=0.2;
+
+param.LetterSearchLimitPerfectPercent=0;
+param.quickScanReliabilityLimit=1;
+param.quickScanValityLimit=2;
+param.preScanFilter=100;
+param.preScanFaktor=3;
+param.preScanEmergencyFilter=80;
+param.objectColorContrast = 0.3;
+param.objectDetectionContrast = 0.5;
+param.relativecontrast=0.85;
+param.autoLetterNum=true;
+param.useSpecialGetLetters=ProtectItOrg.getLetters;
+param.useLetterFilter=ProtectItOrg.letterFilter;
diff --git a/src/jd/captcha/ColorLetterComperator.java b/src/jd/captcha/ColorLetterComperator.java
new file mode 100644
index 0000000000..9775943e02
--- /dev/null
+++ b/src/jd/captcha/ColorLetterComperator.java
@@ -0,0 +1,237 @@
+package jd.captcha;
+
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.util.ArrayList;
+
+import com.jhlabs.image.PosterizeFilter;
+
+import jd.captcha.pixelgrid.Captcha;
+
+import jd.nutils.Colors;
+
+import jd.captcha.pixelgrid.PixelGrid;
+import jd.captcha.pixelobject.PixelObject;
+import jd.captcha.utils.Utilities;
+import jd.captcha.pixelgrid.Letter;
+
+public class ColorLetterComperator {
+ private Letter a;
+ private Letter b;
+ private PixelObject[] aLayers;
+ private PixelObject[] bLayers;
+ private Captcha ca;
+ private Captcha cb;
+ private JAntiCaptcha owner;
+ public int lettersPerfect = 2;
+ public int lettersPerfectPercent = 20;
+ public int maxColorDifference = 30;
+ protected double valityPercent = 10000.0;
+ /**
+ * Farbebenen die untersucht werden sollen
+ */
+ public int colorLevels = 2;
+
+ /**
+ * vergleicht Farbebenen eignet sich um echte Bilder zu vergleichen
+ */
+ public ColorLetterComperator(Letter a, Letter b) {
+ this.a = a;
+ this.b = b;
+ if (a.owner != null)
+ owner = a.owner;
+ else if (b.owner != null) owner = b.owner;
+ }
+
+ public void setLetterA(Letter a) {
+ this.a = a;
+ ca=null;
+ aLayers = null;
+ }
+
+ public void setLetterB(Letter b) {
+ this.b = b;
+ cb=null;
+ bLayers = null;
+ }
+
+ private Letter getSWLetter(PixelObject obj) {
+ int[][] lgrid = new int[obj.getWidth()][obj.getHeight()];
+ for (int x = 0; x < obj.getWidth(); x++) {
+ for (int y = 0; y < obj.getHeight(); y++) {
+ lgrid[x][y] = 0xffffff;
+
+ }
+ }
+ int w = 0;
+ for (int d = 0; d < obj.getSize(); d++) {
+ w++;
+ int[] akt = obj.elementAt(d);
+ lgrid[akt[0] - obj.getXMin()][akt[1] - obj.getYMin()] = 0x000000;
+
+ }
+ //invertieren wenn der schwarze bereich größer ist als der weiße
+ if (obj.getArea() / 2 < w) {
+ for (int x = 0; x < obj.getWidth(); x++) {
+ for (int y = 0; y < obj.getHeight(); y++) {
+ if (lgrid[x][y] == 0xffffff)
+ lgrid[x][y] = 0x000000;
+ else
+ lgrid[x][y] = 0xffffff;
+ }
+ }
+ }
+ Letter l = obj.owner.createLetter();
+ l.setElementPixel(obj.getSize());
+ l.setLocation(new int[] { obj.getXMin(), obj.getYMin() });
+ l.setGrid(lgrid);
+ l.detected = obj.detected;
+ return l;
+ }
+ /**
+ * vergleicht alle Farbebenen die untersucht werden sollen und gibt den
+ * durchschnittlichen ValityPercent
+ *
+ * @return Prozentwert 0(gut) bis 100 (schlecht) der Übereinstimmung
+ */
+ public double run() {
+ if (aLayers != null && bLayers != null) return valityPercent;
+ if ((a.getArea() / 5) > b.getArea() || (b.getArea() / 5) > a.getArea()) {
+ valityPercent = 10000.0;
+ return valityPercent;
+ }
+ if(ca==null)
+ {
+ ca=reduceColors(a);
+ }
+ if(cb==null)
+ {
+ cb=reduceColors(b);
+ }
+
+ if (aLayers == null) {
+ aLayers = getObjects(ca);
+ }
+ if (bLayers == null) {
+ bLayers = getObjects(cb);
+ }
+ double ret = 0;
+ int minl = Math.min(aLayers.length, bLayers.length);
+ int perf = 0;
+ int maxl = Math.max(aLayers.length, bLayers.length);
+ boolean minla = aLayers.length == minl;
+ PixelObject[][] bestarray = new PixelObject[minl][2];
+ for (int i = 0; i < minl; i++) {
+ double best = Double.MAX_VALUE;
+ PixelObject[] bestobj = null;
+ for (int j = maxl - i - 1; j >= 0; j--) {
+ double value = 0;
+ int a = j;
+ int b = i;
+
+ if (minla) {
+ a = i;
+ b = j;
+ }
+ value = Colors.getColorDifference(aLayers[a].getAverage(), bLayers[b].getAverage());
+
+ if (value == 0) {
+ bestobj = new PixelObject[] { aLayers[a], bLayers[b] };
+ break;
+ } else if (value < best) {
+ best = value;
+ bestobj = new PixelObject[] { aLayers[a], bLayers[b] };
+ }
+
+ }
+ bestarray[i] = bestobj;
+ }
+ for (int i = 0; i < bestarray.length; i++) {
+ if (Colors.getColorDifference(bestarray[i][0].getAverage(), bestarray[i][1].getAverage()) > maxColorDifference)
+ ret += 100;
+ else {
+ try {
+ Letter leta = getSWLetter(bestarray[i][0]);
+ LetterComperator lc = new LetterComperator(leta, getSWLetter(bestarray[i][1]));
+ lc.setOwner(getJac());
+ bestarray[i][0].detected = lc;
+ lc.run();
+ double vall = lc.getValityPercent();
+ if (vall < lettersPerfectPercent) {
+ perf++;
+ valityPercent = 0;
+ if (perf == lettersPerfect) return 0;
+ }
+ ret += lc.getValityPercent();
+ } catch (Exception e) {
+ ret += ret / i;
+ }
+
+ }
+ }
+ ret += (maxl - minl) * 100;
+ valityPercent = ret / maxl;
+ return valityPercent;
+ }
+
+ private JAntiCaptcha getJac() {
+ if (owner != null) return owner;
+ String hoster = "EasyCaptcha";
+ owner = new JAntiCaptcha(Utilities.getMethodDir(), hoster);
+ return owner;
+ }
+
+ /**
+ * Erstellt aus jeder Farbebene ein Letter Achtung Farben müssen reduziert
+ * sein
+ *
+ * @param grid
+ * @return
+ */
+ public static PixelObject[] getObjects(PixelGrid grid) {
+ ArrayList ret = new ArrayList();
+ ArrayList merge;
+ for (int x = 0; x < grid.getWidth(); x++) {
+ for (int y = 0; y < grid.getHeight(); y++) {
+ PixelObject n = new PixelObject(grid);
+ n.add(x, y, grid.getGrid()[x][y]);
+
+ merge = new ArrayList();
+ for (PixelObject o : ret) {
+ if (grid.getGrid()[x][y] == o.getAverage()) {
+ merge.add(o);
+ }
+ }
+ if (merge.size() == 0) {
+ ret.add(n);
+ } else if (merge.size() == 1) {
+ merge.get(0).add(n);
+ } else {
+ for (PixelObject po : merge) {
+ ret.remove(po);
+ n.add(po);
+ }
+ ret.add(n);
+ }
+
+ }
+ }
+
+ return ret.toArray(new PixelObject[] {});
+ }
+ /**
+ * reduziert die farben (colorLevels)
+ *
+ * @param letter
+ * @return
+ */
+ private Captcha reduceColors(Letter letter)
+ {
+ PosterizeFilter qf = new PosterizeFilter();
+ BufferedImage image = (BufferedImage) letter.getImage();
+ BufferedImage dest = qf.createCompatibleDestImage(image, ColorModel.getRGBdefault());
+ qf.setNumLevels(colorLevels);
+ qf.filter(image, dest);
+ return getJac().createCaptcha(dest);
+ }
+}
diff --git a/src/jd/captcha/easy/BackGroundImageDialog.java b/src/jd/captcha/easy/BackGroundImageDialog.java
index 529883c8e4..b45aa836c4 100644
--- a/src/jd/captcha/easy/BackGroundImageDialog.java
+++ b/src/jd/captcha/easy/BackGroundImageDialog.java
@@ -218,6 +218,9 @@ public class BackGroundImageDialog implements ActionListener {
return null;
}
}.waitForEDT();
+ workingImage.setColor(colorChooser.getColor().getRGB());
+ workingImage.setDistance((Integer) thresholdSpinner.getValue());
+ workingImage.setColorDistanceMode(colorMode);
ret = workingImage;
return;
} else if (e.getSource() == btLoadBackgroundImage) {
diff --git a/src/jd/captcha/easy/BackGroundImageManager.java b/src/jd/captcha/easy/BackGroundImageManager.java
index 753222ffa8..0935f10b57 100644
--- a/src/jd/captcha/easy/BackGroundImageManager.java
+++ b/src/jd/captcha/easy/BackGroundImageManager.java
@@ -5,9 +5,7 @@ import java.io.File;
import java.util.Iterator;
import java.util.Vector;
import jd.captcha.pixelgrid.PixelGrid;
-
import jd.nutils.io.JDIO;
-
import jd.captcha.pixelgrid.Captcha;
import jd.captcha.utils.Utilities;
import jd.controlling.JDLogger;
diff --git a/src/jd/captcha/easy/EasyCaptchaTool.java b/src/jd/captcha/easy/EasyCaptchaTool.java
index c01a9a271d..d507d7e13b 100644
--- a/src/jd/captcha/easy/EasyCaptchaTool.java
+++ b/src/jd/captcha/easy/EasyCaptchaTool.java
@@ -20,6 +20,9 @@ import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
+
+import jd.captcha.easy.load.LoadCaptchas;
+
import jd.gui.userio.DummyFrame;
import jd.JDInit;
import jd.captcha.JAntiCaptcha;
diff --git a/src/jd/captcha/easy/EasyMethodeFile.java b/src/jd/captcha/easy/EasyMethodeFile.java
index 4b3e208d35..210cb27317 100644
--- a/src/jd/captcha/easy/EasyMethodeFile.java
+++ b/src/jd/captcha/easy/EasyMethodeFile.java
@@ -9,6 +9,8 @@ import java.util.Vector;
import javax.swing.ImageIcon;
+import jd.captcha.easy.load.LoadCaptchas;
+
import jd.nutils.io.JDIO;
import jd.captcha.pixelgrid.Captcha;
diff --git a/src/jd/captcha/easy/load/LoadAgain.java b/src/jd/captcha/easy/load/LoadAgain.java
new file mode 100644
index 0000000000..47e016e820
--- /dev/null
+++ b/src/jd/captcha/easy/load/LoadAgain.java
@@ -0,0 +1,18 @@
+package jd.captcha.easy.load;
+
+public class LoadAgain {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ LoadImage li = LoadImage.loadFile("teradepot.com");
+ try {
+ System.out.println(li.load("teradepot.com").file);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/jd/captcha/easy/LoadCaptchas.java b/src/jd/captcha/easy/load/LoadCaptchas.java
similarity index 72%
rename from src/jd/captcha/easy/LoadCaptchas.java
rename to src/jd/captcha/easy/load/LoadCaptchas.java
index ac2eade3f1..032d51d501 100644
--- a/src/jd/captcha/easy/LoadCaptchas.java
+++ b/src/jd/captcha/easy/load/LoadCaptchas.java
@@ -1,4 +1,4 @@
-package jd.captcha.easy;
+package jd.captcha.easy.load;
import jd.utils.JDUtilities;
import jd.http.Browser;
@@ -16,6 +16,8 @@ import java.io.*;
import javax.swing.*;
+import jd.captcha.easy.EasyMethodeFile;
+
import jd.parser.html.HTMLParser;
import jd.parser.html.InputField;
@@ -39,6 +41,8 @@ public class LoadCaptchas {
private ArrayList images;
private LoadImage selectedImage;
private JFrame owner;
+ public int maxHeight = 400;
+ public int maxWeight = 600;
/**
* Ordner in den die Bilder geladen werden (default: jdCaptchaFolder/host)
*
@@ -104,96 +108,100 @@ public class LoadCaptchas {
new EasyMethodeFile(host).copyExampleImage();
return true;
}
+ selectedImage = LoadImage.loadFile(host);
+ if (selectedImage != null)
+ selectedImage.load(host);
+ else {
+ dialog.setTitle(JDL.L("easycaptcha.loadcaptchas.clickoncaptcha", "click on the captcha"));
+ images = getAllImages(br);
+ loadImages();
+ dialog.addWindowListener(new WindowListener() {
- dialog.setTitle(JDL.L("easycaptcha.loadcaptchas.clickoncaptcha", "click on the captcha"));
- images = getAllImages(br);
- loadImages();
- dialog.addWindowListener(new WindowListener() {
-
- public void windowActivated(WindowEvent e) {
- }
-
- public void windowClosed(WindowEvent e) {
-
- }
-
- public void windowClosing(WindowEvent e) {
- for (LoadImage loadImage : images) {
- loadImage.file.delete();
+ public void windowActivated(WindowEvent e) {
}
- dialog.dispose();
- }
- public void windowDeactivated(WindowEvent e) {
- }
+ public void windowClosed(WindowEvent e) {
- public void windowDeiconified(WindowEvent e) {
- }
+ }
- public void windowIconified(WindowEvent e) {
- }
-
- public void windowOpened(WindowEvent e) {
- }
- });
-
- final ArrayList bts = new ArrayList();
- for (int j = 0; j < images.size(); j++) {
- final LoadImage f = images.get(j);
- if (f == null || f.file == null || !f.file.exists() || f.file.length() < 100) continue;
- final BufferedImage captchaImage = JDImage.getImage(f.file);
- if (captchaImage == null) {
- f.file.delete();
- continue;
- }
- int area = captchaImage.getHeight(null) * captchaImage.getHeight(null);
- if (area < 50 || area > 50000 || captchaImage.getHeight(null) > 400 || captchaImage.getWidth(null) > 400 || captchaImage.getWidth(null) < 10 || captchaImage.getHeight(null) < 5) {
- f.file.delete();
- continue;
- }
- double faktor = Math.max((double) captchaImage.getWidth(null) / 100, (double) captchaImage.getHeight(null) / 100);
- final int width = (int) (captchaImage.getWidth(null) / faktor);
- final int height = (int) (captchaImage.getHeight(null) / faktor);
- try {
- JButton ic = new GuiRunnable() {
- public JButton runSave() {
- return new JButton(new ImageIcon(captchaImage.getScaledInstance(width, height, Image.SCALE_SMOOTH)));
+ public void windowClosing(WindowEvent e) {
+ for (LoadImage loadImage : images) {
+ loadImage.file.delete();
}
- }.getReturnValue();
- ic.addActionListener(new ActionListener() {
+ dialog.dispose();
+ }
+
+ public void windowDeactivated(WindowEvent e) {
+ }
+
+ public void windowDeiconified(WindowEvent e) {
+ }
+
+ public void windowIconified(WindowEvent e) {
+ }
+
+ public void windowOpened(WindowEvent e) {
+ }
+ });
+
+ final ArrayList bts = new ArrayList();
+ for (int j = 0; j < images.size(); j++) {
+ final LoadImage f = images.get(j);
+ if (f == null || f.file == null || !f.file.exists() || f.file.length() < 100) continue;
+ final BufferedImage captchaImage = JDImage.getImage(f.file);
+ if (captchaImage == null) {
+ f.file.delete();
+ continue;
+ }
+ int area = captchaImage.getHeight(null) * captchaImage.getHeight(null);
+ if (area < 50 || captchaImage.getHeight(null) > maxHeight || captchaImage.getWidth(null) > maxWeight || captchaImage.getWidth(null) < 10 || captchaImage.getHeight(null) < 5) {
+ f.file.delete();
+ continue;
+ }
+ double faktor = Math.max((double) captchaImage.getWidth(null) / 100, (double) captchaImage.getHeight(null) / 100);
+ final int width = (int) (captchaImage.getWidth(null) / faktor);
+ final int height = (int) (captchaImage.getHeight(null) / faktor);
+ try {
+ JButton ic = new GuiRunnable() {
+ public JButton runSave() {
+ return new JButton(new ImageIcon(captchaImage.getScaledInstance(width, height, Image.SCALE_SMOOTH)));
+ }
+ }.getReturnValue();
+ ic.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ selectedImage = f;
+ dialog.dispose();
+ }
+ });
+ bts.add(ic);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
- public void actionPerformed(ActionEvent e) {
- selectedImage = f;
- dialog.dispose();
- }
- });
- bts.add(ic);
- } catch (Exception e) {
- e.printStackTrace();
}
+ final JPanel panel = new GuiRunnable() {
+ public JPanel runSave() {
+ return new JPanel(new GridLayout((int) Math.ceil(((double) bts.size()) / 5), 5));
+ }
+ }.getReturnValue();
+ for (JButton button : bts) {
+ panel.add(button);
+ }
+ new GuiRunnable() {
+ public Object runSave() {
+ dialog.add(new JScrollPane(panel));
+
+ dialog.pack();
+ dialog.setLocation(Screen.getCenterOfComponent(owner, dialog));
+ dialog.setAlwaysOnTop(true);
+ dialog.setVisible(true);
+
+ return null;
+ }
+ }.waitForEDT();
}
- final JPanel panel = new GuiRunnable() {
- public JPanel runSave() {
- return new JPanel(new GridLayout((int) Math.ceil(((double) bts.size()) / 5), 5));
- }
- }.getReturnValue();
- for (JButton button : bts) {
- panel.add(button);
-
- }
- new GuiRunnable() {
- public Object runSave() {
- dialog.add(new JScrollPane(panel));
-
- dialog.pack();
- dialog.setLocation(Screen.getCenterOfComponent(owner, dialog));
- dialog.setAlwaysOnTop(true);
- dialog.setVisible(true);
-
- return null;
- }
- }.waitForEDT();
if (selectedImage != null && selectedImage.file != null) {
loadProcess();
if (opendir) openDir(dir);
@@ -306,7 +314,6 @@ public class LoadCaptchas {
}
}.getReturnValue();
-
final JDTextField tfl = new GuiRunnable() {
public JDTextField runSave() {
return new JDTextField();
@@ -401,7 +408,7 @@ public class LoadCaptchas {
int menge = (Integer) sm.getValue();
dialog.dispose();
LoadInfo retLI = new LoadInfo(link, menge);
- retLI.followLinks=followLinks.isSelected();
+ retLI.followLinks = followLinks.isSelected();
return retLI;
}
@@ -493,7 +500,7 @@ public class LoadCaptchas {
try {
imagea = getImages(br);
for (int i = 0; i < imagea.length; i++) {
- LoadImage li = new LoadImage(imagea[i], br);
+ LoadImage li = new LoadImage(loadinfo, imagea[i], br);
li.form = -1;
li.location = i;
images.add(li);
@@ -510,7 +517,7 @@ public class LoadCaptchas {
brc.getPage(string);
imagea = getImages(brc);
for (int i = 0; i < imagea.length; i++) {
- LoadImage li = new LoadImage(imagea[i], brc);
+ LoadImage li = new LoadImage(loadinfo, imagea[i], brc);
li.form = -1;
li.location = i;
li.followUrl = b;
@@ -534,7 +541,7 @@ public class LoadCaptchas {
imagea = getImages(brc);
for (int b = 0; b < imagea.length; b++) {
- LoadImage li = new LoadImage(imagea[b], brc);
+ LoadImage li = new LoadImage(loadinfo, imagea[b], brc);
li.form = i;
li.location = b;
if (images.contains(li)) continue;
@@ -569,7 +576,7 @@ public class LoadCaptchas {
public void run() {
LoadImage image = images.get(i);
- image.load(dir);
+ image.directCaptchaLoad(dir);
synchronized (jb[i]) {
jb[i].notify();
}
@@ -634,11 +641,15 @@ public class LoadCaptchas {
final Runnable runnable = new Runnable() {
public void run() {
try {
+ if(images!=null)
+ {
for (LoadImage loadImage : images) {
if (!loadImage.file.equals(selectedImage.file)) loadImage.file.delete();
}
+ }
String oldurl = selectedImage.imageUrl;
- selectedImage.followPageFormLoad(dir, loadinfo);
+ selectedImage.load(host);
+ LoadImage.save(selectedImage, host);
new GuiRunnable() {
public Object runSave() {
pd.setValue(1);
@@ -647,7 +658,7 @@ public class LoadCaptchas {
}.waitForEDT();
if (oldurl.equals(selectedImage.toString())) {
for (int k = 1; k < loadinfo.menge - 1; k++) {
- selectedImage.load(dir);
+ selectedImage.directCaptchaLoad(dir);
final int d = k;
new GuiRunnable() {
public Object runSave() {
@@ -658,7 +669,7 @@ public class LoadCaptchas {
}
} else {
for (int k = 1; k < loadinfo.menge - 1; k++) {
- selectedImage.followPageFormLoad(dir, loadinfo);
+ selectedImage.load(host);
final int d = k;
new GuiRunnable() {
public Object runSave() {
@@ -692,154 +703,5 @@ public class LoadCaptchas {
}.waitForEDT();
}
-}
-
-/**
- * Diese klasse speichert Bildinformationen wie die Form die verwendet wurde und
- * die Bildposition
- *
- * @author dwd
- *
- */
-class LoadImage {
- /**
- * ParentUrl
- */
- public int followUrl = -1;
- /**
- * Bildadresse
- */
- public String imageUrl;
- /**
- * Formposition -1 == keiner Form folgen
- */
- public int form = -1;
- /**
- * Bildposition
- */
- public int location = 0;
- /**
- * Browser mit dem das Bild runtergeladen wurde
- */
- public Browser br;
- /**
- * datei in dem das Bild nach dem laden gespeichert wurde
- */
- public File file;
- /**
- * zwischenspeicher für den DateiType
- */
- private String fileType = null;
-
- public LoadImage() {
- }
-
- public LoadImage(String imageUrl, Browser br) {
- this.imageUrl = imageUrl;
- this.br = br.cloneBrowser();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj != null && obj instanceof LoadImage) {
- String url = ((LoadImage) obj).imageUrl;
- if (imageUrl == url) return true;
- if (url == null) return false;
- return url.equals(imageUrl);
- }
- return false;
- }
-
- /**
- * läd das Bild direkt in den vorgegebenen Ordner
- *
- * @param destination
- */
- public void load(String destination) {
- file = new File(destination, System.currentTimeMillis() + getFileType());
- try {
- br.getDownload(file, imageUrl);
-
- } catch (Exception e) {
- }
- }
-
- /**
- * ruft die Seite erneut auf und folgt den Forms um dann am ende das Bild zu
- * laden
- *
- * @param destination
- * @param loadInfo
- * @throws Exception
- */
- public void followPageFormLoad(String destination, LoadInfo loadInfo) throws Exception {
- br.clearCookies(loadInfo.link);
- br.getPage(loadInfo.link);
- if (followUrl != -1) {
- String[] links = HTMLParser.getHttpLinks(br.toString(), br.getURL());
- br.getPage(links[followUrl]);
- }
-
- if (form != -1) {
- br.submitForm(LoadCaptchas.getForms(br)[form]);
- }
- imageUrl = LoadCaptchas.getImages(br)[location];
- load(destination);
- }
-
- public void setFileType(String fileType) {
- this.fileType = fileType;
- }
-
- /**
- * Dateitype eines Bildes .jpg wenn er nicht erkannt wird
- *
- * @return
- */
- public String getFileType() {
- if (fileType != null) return fileType;
- fileType = ".jpg";
- if (imageUrl.toLowerCase().contains("\\.png"))
- fileType = ".png";
- else if (imageUrl.toLowerCase().contains("\\.png"))
- fileType = ".gif";
- else {
- try {
- br.getPage(imageUrl);
- String ct2 = br.getHttpConnection().getContentType().toLowerCase();
- if (ct2 != null && ct2.contains("image")) {
- if (ct2.equals("image/jpeg"))
- fileType = ".jpg";
- else {
- fileType = ct2.replaceFirst("image/", ".");
- }
- }
- } catch (Exception e) {
- }
-
- }
- return fileType;
- }
-
- @Override
- public String toString() {
- return imageUrl;
- }
-
- public String toLowerCase() {
- return toString().toLowerCase();
- }
-}
-
-class LoadInfo {
- boolean followLinks = false;
-
- public String link;
- public int menge = 100;
-
- public LoadInfo(String link, int menge) {
- this.link = link;
- this.menge = menge;
- }
}
\ No newline at end of file
diff --git a/src/jd/captcha/easy/LoadCaptchasTest.java b/src/jd/captcha/easy/load/LoadCaptchasTest.java
similarity index 95%
rename from src/jd/captcha/easy/LoadCaptchasTest.java
rename to src/jd/captcha/easy/load/LoadCaptchasTest.java
index 83aa730990..b70207bf1b 100644
--- a/src/jd/captcha/easy/LoadCaptchasTest.java
+++ b/src/jd/captcha/easy/load/LoadCaptchasTest.java
@@ -1,4 +1,4 @@
-package jd.captcha.easy;
+package jd.captcha.easy.load;
import java.awt.Toolkit;
import jd.gui.userio.DummyFrame;
diff --git a/src/jd/captcha/easy/load/LoadImage.java b/src/jd/captcha/easy/load/LoadImage.java
new file mode 100644
index 0000000000..7c74513062
--- /dev/null
+++ b/src/jd/captcha/easy/load/LoadImage.java
@@ -0,0 +1,243 @@
+package jd.captcha.easy.load;
+
+import java.io.File;
+import java.net.URI;
+import jd.nutils.io.JDIO;
+
+import jd.utils.JDUtilities;
+
+import jd.http.Browser;
+import jd.parser.html.HTMLParser;
+
+/**
+ * Diese klasse speichert Bildinformationen wie die Form die verwendet wurde und
+ * die Bildposition
+ *
+ * @author dwd
+ *
+ */
+public class LoadImage {
+
+
+
+ /**
+ * Adresse die als erstes geladen wird
+ */
+ public String baseUrl;
+ /**
+ * followUrl unterurl die verwendet werden soll
+ */
+ protected int followUrl = -1;
+ /**
+ * Bildadresse
+ */
+ protected transient String imageUrl;
+ /**
+ * Formposition -1 == keiner Form folgen
+ */
+ protected int form = -1;
+ /**
+ * zwischenspeicher für den DateiType
+ */
+ protected String fileType = null;
+ /**
+ * Bildposition
+ */
+ protected int location = 0;
+ /**
+ * Browser mit dem das Bild runtergeladen wurde
+ */
+ public transient Browser br;
+ /**
+ * datei in dem das Bild nach dem laden gespeichert wurde
+ */
+ protected transient File file;
+ public transient boolean clearCookies = true;
+
+ public LoadImage(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ public LoadImage() {
+ this.br = new Browser();
+ }
+
+ public LoadImage(LoadInfo loadInfo) {
+ this.baseUrl = loadInfo.link;
+ this.br = new Browser();
+ }
+
+ public LoadImage(LoadInfo loadInfo, String imageUrl, Browser br) {
+ this.baseUrl = loadInfo.link;
+ this.imageUrl = imageUrl;
+ this.br = br.cloneBrowser();
+ }
+
+ public int getFollowUrl() {
+ return followUrl;
+ }
+
+ public void setFollowUrl(int followUrl) {
+ this.followUrl = followUrl;
+ }
+
+ public int getForm() {
+ return form;
+ }
+
+ public void setForm(int form) {
+ this.form = form;
+ }
+
+ public int getLocation() {
+ return location;
+ }
+
+ public void setLocation(int location) {
+ this.location = location;
+ }
+
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (obj != null && obj instanceof LoadImage) {
+ String url = ((LoadImage) obj).imageUrl;
+ if (imageUrl == url) return true;
+ if (url == null) return false;
+ return url.equals(imageUrl);
+ }
+ return false;
+ }
+
+ /**
+ * läd das Bild direkt in den vorgegebenen Ordner
+ *
+ * @param destination
+ */
+ public void directCaptchaLoad(String destination) {
+ file = new File(destination, System.currentTimeMillis() + getFileType());
+ try {
+ br.getDownload(file, imageUrl);
+
+ } catch (Exception e) {
+ }
+ }
+
+ /**
+ * ruft die Seite erneut auf und folgt den Forms um dann am ende das Bild zu
+ * laden
+ *
+ * @param host
+ * @param loadInfo
+ * @throws Exception
+ */
+ public LoadImage load(String host) throws Exception {
+ if (host == null) host = new URI(baseUrl).getHost();
+ String destination = JDUtilities.getJDHomeDirectoryFromEnvironment().getAbsolutePath() + "/captchas/" + host + "/";
+ new File(destination).mkdir();
+ br.clearCookies(baseUrl);
+ br.getPage(baseUrl);
+ if (followUrl != -1) {
+ String[] links = HTMLParser.getHttpLinks(br.toString(), br.getURL());
+ br.getPage(links[followUrl]);
+ }
+
+ if (form != -1) {
+ br.submitForm(LoadCaptchas.getForms(br)[form]);
+ }
+ imageUrl = LoadCaptchas.getImages(br)[location];
+ directCaptchaLoad(destination);
+ return this;
+ }
+
+ public void setFileType(String fileType) {
+ this.fileType = fileType;
+ }
+
+ /**
+ * Dateitype eines Bildes .jpg wenn er nicht erkannt wird
+ *
+ * @return
+ */
+ public String getFileType() {
+ if (fileType != null) return fileType;
+ if(imageUrl==null) return ".jpg";
+ fileType = ".jpg";
+ if (imageUrl.toLowerCase().contains("\\.png"))
+ fileType = ".png";
+ else if (imageUrl.toLowerCase().contains("\\.png"))
+ fileType = ".gif";
+ else {
+ try {
+ br.getPage(imageUrl);
+ String ct2 = br.getHttpConnection().getContentType().toLowerCase();
+ if (ct2 != null && ct2.contains("image")) {
+ if (ct2.equals("image/jpeg"))
+ fileType = ".jpg";
+ else {
+ fileType = ct2.replaceFirst("image/", ".");
+ }
+ }
+ } catch (Exception e) {
+ }
+
+ }
+ return fileType;
+ }
+
+ @Override
+ public String toString() {
+ return imageUrl;
+ }
+
+ public String toLowerCase() {
+ return toString().toLowerCase();
+ }
+ /**
+ * läd einen Vector aus eine XML Datei (methodedir/CPoints.xml)
+ *
+ * @param file
+ * @return
+ */
+ public static LoadImage loadFile(File file) {
+ if (file.exists()) { return (LoadImage) JDIO.loadObject(null, file, true); }
+ return null;
+ }
+ /**
+ * läd ein LoadImage aus eine XML Datei (methodedir/CPoints.xml)
+ *
+ * @param file
+ * @return
+ */
+ public static LoadImage loadFile(String host) {
+ File file = new File(JDUtilities.getJDHomeDirectoryFromEnvironment() + "/" + JDUtilities.getJACMethodsDirectory() + host + "/LoadImage.xml");
+ return loadFile(file);
+ }
+ /**
+ * Speichert ein LoadImage in eine XML Datei
+ *
+ * @param cPoints
+ * @param file
+ */
+ public static void save(LoadImage li, File file) {
+ file.getParentFile().mkdirs();
+ System.out.println("LoadImage has beens saved under: "+file);
+ JDIO.saveObject(null, li, file, null, null, true);
+ }
+ /**
+ * Speichert ein LoadImage in eine XML Datei (methodedir/LoadImage.xml)
+ *
+ * @param cPoints
+ * @param file
+ */
+ public static void save(LoadImage selectedImage, String host) {
+ File file = new File(JDUtilities.getJDHomeDirectoryFromEnvironment() + "/" + JDUtilities.getJACMethodsDirectory() + host + "/LoadImage.xml");
+ save(selectedImage,file);
+ }
+}
\ No newline at end of file
diff --git a/src/jd/captcha/easy/load/LoadInfo.java b/src/jd/captcha/easy/load/LoadInfo.java
new file mode 100644
index 0000000000..b47c1e727a
--- /dev/null
+++ b/src/jd/captcha/easy/load/LoadInfo.java
@@ -0,0 +1,13 @@
+package jd.captcha.easy.load;
+
+public class LoadInfo {
+ boolean followLinks = false;
+
+ public String link;
+ public int menge = 100;
+
+ public LoadInfo(String link, int menge) {
+ this.link = link;
+ this.menge = menge;
+ }
+}
\ No newline at end of file
diff --git a/src/jd/captcha/pixelobject/PixelObject.java b/src/jd/captcha/pixelobject/PixelObject.java
index 958ff874ab..0a522cb655 100644
--- a/src/jd/captcha/pixelobject/PixelObject.java
+++ b/src/jd/captcha/pixelobject/PixelObject.java
@@ -78,7 +78,7 @@ public class PixelObject implements Comparable {
* captcha als owner. Über owner kann auf den Parameter Dump zugegriffen
* werden
*/
- private PixelGrid owner;
+ public PixelGrid owner;
/**
* Als sicher angenommener Farb durchschnitt
@@ -559,7 +559,27 @@ public class PixelObject implements Comparable {
}
return ret;
}
+ public PixelObject[] horizintalSplitAt(int yposition) {
+ PixelObject[] ret = new PixelObject[2];
+ for (int i = 0; i < ret.length; i++) {
+ ret[i] = new PixelObject(owner);
+ }
+ for (int i = 0; i < getSize(); i++) {
+ int[] akt = elementAt(i);
+ boolean b = true;
+ for (int y = 0; y < 2; y++) {
+ if (akt[1] >= yMin + y * yposition && akt[1] <= yMin + (y + 1) * yposition) {
+ ret[y].add(akt[0], akt[1], saveAvg);
+ b = false;
+ }
+ }
+ if (b) {
+ ret[1].add(akt[0], akt[1], saveAvg);
+ }
+ }
+ return ret;
+ }
public PixelObject[] splitAt(int position) {
PixelObject[] ret = new PixelObject[2];
for (int i = 0; i < ret.length; i++) {
@@ -595,7 +615,6 @@ public class PixelObject implements Comparable {
*/
public Letter toColoredLetter(int backgroundcolor,PixelGrid owner ) {
Letter l = new Letter(getWidth(), getHeight());
- l.setOwner(owner.owner);
l.setGrid(getGrid(backgroundcolor, owner));
l.setElementPixel(getSize());
l.setLocation(new int[] { getXMin(), getYMin() });
@@ -649,7 +668,6 @@ public class PixelObject implements Comparable {
}
Letter l = owner.createLetter();
- l.setOwner(owner.owner);
l.setElementPixel(getSize());
l.setLocation(new int[] { getXMin(), getYMin() });
l.setGrid(ret);
diff --git a/src/jd/captcha/specials/ProtectItOrg.java b/src/jd/captcha/specials/ProtectItOrg.java
new file mode 100644
index 0000000000..e101e20522
--- /dev/null
+++ b/src/jd/captcha/specials/ProtectItOrg.java
@@ -0,0 +1,185 @@
+package jd.captcha.specials;
+
+import java.awt.Image;
+import java.awt.image.RenderedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.ListIterator;
+import java.util.Vector;
+import javax.imageio.ImageIO;
+
+import jd.captcha.JAntiCaptcha;
+
+import jd.captcha.ColorLetterComperator;
+import jd.nutils.JDImage;
+import jd.captcha.LetterComperator;
+import jd.captcha.pixelgrid.PixelGrid;
+import jd.captcha.pixelobject.PixelObject;
+import jd.captcha.easy.BackGroundImageManager;
+import jd.captcha.pixelgrid.Captcha;
+import jd.captcha.pixelgrid.Letter;
+
+public class ProtectItOrg {
+ static ArrayList getObjects(PixelGrid grid, int neighbourradius) {
+ ArrayList ret = new ArrayList();
+ ArrayList merge;
+ for (int x = 0; x < grid.getWidth(); x++) {
+ for (int y = 0; y < grid.getHeight(); y++) {
+ if (grid.getGrid()[x][y] == -3151923) continue;
+
+ PixelObject n = new PixelObject(grid);
+ n.add(x, y, grid.getGrid()[x][y]);
+
+ merge = new ArrayList();
+ for (PixelObject o : ret) {
+ if (o.isTouching(x, y, true, neighbourradius, neighbourradius)) {
+ merge.add(o);
+ }
+ }
+ if (merge.size() == 0) {
+ ret.add(n);
+ } else if (merge.size() == 1) {
+ merge.get(0).add(n);
+ } else {
+ for (PixelObject po : merge) {
+ ret.remove(po);
+ n.add(po);
+ }
+ ret.add(n);
+ }
+
+ }
+ }
+
+ return ret;
+ }
+
+ @SuppressWarnings("unused")
+ private static void loadImagesIfNotExists(String code, Captcha captcha) {
+ if (!captcha.owner.getResourceFile("images/r/" + code + ".png").exists()) {
+ captcha.reset();
+ BackGroundImageManager bgit = new BackGroundImageManager(captcha);
+ bgit.clearCaptchaAll();
+ captcha.crop(0, 0, 0, 10);
+ ArrayList obj = getObjects(captcha, 7);
+
+ for (PixelObject pixelObject : obj) {
+ Image img = pixelObject.toColoredLetter().getImage();
+ File retf = captcha.owner.getResourceFile("images/" + code + System.currentTimeMillis() + ".png");
+ try {
+ ImageIO.write((RenderedImage) img, "png", retf);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }
+ }
+
+ public static Letter[] getLetters(Captcha captcha) throws Exception {
+ captcha.crop(257, 140, 0, 0);
+ ArrayList let = new ArrayList();
+ Vector objs = captcha.getObjects(0.7, 0.7);
+ // EasyCaptcha.mergeObjectsBasic(objs, captcha, 3);
+ Collections.sort(objs);
+ for (PixelObject pixelObject : objs) {
+ if (pixelObject.getArea() > 3) let.add(pixelObject.toLetter());
+ }
+ int c = 0;
+ for (ListIterator iterator = let.listIterator(let.size()); iterator.hasPrevious() && c++ < 10;) {
+ iterator.previous();
+ iterator.remove();
+ }
+ Letter[] lets = let.toArray(new Letter[] {});
+ String code = "";
+ for (Letter letter : lets) {
+ LetterComperator r = captcha.owner.getLetter(letter);
+ code += r.getDecodedValue();
+ letter.detected = r;
+ }
+ File imageFile = captcha.owner.getResourceFile("images/" + code + ".png");
+ if (imageFile.exists()) {
+ captcha.reset();
+ Captcha pixToFind = captcha.owner.createCaptcha(JDImage.getImage(imageFile));
+ Letter l = captcha.createLetter();
+ l.setGrid(pixToFind.grid);
+
+ BackGroundImageManager bgit = new BackGroundImageManager(captcha);
+ bgit.clearCaptchaAll();
+ captcha.crop(0, 0, 0, 10);
+ ArrayList obj = getObjects(captcha, 3);
+
+ ColorLetterComperator mainCLC = new ColorLetterComperator(l, l);
+ double bestVal = 10000000.0;
+ Letter bestLetter = null;
+ for (PixelObject pixelObject : obj) {
+ if (pixelObject.getWidth() > 63 || pixelObject.getHeight() > 63) {
+ PixelObject[] objb = pixelObject.splitAt(62);
+ for (PixelObject pixelObject2 : objb) {
+ if(pixelObject.getHeight() > 63)
+ {
+ PixelObject[] objb2 = pixelObject2.horizintalSplitAt(62);
+ for (PixelObject pixelObject3 : objb2) {
+ Letter b = pixelObject3.toColoredLetter();
+ mainCLC.setLetterB(b);
+ double val = mainCLC.run();
+ if (val < bestVal) {
+ bestLetter = b;
+ bestVal = val;
+ }
+ }
+ }
+ else
+ {
+ Letter b = pixelObject2.toColoredLetter();
+ mainCLC.setLetterB(b);
+ double val = mainCLC.run();
+
+ if (val < bestVal) {
+ bestLetter = b;
+ bestVal = val;
+ }
+ }
+ }
+ } else {
+ Letter b = pixelObject.toColoredLetter();
+ mainCLC.setLetterB(b);
+ double val = mainCLC.run();
+
+ if (val < bestVal) {
+ bestLetter = b;
+ bestVal = val;
+ }
+ }
+
+ }
+ int x = bestLetter.getLocation()[0] + (bestLetter.getWidth() / 2);
+ int y = bestLetter.getLocation()[1] + (bestLetter.getHeight() / 2);
+ char[] tx = (x + ":" + y).toCharArray();
+ Letter[] ret = new Letter[tx.length];
+ for (int i = 0; i < tx.length; i++) {
+ Letter re = new Letter();
+ re.setDecodedValue(""+tx[i]);
+ LetterComperator let1 = new LetterComperator(re, re);
+ let1.setValityPercent(0);
+ re.detected=let1;
+ ret[i]=re;
+ }
+ return ret;
+ }
+
+ // Letter[] let = new Letter[obj.size()];
+ // for (int j = 0; j < let.length; j++) {
+ // let[j]=toLetter(obj.get(j), captcha);
+ // BasicWindow.showImage(obj.get(j).toLetter().getFullImage());
+
+ // }
+ return null;
+ }
+ public static Letter[] letterFilter(Letter[] org, JAntiCaptcha jac) {
+ return org;
+ }
+}
diff --git a/tools/SourceParser.java b/tools/SourceParser.java
index 220be03049..ea6878b371 100644
--- a/tools/SourceParser.java
+++ b/tools/SourceParser.java
@@ -59,7 +59,7 @@ public class SourceParser {
}
public static void main(String[] args) {
- parse("system.update.error.message");
+ parse("protect");
}
}