mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-01-13 06:53:19 -05:00
add an app to generate samples
This commit is contained in:
parent
5204833b9d
commit
b08f381f72
@ -58,6 +58,12 @@ class Captcha(throttle: Int) {
|
||||
image
|
||||
}
|
||||
|
||||
def generateChallengeSamples() = {
|
||||
providers.map {case (key, provider) =>
|
||||
(key, provider.returnChallenge())
|
||||
}
|
||||
}
|
||||
|
||||
def generateChallenge(param: Parameters): String = {
|
||||
//TODO: eval params to choose a provider
|
||||
val providerMap = getProvider()
|
||||
@ -202,3 +208,17 @@ object LCFramework{
|
||||
}
|
||||
}
|
||||
|
||||
object MakeSamples {
|
||||
def main(args: scala.Array[String]) {
|
||||
val captcha = new Captcha(2)
|
||||
val samples = captcha.generateChallengeSamples()
|
||||
samples.foreach {case (key, sample) =>
|
||||
val extensionMap = Map("image/png" -> "png", "image/gif" -> "gif")
|
||||
println(key + ": " + sample)
|
||||
|
||||
val outStream = new java.io.FileOutputStream("samples/"+key+"."+extensionMap(sample.contentType))
|
||||
outStream.write(sample.content)
|
||||
outStream.close
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user