nwo
stringlengths
6
76
sha
stringlengths
40
40
path
stringlengths
5
118
language
stringclasses
1 value
identifier
stringlengths
1
89
parameters
stringlengths
2
5.4k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
51.1k
docstring
stringlengths
1
17.6k
docstring_summary
stringlengths
0
7.02k
docstring_tokens
list
function
stringlengths
30
51.1k
function_tokens
list
url
stringlengths
85
218
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svm.py
python
toPyModel
(model_ptr)
return m
toPyModel(model_ptr) -> svm_model Convert a ctypes POINTER(svm_model) to a Python svm_model
toPyModel(model_ptr) -> svm_model
[ "toPyModel", "(", "model_ptr", ")", "-", ">", "svm_model" ]
def toPyModel(model_ptr): """ toPyModel(model_ptr) -> svm_model Convert a ctypes POINTER(svm_model) to a Python svm_model """ if bool(model_ptr) == False: raise ValueError("Null pointer") m = model_ptr.contents m.__createfrom__ = 'C' return m
[ "def", "toPyModel", "(", "model_ptr", ")", ":", "if", "bool", "(", "model_ptr", ")", "==", "False", ":", "raise", "ValueError", "(", "\"Null pointer\"", ")", "m", "=", "model_ptr", ".", "contents", "m", ".", "__createfrom__", "=", "'C'", "return", "m" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svm.py#L293-L303
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
svm_read_problem
(data_file_name)
return (prob_y, prob_x)
svm_read_problem(data_file_name) -> [y, x] Read LIBSVM-format data from data_file_name and return labels y and data instances x.
svm_read_problem(data_file_name) -> [y, x]
[ "svm_read_problem", "(", "data_file_name", ")", "-", ">", "[", "y", "x", "]" ]
def svm_read_problem(data_file_name): """ svm_read_problem(data_file_name) -> [y, x] Read LIBSVM-format data from data_file_name and return labels y and data instances x. """ prob_y = [] prob_x = [] for line in open(data_file_name): line = line.split(None, 1) # In case an instance with all zero features ...
[ "def", "svm_read_problem", "(", "data_file_name", ")", ":", "prob_y", "=", "[", "]", "prob_x", "=", "[", "]", "for", "line", "in", "open", "(", "data_file_name", ")", ":", "line", "=", "line", ".", "split", "(", "None", ",", "1", ")", "# In case an ins...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L14-L34
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
svm_load_model
(model_file_name)
return model
svm_load_model(model_file_name) -> model Load a LIBSVM model from model_file_name and return.
svm_load_model(model_file_name) -> model
[ "svm_load_model", "(", "model_file_name", ")", "-", ">", "model" ]
def svm_load_model(model_file_name): """ svm_load_model(model_file_name) -> model Load a LIBSVM model from model_file_name and return. """ model = libsvm.svm_load_model(model_file_name.encode()) if not model: print("can't open model file %s" % model_file_name) return None model = toPyModel(model) return mo...
[ "def", "svm_load_model", "(", "model_file_name", ")", ":", "model", "=", "libsvm", ".", "svm_load_model", "(", "model_file_name", ".", "encode", "(", ")", ")", "if", "not", "model", ":", "print", "(", "\"can't open model file %s\"", "%", "model_file_name", ")", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L36-L47
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
svm_save_model
(model_file_name, model)
svm_save_model(model_file_name, model) -> None Save a LIBSVM model to the file model_file_name.
svm_save_model(model_file_name, model) -> None
[ "svm_save_model", "(", "model_file_name", "model", ")", "-", ">", "None" ]
def svm_save_model(model_file_name, model): """ svm_save_model(model_file_name, model) -> None Save a LIBSVM model to the file model_file_name. """ libsvm.svm_save_model(model_file_name.encode(), model)
[ "def", "svm_save_model", "(", "model_file_name", ",", "model", ")", ":", "libsvm", ".", "svm_save_model", "(", "model_file_name", ".", "encode", "(", ")", ",", "model", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L49-L55
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
evaluations
(ty, pv)
return (ACC, MSE, SCC)
evaluations(ty, pv) -> (ACC, MSE, SCC) Calculate accuracy, mean squared error and squared correlation coefficient using the true values (ty) and predicted values (pv).
evaluations(ty, pv) -> (ACC, MSE, SCC)
[ "evaluations", "(", "ty", "pv", ")", "-", ">", "(", "ACC", "MSE", "SCC", ")" ]
def evaluations(ty, pv): """ evaluations(ty, pv) -> (ACC, MSE, SCC) Calculate accuracy, mean squared error and squared correlation coefficient using the true values (ty) and predicted values (pv). """ if len(ty) != len(pv): raise ValueError("len(ty) must equal to len(pv)") total_correct = total_error = 0 sum...
[ "def", "evaluations", "(", "ty", ",", "pv", ")", ":", "if", "len", "(", "ty", ")", "!=", "len", "(", "pv", ")", ":", "raise", "ValueError", "(", "\"len(ty) must equal to len(pv)\"", ")", "total_correct", "=", "total_error", "=", "0", "sumv", "=", "sumy",...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L57-L84
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
svm_train
(arg1, arg2=None, arg3=None)
svm_train(y, x [, options]) -> model | ACC | MSE svm_train(prob [, options]) -> model | ACC | MSE svm_train(prob, param) -> model | ACC| MSE Train an SVM model from data (y, x) or an svm_problem prob using 'options' or an svm_parameter param. If '-v' is specified in 'options' (i.e., cross validation) either accu...
svm_train(y, x [, options]) -> model | ACC | MSE svm_train(prob [, options]) -> model | ACC | MSE svm_train(prob, param) -> model | ACC| MSE
[ "svm_train", "(", "y", "x", "[", "options", "]", ")", "-", ">", "model", "|", "ACC", "|", "MSE", "svm_train", "(", "prob", "[", "options", "]", ")", "-", ">", "model", "|", "ACC", "|", "MSE", "svm_train", "(", "prob", "param", ")", "-", ">", "m...
def svm_train(arg1, arg2=None, arg3=None): """ svm_train(y, x [, options]) -> model | ACC | MSE svm_train(prob [, options]) -> model | ACC | MSE svm_train(prob, param) -> model | ACC| MSE Train an SVM model from data (y, x) or an svm_problem prob using 'options' or an svm_parameter param. If '-v' is specified i...
[ "def", "svm_train", "(", "arg1", ",", "arg2", "=", "None", ",", "arg3", "=", "None", ")", ":", "prob", ",", "param", "=", "None", ",", "None", "if", "isinstance", "(", "arg1", ",", "(", "list", ",", "tuple", ")", ")", ":", "assert", "isinstance", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L86-L171
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
svmutil.py
python
svm_predict
(y, x, m, options="")
return pred_labels, (ACC, MSE, SCC), pred_values
svm_predict(y, x, m [, options]) -> (p_labels, p_acc, p_vals) Predict data (y, x) with the SVM model m. options: -b probability_estimates: whether to predict probability estimates, 0 or 1 (default 0); for one-class SVM only 0 is supported. -q : quiet mode (no outputs). The return tuple contains ...
svm_predict(y, x, m [, options]) -> (p_labels, p_acc, p_vals)
[ "svm_predict", "(", "y", "x", "m", "[", "options", "]", ")", "-", ">", "(", "p_labels", "p_acc", "p_vals", ")" ]
def svm_predict(y, x, m, options=""): """ svm_predict(y, x, m [, options]) -> (p_labels, p_acc, p_vals) Predict data (y, x) with the SVM model m. options: -b probability_estimates: whether to predict probability estimates, 0 or 1 (default 0); for one-class SVM only 0 is supported. -q : quiet mod...
[ "def", "svm_predict", "(", "y", ",", "x", ",", "m", ",", "options", "=", "\"\"", ")", ":", "def", "info", "(", "s", ")", ":", "print", "(", "s", ")", "predict_probability", "=", "0", "argv", "=", "options", ".", "split", "(", ")", "i", "=", "0"...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/svmutil.py#L173-L260
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/modpython_example.py
python
test
(req, name=Tests.__all__[0])
return """<html> <head> <title>PyCAPTCHA Example</title> </head> <body> <h1>PyCAPTCHA Example (for mod_python)</h1> <p> <b>%s</b>: %s </p> <p><img src="image?id=%s"/></p> <p> <form action="solution" method="get"> Enter the word shown: <input type="text" name="word"/> <input type="hidden" name="id" va...
Show a newly generated CAPTCHA of the given class. Default is the first class name given in Tests.__all__
Show a newly generated CAPTCHA of the given class. Default is the first class name given in Tests.__all__
[ "Show", "a", "newly", "generated", "CAPTCHA", "of", "the", "given", "class", ".", "Default", "is", "the", "first", "class", "name", "given", "in", "Tests", ".", "__all__" ]
def test(req, name=Tests.__all__[0]): """Show a newly generated CAPTCHA of the given class. Default is the first class name given in Tests.__all__ """ test = _getFactory(req).new(getattr(Tests, name)) # Make a list of tests other than the one we're using others = [] for t in Tests.__a...
[ "def", "test", "(", "req", ",", "name", "=", "Tests", ".", "__all__", "[", "0", "]", ")", ":", "test", "=", "_getFactory", "(", "req", ")", ".", "new", "(", "getattr", "(", "Tests", ",", "name", ")", ")", "# Make a list of tests other than the one we're ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/modpython_example.py#L27-L69
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/modpython_example.py
python
image
(req, id)
return apache.OK
Generate an image for the CAPTCHA with the given ID string
Generate an image for the CAPTCHA with the given ID string
[ "Generate", "an", "image", "for", "the", "CAPTCHA", "with", "the", "given", "ID", "string" ]
def image(req, id): """Generate an image for the CAPTCHA with the given ID string""" test = _getFactory(req).get(id) if not test: raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND req.content_type = "image/jpeg" test.render().save(req, "JPEG") return apache.OK
[ "def", "image", "(", "req", ",", "id", ")", ":", "test", "=", "_getFactory", "(", "req", ")", ".", "get", "(", "id", ")", "if", "not", "test", ":", "raise", "apache", ".", "SERVER_RETURN", ",", "apache", ".", "HTTP_NOT_FOUND", "req", ".", "content_ty...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/modpython_example.py#L72-L79
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/modpython_example.py
python
solution
(req, id, word)
return """<html> <head> <title>PyCAPTCHA Example</title> </head> <body> <h1>PyCAPTCHA Example</h1> <h2>%s</h2> <p><img src="image?id=%s"/></p> <p><b>%s</b></p> <p>You guessed: %s</p> <p>Possible solutions: %s</p> <p><a href="test">Try again</a></p> </body> </html> """ % (test.__class__.__name__, test.id, result, word, ...
Grade a CAPTCHA given a solution word
Grade a CAPTCHA given a solution word
[ "Grade", "a", "CAPTCHA", "given", "a", "solution", "word" ]
def solution(req, id, word): """Grade a CAPTCHA given a solution word""" test = _getFactory(req).get(id) if not test: raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND if not test.valid: # Invalid tests will always return False, to prevent # random trial-and-error attacks. This ...
[ "def", "solution", "(", "req", ",", "id", ",", "word", ")", ":", "test", "=", "_getFactory", "(", "req", ")", ".", "get", "(", "id", ")", "if", "not", "test", ":", "raise", "apache", ".", "SERVER_RETURN", ",", "apache", ".", "HTTP_NOT_FOUND", "if", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/modpython_example.py#L82-L111
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Words.py
python
WordList.read
(self)
Read words from disk
Read words from disk
[ "Read", "words", "from", "disk" ]
def read(self): """Read words from disk""" f = open(os.path.join(File.dataDir, "words", self.fileName)) self.words = [] for line in f.xreadlines(): line = line.strip() if not line: continue if line[0] == '#': continue ...
[ "def", "read", "(", "self", ")", ":", "f", "=", "open", "(", "os", ".", "path", ".", "join", "(", "File", ".", "dataDir", ",", "\"words\"", ",", "self", ".", "fileName", ")", ")", "self", ".", "words", "=", "[", "]", "for", "line", "in", "f", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Words.py#L26-L42
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Words.py
python
WordList.pick
(self)
return random.choice(self.words)
Pick a random word from the list, reading it in if necessary
Pick a random word from the list, reading it in if necessary
[ "Pick", "a", "random", "word", "from", "the", "list", "reading", "it", "in", "if", "necessary" ]
def pick(self): """Pick a random word from the list, reading it in if necessary""" if self.words is None: self.read() return random.choice(self.words)
[ "def", "pick", "(", "self", ")", ":", "if", "self", ".", "words", "is", "None", ":", "self", ".", "read", "(", ")", "return", "random", ".", "choice", "(", "self", ".", "words", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Words.py#L44-L48
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Base.py
python
BaseCaptcha.testSolutions
(self, solutions)
return numCorrect >= self.minCorrectSolutions and \ numIncorrect <= self.maxIncorrectSolutions
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
[ "Test", "whether", "the", "given", "solutions", "are", "sufficient", "for", "this", "CAPTCHA", ".", "A", "given", "CAPTCHA", "can", "only", "be", "tested", "once", "after", "that", "it", "is", "invalid", "and", "always", "returns", "False", ".", "This", "m...
def testSolutions(self, solutions): """Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective. """ if not self.valid: ...
[ "def", "testSolutions", "(", "self", ",", "solutions", ")", ":", "if", "not", "self", ".", "valid", ":", "return", "False", "self", ".", "valid", "=", "False", "numCorrect", "=", "0", "numIncorrect", "=", "0", "for", "solution", "in", "solutions", ":", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Base.py#L45-L64
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Base.py
python
Factory.new
(self, cls, *args, **kwargs)
return inst
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
[ "Create", "a", "new", "instance", "of", "our", "assigned", "BaseCaptcha", "subclass", "passing", "it", "any", "extra", "arguments", "we", "re", "given", ".", "This", "stores", "the", "result", "for", "later", "testing", "." ]
def new(self, cls, *args, **kwargs): """Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing. """ self.clean() inst = cls(*args, **kwargs) self.storedInstances[ins...
[ "def", "new", "(", "self", ",", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "storedInstances", "[", "inst", ".", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Base.py#L76-L84
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Base.py
python
Factory.get
(self, id)
return self.storedInstances.get(id)
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
[ "Retrieve", "the", "CAPTCHA", "with", "the", "given", "ID", ".", "If", "it", "s", "expired", "already", "this", "will", "return", "None", ".", "A", "typical", "web", "application", "will", "need", "to", "new", "()", "a", "CAPTCHA", "when", "generating", ...
def get(self, id): """Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered. """ ...
[ "def", "get", "(", "self", ",", "id", ")", ":", "return", "self", ".", "storedInstances", ".", "get", "(", "id", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Base.py#L86-L92
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Base.py
python
Factory.clean
(self)
Removed expired tests
Removed expired tests
[ "Removed", "expired", "tests" ]
def clean(self): """Removed expired tests""" expiredIds = [] now = time.time() for inst in self.storedInstances.itervalues(): if inst.creationTime + self.lifetime < now: expiredIds.append(inst.id) for id in expiredIds: del self.storedInstan...
[ "def", "clean", "(", "self", ")", ":", "expiredIds", "=", "[", "]", "now", "=", "time", ".", "time", "(", ")", "for", "inst", "in", "self", ".", "storedInstances", ".", "itervalues", "(", ")", ":", "if", "inst", ".", "creationTime", "+", "self", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Base.py#L94-L102
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Base.py
python
Factory.test
(self, id, solutions)
return result
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
[ "Test", "the", "given", "list", "of", "solutions", "against", "the", "BaseCaptcha", "instance", "created", "earlier", "with", "the", "given", "id", ".", "Returns", "True", "if", "the", "test", "passed", "False", "on", "failure", ".", "In", "either", "case", ...
def test(self, id, solutions): """Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id. ...
[ "def", "test", "(", "self", ",", "id", ",", "solutions", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "self", ".", "storedInstances", ".", "get", "(", "id", ")", "if", "not", "inst", ":", "return", "False", "result", "=", "inst", ".", "...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Base.py#L104-L115
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/File.py
python
RandomFileFactory._checkExtension
(self, name)
return False
Check the file against our given list of extensions
Check the file against our given list of extensions
[ "Check", "the", "file", "against", "our", "given", "list", "of", "extensions" ]
def _checkExtension(self, name): """Check the file against our given list of extensions""" for ext in self.extensions: if name.endswith(ext): return True return False
[ "def", "_checkExtension", "(", "self", ",", "name", ")", ":", "for", "ext", "in", "self", ".", "extensions", ":", "if", "name", ".", "endswith", "(", "ext", ")", ":", "return", "True", "return", "False" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/File.py#L28-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/File.py
python
RandomFileFactory._findFullPaths
(self)
return paths
From our given file list, find a list of full paths to files
From our given file list, find a list of full paths to files
[ "From", "our", "given", "file", "list", "find", "a", "list", "of", "full", "paths", "to", "files" ]
def _findFullPaths(self): """From our given file list, find a list of full paths to files""" paths = [] for name in self.fileList: path = os.path.join(dataDir, self.basePath, name) if os.path.isdir(path): for content in os.listdir(path): ...
[ "def", "_findFullPaths", "(", "self", ")", ":", "paths", "=", "[", "]", "for", "name", "in", "self", ".", "fileList", ":", "path", "=", "os", ".", "path", ".", "join", "(", "dataDir", ",", "self", ".", "basePath", ",", "name", ")", "if", "os", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/File.py#L35-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Visual/Base.py
python
ImageCaptcha.getImage
(self)
return self._image
Get a PIL image representing this CAPTCHA test, creating it if necessary
Get a PIL image representing this CAPTCHA test, creating it if necessary
[ "Get", "a", "PIL", "image", "representing", "this", "CAPTCHA", "test", "creating", "it", "if", "necessary" ]
def getImage(self): """Get a PIL image representing this CAPTCHA test, creating it if necessary""" if not self._image: self._image = self.render() return self._image
[ "def", "getImage", "(", "self", ")", ":", "if", "not", "self", ".", "_image", ":", "self", ".", "_image", "=", "self", ".", "render", "(", ")", "return", "self", ".", "_image" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Visual/Base.py#L29-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Visual/Base.py
python
ImageCaptcha.getLayers
(self)
return []
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
[ "Subclasses", "must", "override", "this", "to", "return", "a", "list", "of", "Layer", "instances", "to", "render", ".", "Lists", "within", "the", "list", "of", "layers", "are", "recursively", "rendered", "." ]
def getLayers(self): """Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered. """ return []
[ "def", "getLayers", "(", "self", ")", ":", "return", "[", "]" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Visual/Base.py#L35-L39
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Visual/Base.py
python
ImageCaptcha.render
(self, size=None)
return self._renderList(self._layers, Image.new("RGB", size))
Render this CAPTCHA, returning a PIL image
Render this CAPTCHA, returning a PIL image
[ "Render", "this", "CAPTCHA", "returning", "a", "PIL", "image" ]
def render(self, size=None): """Render this CAPTCHA, returning a PIL image""" if size is None: size = self.defaultSize img = Image.new("RGB", size) return self._renderList(self._layers, Image.new("RGB", size))
[ "def", "render", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "size", "=", "self", ".", "defaultSize", "img", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "size", ")", "return", "self", ".", "_renderList", "("...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Visual/Base.py#L41-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Visual/Text.py
python
FontFactory.pick
(self)
return (fileName, size)
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
[ "Returns", "a", "(", "fileName", "size", ")", "tuple", "that", "can", "be", "passed", "to", "ImageFont", ".", "truetype", "()" ]
def pick(self): """Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()""" fileName = File.RandomFileFactory.pick(self) size = int(random.uniform(self.minSize, self.maxSize) + 0.5) return (fileName, size)
[ "def", "pick", "(", "self", ")", ":", "fileName", "=", "File", ".", "RandomFileFactory", ".", "pick", "(", "self", ")", "size", "=", "int", "(", "random", ".", "uniform", "(", "self", ".", "minSize", ",", "self", ".", "maxSize", ")", "+", "0.5", ")...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Visual/Text.py#L34-L38
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/Captcha/Visual/Distortions.py
python
WarpBase.getTransform
(self, image)
return lambda x, y: (x, y)
Return a transformation function, subclasses should override this
Return a transformation function, subclasses should override this
[ "Return", "a", "transformation", "function", "subclasses", "should", "override", "this" ]
def getTransform(self, image): """Return a transformation function, subclasses should override this""" return lambda x, y: (x, y)
[ "def", "getTransform", "(", "self", ",", "image", ")", ":", "return", "lambda", "x", ",", "y", ":", "(", "x", ",", "y", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/Captcha/Visual/Distortions.py#L50-L52
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/setup/my_install_data.py
python
Data_Files.debug_print
(self, msg)
Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true.
[ "Print", "msg", "to", "stdout", "if", "the", "global", "DEBUG", "(", "taken", "from", "the", "DISTUTILS_DEBUG", "environment", "variable", ")", "flag", "is", "true", "." ]
def debug_print (self, msg): """Print 'msg' to stdout if the global DEBUG (taken from the DISTUTILS_DEBUG environment variable) flag is true. """ from distutils.core import DEBUG if DEBUG: print msg
[ "def", "debug_print", "(", "self", ",", "msg", ")", ":", "from", "distutils", ".", "core", "import", "DEBUG", "if", "DEBUG", ":", "print", "msg" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/setup/my_install_data.py#L72-L78
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/setup/my_install_data.py
python
Data_Files.finalize
(self)
complete the files list by processing the given template
complete the files list by processing the given template
[ "complete", "the", "files", "list", "by", "processing", "the", "given", "template" ]
def finalize(self): """ complete the files list by processing the given template """ if self.finalized: return if self.files == None: self.files = [] if self.template != None: if type(self.template) == StringType: self.template = string...
[ "def", "finalize", "(", "self", ")", ":", "if", "self", ".", "finalized", ":", "return", "if", "self", ".", "files", "==", "None", ":", "self", ".", "files", "=", "[", "]", "if", "self", ".", "template", "!=", "None", ":", "if", "type", "(", "sel...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/setup/my_install_data.py#L81-L96
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/setup/my_install_data.py
python
my_install_data.check_data
(self,d)
return d
check if data are in new format, if not create a suitable object. returns finalized data object
check if data are in new format, if not create a suitable object. returns finalized data object
[ "check", "if", "data", "are", "in", "new", "format", "if", "not", "create", "a", "suitable", "object", ".", "returns", "finalized", "data", "object" ]
def check_data(self,d): """ check if data are in new format, if not create a suitable object. returns finalized data object """ if not isinstance(d, Data_Files): self.warn(("old-style data files list found " "-- please convert to Data_Files instanc...
[ "def", "check_data", "(", "self", ",", "d", ")", ":", "if", "not", "isinstance", "(", "d", ",", "Data_Files", ")", ":", "self", ".", "warn", "(", "(", "\"old-style data files list found \"", "\"-- please convert to Data_Files instance\"", ")", ")", "if", "type",...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/setup/my_install_data.py#L105-L125
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
getChallenge
()
return key
Returns a string, which should be placed as a hidden field on a web form. This string identifies a particular challenge, and is needed later for: - retrieving the image file for viewing the challenge, via call to getImageData() - testing a response to the challenge, via call to testSol...
Returns a string, which should be placed as a hidden field on a web form. This string identifies a particular challenge, and is needed later for: - retrieving the image file for viewing the challenge, via call to getImageData() - testing a response to the challenge, via call to testSol...
[ "Returns", "a", "string", "which", "should", "be", "placed", "as", "a", "hidden", "field", "on", "a", "web", "form", ".", "This", "string", "identifies", "a", "particular", "challenge", "and", "is", "needed", "later", "for", ":", "-", "retrieving", "the", ...
def getChallenge(): """ Returns a string, which should be placed as a hidden field on a web form. This string identifies a particular challenge, and is needed later for: - retrieving the image file for viewing the challenge, via call to getImageData() - testing a response to th...
[ "def", "getChallenge", "(", ")", ":", "# get a CAPTCHA object", "g", "=", "PseudoGimpy", "(", ")", "# retrieve text solution", "answer", "=", "g", ".", "solutions", "[", "0", "]", "# generate a unique id under which to save it", "id", "=", "_generateId", "(", "answe...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L81-L120
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
testSolution
(key, guess)
Tests if guess is a correct solution
Tests if guess is a correct solution
[ "Tests", "if", "guess", "is", "a", "correct", "solution" ]
def testSolution(key, guess): """ Tests if guess is a correct solution """ try: id, expiry, sig = _decodeKey(key) # test for timeout if time.time() > expiry: # sorry, timed out, too late _delImage(id) return False # test for past usag...
[ "def", "testSolution", "(", "key", ",", "guess", ")", ":", "try", ":", "id", ",", "expiry", ",", "sig", "=", "_decodeKey", "(", "key", ")", "# test for timeout", "if", "time", ".", "time", "(", ")", ">", "expiry", ":", "# sorry, timed out, too late", "_d...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L126-L156
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
_encodeKey
(id, answer)
return key
Encodes the challenge ID and the answer into a string which is safe to give to a potentially hostile client The key is base64-encoding of 'id:expirytime:answer'
Encodes the challenge ID and the answer into a string which is safe to give to a potentially hostile client
[ "Encodes", "the", "challenge", "ID", "and", "the", "answer", "into", "a", "string", "which", "is", "safe", "to", "give", "to", "a", "potentially", "hostile", "client" ]
def _encodeKey(id, answer): """ Encodes the challenge ID and the answer into a string which is safe to give to a potentially hostile client The key is base64-encoding of 'id:expirytime:answer' """ expiryTime = int(time.time() + captchaTimeout) sig = _signChallenge(id, answer, expiryTime) ...
[ "def", "_encodeKey", "(", "id", ",", "answer", ")", ":", "expiryTime", "=", "int", "(", "time", ".", "time", "(", ")", "+", "captchaTimeout", ")", "sig", "=", "_signChallenge", "(", "id", ",", "answer", ",", "expiryTime", ")", "raw", "=", "\"%s:%x:%s\"...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L161-L172
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
_decodeKey
(key)
return id, expiry, sig
decodes a given key, returns id, expiry time and signature
decodes a given key, returns id, expiry time and signature
[ "decodes", "a", "given", "key", "returns", "id", "expiry", "time", "and", "signature" ]
def _decodeKey(key): """ decodes a given key, returns id, expiry time and signature """ raw = base64.decodestring(key) id, expiry, sig = raw.split(":", 2) expiry = int(expiry, 16) return id, expiry, sig
[ "def", "_decodeKey", "(", "key", ")", ":", "raw", "=", "base64", ".", "decodestring", "(", "key", ")", "id", ",", "expiry", ",", "sig", "=", "raw", ".", "split", "(", "\":\"", ",", "2", ")", "expiry", "=", "int", "(", "expiry", ",", "16", ")", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L174-L181
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
_generateId
(solution)
return sha.new( "%s%s%s" % ( captchaSecretKey, solution, random.random())).hexdigest()[:10]
returns a pseudo-random id under which picture gets stored
returns a pseudo-random id under which picture gets stored
[ "returns", "a", "pseudo", "-", "random", "id", "under", "which", "picture", "gets", "stored" ]
def _generateId(solution): """ returns a pseudo-random id under which picture gets stored """ return sha.new( "%s%s%s" % ( captchaSecretKey, solution, random.random())).hexdigest()[:10]
[ "def", "_generateId", "(", "solution", ")", ":", "return", "sha", ".", "new", "(", "\"%s%s%s\"", "%", "(", "captchaSecretKey", ",", "solution", ",", "random", ".", "random", "(", ")", ")", ")", ".", "hexdigest", "(", ")", "[", ":", "10", "]" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L187-L194
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
_delImage
(id)
deletes image from tmp dir, no longer wanted
deletes image from tmp dir, no longer wanted
[ "deletes", "image", "from", "tmp", "dir", "no", "longer", "wanted" ]
def _delImage(id): """ deletes image from tmp dir, no longer wanted """ try: imgPath = _getImagePath(id) if os.path.isfile(imgPath): os.unlink(imgPath) except: traceback.print_exc() pass
[ "def", "_delImage", "(", "id", ")", ":", "try", ":", "imgPath", "=", "_getImagePath", "(", "id", ")", "if", "os", ".", "path", ".", "isfile", "(", "imgPath", ")", ":", "os", ".", "unlink", "(", "imgPath", ")", "except", ":", "traceback", ".", "prin...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L199-L209
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/contrib/ezcaptcha.py
python
_demo
()
Presents a demo of this captcha module. If you run this file as a CGI in your web server, you'll see the demo in action
Presents a demo of this captcha module. If you run this file as a CGI in your web server, you'll see the demo in action
[ "Presents", "a", "demo", "of", "this", "captcha", "module", ".", "If", "you", "run", "this", "file", "as", "a", "CGI", "in", "your", "web", "server", "you", "ll", "see", "the", "demo", "in", "action" ]
def _demo(): """ Presents a demo of this captcha module. If you run this file as a CGI in your web server, you'll see the demo in action """ import cgi fields = cgi.FieldStorage() cmd = fields.getvalue("cmd", "") if not cmd: # first view key = getChallenge()...
[ "def", "_demo", "(", ")", ":", "import", "cgi", "fields", "=", "cgi", ".", "FieldStorage", "(", ")", "cmd", "=", "fields", ".", "getvalue", "(", "\"cmd\"", ",", "\"\"", ")", "if", "not", "cmd", ":", "# first view", "key", "=", "getChallenge", "(", ")...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/contrib/ezcaptcha.py#L213-L301
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Words.py
python
WordList.read
(self)
Read words from disk
Read words from disk
[ "Read", "words", "from", "disk" ]
def read(self): """Read words from disk""" f = open(os.path.join(File.dataDir, "words", self.fileName)) self.words = [] for line in f.xreadlines(): line = line.strip() if not line: continue if line[0] == '#': continue ...
[ "def", "read", "(", "self", ")", ":", "f", "=", "open", "(", "os", ".", "path", ".", "join", "(", "File", ".", "dataDir", ",", "\"words\"", ",", "self", ".", "fileName", ")", ")", "self", ".", "words", "=", "[", "]", "for", "line", "in", "f", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Words.py#L26-L42
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Words.py
python
WordList.pick
(self)
return random.choice(self.words)
Pick a random word from the list, reading it in if necessary
Pick a random word from the list, reading it in if necessary
[ "Pick", "a", "random", "word", "from", "the", "list", "reading", "it", "in", "if", "necessary" ]
def pick(self): """Pick a random word from the list, reading it in if necessary""" if self.words is None: self.read() return random.choice(self.words)
[ "def", "pick", "(", "self", ")", ":", "if", "self", ".", "words", "is", "None", ":", "self", ".", "read", "(", ")", "return", "random", ".", "choice", "(", "self", ".", "words", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Words.py#L44-L48
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Base.py
python
BaseCaptcha.testSolutions
(self, solutions)
return numCorrect >= self.minCorrectSolutions and \ numIncorrect <= self.maxIncorrectSolutions
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
[ "Test", "whether", "the", "given", "solutions", "are", "sufficient", "for", "this", "CAPTCHA", ".", "A", "given", "CAPTCHA", "can", "only", "be", "tested", "once", "after", "that", "it", "is", "invalid", "and", "always", "returns", "False", ".", "This", "m...
def testSolutions(self, solutions): """Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective. """ if not self.valid: ...
[ "def", "testSolutions", "(", "self", ",", "solutions", ")", ":", "if", "not", "self", ".", "valid", ":", "return", "False", "self", ".", "valid", "=", "False", "numCorrect", "=", "0", "numIncorrect", "=", "0", "for", "solution", "in", "solutions", ":", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Base.py#L45-L64
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Base.py
python
Factory.new
(self, cls, *args, **kwargs)
return inst
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
[ "Create", "a", "new", "instance", "of", "our", "assigned", "BaseCaptcha", "subclass", "passing", "it", "any", "extra", "arguments", "we", "re", "given", ".", "This", "stores", "the", "result", "for", "later", "testing", "." ]
def new(self, cls, *args, **kwargs): """Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing. """ self.clean() inst = cls(*args, **kwargs) self.storedInstances[ins...
[ "def", "new", "(", "self", ",", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "storedInstances", "[", "inst", ".", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Base.py#L76-L84
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Base.py
python
Factory.get
(self, id)
return self.storedInstances.get(id)
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
[ "Retrieve", "the", "CAPTCHA", "with", "the", "given", "ID", ".", "If", "it", "s", "expired", "already", "this", "will", "return", "None", ".", "A", "typical", "web", "application", "will", "need", "to", "new", "()", "a", "CAPTCHA", "when", "generating", ...
def get(self, id): """Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered. """ ...
[ "def", "get", "(", "self", ",", "id", ")", ":", "return", "self", ".", "storedInstances", ".", "get", "(", "id", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Base.py#L86-L92
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Base.py
python
Factory.clean
(self)
Removed expired tests
Removed expired tests
[ "Removed", "expired", "tests" ]
def clean(self): """Removed expired tests""" expiredIds = [] now = time.time() for inst in self.storedInstances.itervalues(): if inst.creationTime + self.lifetime < now: expiredIds.append(inst.id) for id in expiredIds: del self.storedInstan...
[ "def", "clean", "(", "self", ")", ":", "expiredIds", "=", "[", "]", "now", "=", "time", ".", "time", "(", ")", "for", "inst", "in", "self", ".", "storedInstances", ".", "itervalues", "(", ")", ":", "if", "inst", ".", "creationTime", "+", "self", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Base.py#L94-L102
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Base.py
python
Factory.test
(self, id, solutions)
return result
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
[ "Test", "the", "given", "list", "of", "solutions", "against", "the", "BaseCaptcha", "instance", "created", "earlier", "with", "the", "given", "id", ".", "Returns", "True", "if", "the", "test", "passed", "False", "on", "failure", ".", "In", "either", "case", ...
def test(self, id, solutions): """Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id. ...
[ "def", "test", "(", "self", ",", "id", ",", "solutions", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "self", ".", "storedInstances", ".", "get", "(", "id", ")", "if", "not", "inst", ":", "return", "False", "result", "=", "inst", ".", "...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Base.py#L104-L115
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/File.py
python
RandomFileFactory._checkExtension
(self, name)
return False
Check the file against our given list of extensions
Check the file against our given list of extensions
[ "Check", "the", "file", "against", "our", "given", "list", "of", "extensions" ]
def _checkExtension(self, name): """Check the file against our given list of extensions""" for ext in self.extensions: if name.endswith(ext): return True return False
[ "def", "_checkExtension", "(", "self", ",", "name", ")", ":", "for", "ext", "in", "self", ".", "extensions", ":", "if", "name", ".", "endswith", "(", "ext", ")", ":", "return", "True", "return", "False" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/File.py#L28-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/File.py
python
RandomFileFactory._findFullPaths
(self)
return paths
From our given file list, find a list of full paths to files
From our given file list, find a list of full paths to files
[ "From", "our", "given", "file", "list", "find", "a", "list", "of", "full", "paths", "to", "files" ]
def _findFullPaths(self): """From our given file list, find a list of full paths to files""" paths = [] for name in self.fileList: path = os.path.join(dataDir, self.basePath, name) if os.path.isdir(path): for content in os.listdir(path): ...
[ "def", "_findFullPaths", "(", "self", ")", ":", "paths", "=", "[", "]", "for", "name", "in", "self", ".", "fileList", ":", "path", "=", "os", ".", "path", ".", "join", "(", "dataDir", ",", "self", ".", "basePath", ",", "name", ")", "if", "os", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/File.py#L35-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Visual/Base.py
python
ImageCaptcha.getImage
(self)
return self._image
Get a PIL image representing this CAPTCHA test, creating it if necessary
Get a PIL image representing this CAPTCHA test, creating it if necessary
[ "Get", "a", "PIL", "image", "representing", "this", "CAPTCHA", "test", "creating", "it", "if", "necessary" ]
def getImage(self): """Get a PIL image representing this CAPTCHA test, creating it if necessary""" if not self._image: self._image = self.render() return self._image
[ "def", "getImage", "(", "self", ")", ":", "if", "not", "self", ".", "_image", ":", "self", ".", "_image", "=", "self", ".", "render", "(", ")", "return", "self", ".", "_image" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Visual/Base.py#L29-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Visual/Base.py
python
ImageCaptcha.getLayers
(self)
return []
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
[ "Subclasses", "must", "override", "this", "to", "return", "a", "list", "of", "Layer", "instances", "to", "render", ".", "Lists", "within", "the", "list", "of", "layers", "are", "recursively", "rendered", "." ]
def getLayers(self): """Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered. """ return []
[ "def", "getLayers", "(", "self", ")", ":", "return", "[", "]" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Visual/Base.py#L35-L39
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Visual/Base.py
python
ImageCaptcha.render
(self, size=None)
return self._renderList(self._layers, Image.new("RGB", size))
Render this CAPTCHA, returning a PIL image
Render this CAPTCHA, returning a PIL image
[ "Render", "this", "CAPTCHA", "returning", "a", "PIL", "image" ]
def render(self, size=None): """Render this CAPTCHA, returning a PIL image""" if size is None: size = self.defaultSize img = Image.new("RGB", size) return self._renderList(self._layers, Image.new("RGB", size))
[ "def", "render", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "size", "=", "self", ".", "defaultSize", "img", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "size", ")", "return", "self", ".", "_renderList", "("...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Visual/Base.py#L41-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Visual/Text.py
python
FontFactory.pick
(self)
return (fileName, size)
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
[ "Returns", "a", "(", "fileName", "size", ")", "tuple", "that", "can", "be", "passed", "to", "ImageFont", ".", "truetype", "()" ]
def pick(self): """Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()""" fileName = File.RandomFileFactory.pick(self) size = int(random.uniform(self.minSize, self.maxSize) + 0.5) return (fileName, size)
[ "def", "pick", "(", "self", ")", ":", "fileName", "=", "File", ".", "RandomFileFactory", ".", "pick", "(", "self", ")", "size", "=", "int", "(", "random", ".", "uniform", "(", "self", ".", "minSize", ",", "self", ".", "maxSize", ")", "+", "0.5", ")...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Visual/Text.py#L34-L38
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib/Captcha/Visual/Distortions.py
python
WarpBase.getTransform
(self, image)
return lambda x, y: (x, y)
Return a transformation function, subclasses should override this
Return a transformation function, subclasses should override this
[ "Return", "a", "transformation", "function", "subclasses", "should", "override", "this" ]
def getTransform(self, image): """Return a transformation function, subclasses should override this""" return lambda x, y: (x, y)
[ "def", "getTransform", "(", "self", ",", "image", ")", ":", "return", "lambda", "x", ",", "y", ":", "(", "x", ",", "y", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib/Captcha/Visual/Distortions.py#L50-L52
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Words.py
python
WordList.read
(self)
Read words from disk
Read words from disk
[ "Read", "words", "from", "disk" ]
def read(self): """Read words from disk""" f = open(os.path.join(File.dataDir, "words", self.fileName)) self.words = [] for line in f.xreadlines(): line = line.strip() if not line: continue if line[0] == '#': continue ...
[ "def", "read", "(", "self", ")", ":", "f", "=", "open", "(", "os", ".", "path", ".", "join", "(", "File", ".", "dataDir", ",", "\"words\"", ",", "self", ".", "fileName", ")", ")", "self", ".", "words", "=", "[", "]", "for", "line", "in", "f", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Words.py#L26-L42
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Words.py
python
WordList.pick
(self)
return random.choice(self.words)
Pick a random word from the list, reading it in if necessary
Pick a random word from the list, reading it in if necessary
[ "Pick", "a", "random", "word", "from", "the", "list", "reading", "it", "in", "if", "necessary" ]
def pick(self): """Pick a random word from the list, reading it in if necessary""" if self.words is None: self.read() return random.choice(self.words)
[ "def", "pick", "(", "self", ")", ":", "if", "self", ".", "words", "is", "None", ":", "self", ".", "read", "(", ")", "return", "random", ".", "choice", "(", "self", ".", "words", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Words.py#L44-L48
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py
python
BaseCaptcha.testSolutions
(self, solutions)
return numCorrect >= self.minCorrectSolutions and \ numIncorrect <= self.maxIncorrectSolutions
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective.
[ "Test", "whether", "the", "given", "solutions", "are", "sufficient", "for", "this", "CAPTCHA", ".", "A", "given", "CAPTCHA", "can", "only", "be", "tested", "once", "after", "that", "it", "is", "invalid", "and", "always", "returns", "False", ".", "This", "m...
def testSolutions(self, solutions): """Test whether the given solutions are sufficient for this CAPTCHA. A given CAPTCHA can only be tested once, after that it is invalid and always returns False. This makes random guessing much less effective. """ if not self.valid: ...
[ "def", "testSolutions", "(", "self", ",", "solutions", ")", ":", "if", "not", "self", ".", "valid", ":", "return", "False", "self", ".", "valid", "=", "False", "numCorrect", "=", "0", "numIncorrect", "=", "0", "for", "solution", "in", "solutions", ":", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py#L45-L64
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py
python
Factory.new
(self, cls, *args, **kwargs)
return inst
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing.
[ "Create", "a", "new", "instance", "of", "our", "assigned", "BaseCaptcha", "subclass", "passing", "it", "any", "extra", "arguments", "we", "re", "given", ".", "This", "stores", "the", "result", "for", "later", "testing", "." ]
def new(self, cls, *args, **kwargs): """Create a new instance of our assigned BaseCaptcha subclass, passing it any extra arguments we're given. This stores the result for later testing. """ self.clean() inst = cls(*args, **kwargs) self.storedInstances[ins...
[ "def", "new", "(", "self", ",", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "storedInstances", "[", "inst", ".", ...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py#L76-L84
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py
python
Factory.get
(self, id)
return self.storedInstances.get(id)
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered.
[ "Retrieve", "the", "CAPTCHA", "with", "the", "given", "ID", ".", "If", "it", "s", "expired", "already", "this", "will", "return", "None", ".", "A", "typical", "web", "application", "will", "need", "to", "new", "()", "a", "CAPTCHA", "when", "generating", ...
def get(self, id): """Retrieve the CAPTCHA with the given ID. If it's expired already, this will return None. A typical web application will need to new() a CAPTCHA when generating an html page, then get() it later when its images or sounds must be rendered. """ ...
[ "def", "get", "(", "self", ",", "id", ")", ":", "return", "self", ".", "storedInstances", ".", "get", "(", "id", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py#L86-L92
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py
python
Factory.clean
(self)
Removed expired tests
Removed expired tests
[ "Removed", "expired", "tests" ]
def clean(self): """Removed expired tests""" expiredIds = [] now = time.time() for inst in self.storedInstances.itervalues(): if inst.creationTime + self.lifetime < now: expiredIds.append(inst.id) for id in expiredIds: del self.storedInstan...
[ "def", "clean", "(", "self", ")", ":", "expiredIds", "=", "[", "]", "now", "=", "time", ".", "time", "(", ")", "for", "inst", "in", "self", ".", "storedInstances", ".", "itervalues", "(", ")", ":", "if", "inst", ".", "creationTime", "+", "self", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py#L94-L102
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py
python
Factory.test
(self, id, solutions)
return result
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id.
[ "Test", "the", "given", "list", "of", "solutions", "against", "the", "BaseCaptcha", "instance", "created", "earlier", "with", "the", "given", "id", ".", "Returns", "True", "if", "the", "test", "passed", "False", "on", "failure", ".", "In", "either", "case", ...
def test(self, id, solutions): """Test the given list of solutions against the BaseCaptcha instance created earlier with the given id. Returns True if the test passed, False on failure. In either case, the test is invalidated. Returns False in the case of an invalid id. ...
[ "def", "test", "(", "self", ",", "id", ",", "solutions", ")", ":", "self", ".", "clean", "(", ")", "inst", "=", "self", ".", "storedInstances", ".", "get", "(", "id", ")", "if", "not", "inst", ":", "return", "False", "result", "=", "inst", ".", "...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Base.py#L104-L115
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/File.py
python
RandomFileFactory._checkExtension
(self, name)
return False
Check the file against our given list of extensions
Check the file against our given list of extensions
[ "Check", "the", "file", "against", "our", "given", "list", "of", "extensions" ]
def _checkExtension(self, name): """Check the file against our given list of extensions""" for ext in self.extensions: if name.endswith(ext): return True return False
[ "def", "_checkExtension", "(", "self", ",", "name", ")", ":", "for", "ext", "in", "self", ".", "extensions", ":", "if", "name", ".", "endswith", "(", "ext", ")", ":", "return", "True", "return", "False" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/File.py#L28-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/File.py
python
RandomFileFactory._findFullPaths
(self)
return paths
From our given file list, find a list of full paths to files
From our given file list, find a list of full paths to files
[ "From", "our", "given", "file", "list", "find", "a", "list", "of", "full", "paths", "to", "files" ]
def _findFullPaths(self): """From our given file list, find a list of full paths to files""" paths = [] for name in self.fileList: path = os.path.join(dataDir, self.basePath, name) if os.path.isdir(path): for content in os.listdir(path): ...
[ "def", "_findFullPaths", "(", "self", ")", ":", "paths", "=", "[", "]", "for", "name", "in", "self", ".", "fileList", ":", "path", "=", "os", ".", "path", ".", "join", "(", "dataDir", ",", "self", ".", "basePath", ",", "name", ")", "if", "os", "....
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/File.py#L35-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py
python
ImageCaptcha.getImage
(self)
return self._image
Get a PIL image representing this CAPTCHA test, creating it if necessary
Get a PIL image representing this CAPTCHA test, creating it if necessary
[ "Get", "a", "PIL", "image", "representing", "this", "CAPTCHA", "test", "creating", "it", "if", "necessary" ]
def getImage(self): """Get a PIL image representing this CAPTCHA test, creating it if necessary""" if not self._image: self._image = self.render() return self._image
[ "def", "getImage", "(", "self", ")", ":", "if", "not", "self", ".", "_image", ":", "self", ".", "_image", "=", "self", ".", "render", "(", ")", "return", "self", ".", "_image" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py#L29-L33
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py
python
ImageCaptcha.getLayers
(self)
return []
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered.
[ "Subclasses", "must", "override", "this", "to", "return", "a", "list", "of", "Layer", "instances", "to", "render", ".", "Lists", "within", "the", "list", "of", "layers", "are", "recursively", "rendered", "." ]
def getLayers(self): """Subclasses must override this to return a list of Layer instances to render. Lists within the list of layers are recursively rendered. """ return []
[ "def", "getLayers", "(", "self", ")", ":", "return", "[", "]" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py#L35-L39
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py
python
ImageCaptcha.render
(self, size=None)
return self._renderList(self._layers, Image.new("RGB", size))
Render this CAPTCHA, returning a PIL image
Render this CAPTCHA, returning a PIL image
[ "Render", "this", "CAPTCHA", "returning", "a", "PIL", "image" ]
def render(self, size=None): """Render this CAPTCHA, returning a PIL image""" if size is None: size = self.defaultSize img = Image.new("RGB", size) return self._renderList(self._layers, Image.new("RGB", size))
[ "def", "render", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "size", "=", "self", ".", "defaultSize", "img", "=", "Image", ".", "new", "(", "\"RGB\"", ",", "size", ")", "return", "self", ".", "_renderList", "("...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Base.py#L41-L46
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Text.py
python
FontFactory.pick
(self)
return (fileName, size)
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()
[ "Returns", "a", "(", "fileName", "size", ")", "tuple", "that", "can", "be", "passed", "to", "ImageFont", ".", "truetype", "()" ]
def pick(self): """Returns a (fileName, size) tuple that can be passed to ImageFont.truetype()""" fileName = File.RandomFileFactory.pick(self) size = int(random.uniform(self.minSize, self.maxSize) + 0.5) return (fileName, size)
[ "def", "pick", "(", "self", ")", ":", "fileName", "=", "File", ".", "RandomFileFactory", ".", "pick", "(", "self", ")", "size", "=", "int", "(", "random", ".", "uniform", "(", "self", ".", "minSize", ",", "self", ".", "maxSize", ")", "+", "0.5", ")...
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Text.py#L34-L38
00nanhai/captchacker2
7609141b51ff0cf3329608b8101df967cb74752f
pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Distortions.py
python
WarpBase.getTransform
(self, image)
return lambda x, y: (x, y)
Return a transformation function, subclasses should override this
Return a transformation function, subclasses should override this
[ "Return", "a", "transformation", "function", "subclasses", "should", "override", "this" ]
def getTransform(self, image): """Return a transformation function, subclasses should override this""" return lambda x, y: (x, y)
[ "def", "getTransform", "(", "self", ",", "image", ")", ":", "return", "lambda", "x", ",", "y", ":", "(", "x", ",", "y", ")" ]
https://github.com/00nanhai/captchacker2/blob/7609141b51ff0cf3329608b8101df967cb74752f/pycaptcha/build/lib.linux-x86_64-2.7/Captcha/Visual/Distortions.py#L50-L52
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
preprocessor.py
python
get_possion_noise
(image)
return tf.multiply(n, n_str)
Add poisson noise. This function approximate posson noise upto 2nd order. Assume images were in 0-255, and converted to the range of -1 to 1.
Add poisson noise.
[ "Add", "poisson", "noise", "." ]
def get_possion_noise(image): """Add poisson noise. This function approximate posson noise upto 2nd order. Assume images were in 0-255, and converted to the range of -1 to 1. """ n = tf.random_normal(shape=tf.shape(image), mean=0.0, stddev=1.0) # strength ~ sqrt image value in 255, divided by 1...
[ "def", "get_possion_noise", "(", "image", ")", ":", "n", "=", "tf", ".", "random_normal", "(", "shape", "=", "tf", ".", "shape", "(", "image", ")", ",", "mean", "=", "0.0", ",", "stddev", "=", "1.0", ")", "# strength ~ sqrt image value in 255, divided by 127...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/preprocessor.py#L16-L26
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
ops.py
python
expand_dims_1_to_4
(tensor, dims=None)
return tf.expand_dims( tf.expand_dims( tf.expand_dims(tensor, dims[0]), dims[1]), dims[2])
Expand dimension from 1 to 4. Useful for multiplying amplification factor.
Expand dimension from 1 to 4.
[ "Expand", "dimension", "from", "1", "to", "4", "." ]
def expand_dims_1_to_4(tensor, dims=None): """Expand dimension from 1 to 4. Useful for multiplying amplification factor. """ if not dims: dims = [-1, -1, -1] return tf.expand_dims( tf.expand_dims( tf.expand_dims(tensor, dims[0]), dims[1]), ...
[ "def", "expand_dims_1_to_4", "(", "tensor", ",", "dims", "=", "None", ")", ":", "if", "not", "dims", ":", "dims", "=", "[", "-", "1", ",", "-", "1", ",", "-", "1", "]", "return", "tf", ".", "expand_dims", "(", "tf", ".", "expand_dims", "(", "tf",...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/ops.py#L77-L88
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
magnet.py
python
MagNet3Frames.setup_for_inference
(self, checkpoint_dir, image_width, image_height)
Setup model for inference. Build computation graph, initialize variables, and load checkpoint.
Setup model for inference.
[ "Setup", "model", "for", "inference", "." ]
def setup_for_inference(self, checkpoint_dir, image_width, image_height): """Setup model for inference. Build computation graph, initialize variables, and load checkpoint. """ self.image_width = image_width self.image_height = image_height # Figure out image dimension ...
[ "def", "setup_for_inference", "(", "self", ",", "checkpoint_dir", ",", "image_width", ",", "image_height", ")", ":", "self", ".", "image_width", "=", "image_width", "self", ".", "image_height", "=", "image_height", "# Figure out image dimension", "self", ".", "_buil...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/magnet.py#L198-L215
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
magnet.py
python
MagNet3Frames.inference
(self, frameA, frameB, amplification_factor)
return out_amp
Run Magnification on two frames. Args: frameA: path to first frame frameB: path to second frame amplification_factor: float for amplification factor
Run Magnification on two frames.
[ "Run", "Magnification", "on", "two", "frames", "." ]
def inference(self, frameA, frameB, amplification_factor): """Run Magnification on two frames. Args: frameA: path to first frame frameB: path to second frame amplification_factor: float for amplification factor """ in_frames = [load_train_data([frameA...
[ "def", "inference", "(", "self", ",", "frameA", ",", "frameB", ",", "amplification_factor", ")", ":", "in_frames", "=", "[", "load_train_data", "(", "[", "frameA", ",", "frameB", ",", "frameB", "]", ",", "gray_scale", "=", "self", ".", "n_channels", "==", ...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/magnet.py#L217-L233
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
magnet.py
python
MagNet3Frames.run
(self, checkpoint_dir, vid_dir, frame_ext, out_dir, amplification_factor, velocity_mag=False)
Magnify a video in the two-frames mode. Args: checkpoint_dir: checkpoint directory. vid_dir: directory containing video frames videos are processed in sorted order. out_dir: directory to place output frames and resulting video. amplification_facto...
Magnify a video in the two-frames mode.
[ "Magnify", "a", "video", "in", "the", "two", "-", "frames", "mode", "." ]
def run(self, checkpoint_dir, vid_dir, frame_ext, out_dir, amplification_factor, velocity_mag=False): """Magnify a video in the two-frames mode. Args: checkpoint_dir: checkpoint directory. vid_dir: directory...
[ "def", "run", "(", "self", ",", "checkpoint_dir", ",", "vid_dir", ",", "frame_ext", ",", "out_dir", ",", "amplification_factor", ",", "velocity_mag", "=", "False", ")", ":", "vid_name", "=", "os", ".", "path", ".", "basename", "(", "out_dir", ")", "# make ...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/magnet.py#L235-L286
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
magnet.py
python
MagNet3Frames._build_IIR_filtering_graphs
(self)
Assume a_0 = 1
Assume a_0 = 1
[ "Assume", "a_0", "=", "1" ]
def _build_IIR_filtering_graphs(self): """ Assume a_0 = 1 """ self.input_image = tf.placeholder(tf.float32, [1, self.image_height, self.image_width, self.n_c...
[ "def", "_build_IIR_filtering_graphs", "(", "self", ")", ":", "self", ".", "input_image", "=", "tf", ".", "placeholder", "(", "tf", ".", "float32", ",", "[", "1", ",", "self", ".", "image_height", ",", "self", ".", "image_width", ",", "self", ".", "n_chan...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/magnet.py#L289-L329
12dmodel/deep_motion_mag
485243bd7428d08059c313321b5e6ebfd7f61991
magnet.py
python
MagNet3Frames.run_temporal
(self, checkpoint_dir, vid_dir, frame_ext, out_dir, amplification_factor, fl, fh, fs, n_filter_tap, filter_type)
Magnify video with a temporal filter. Args: checkpoint_dir: checkpoint directory. vid_dir: directory containing video frames videos are processed in sorted order. out_dir: directory to place output frames and resulting video. amplification_factor:...
Magnify video with a temporal filter.
[ "Magnify", "video", "with", "a", "temporal", "filter", "." ]
def run_temporal(self, checkpoint_dir, vid_dir, frame_ext, out_dir, amplification_factor, fl, fh, fs, n_filter_tap, filter_type): """Magnify vid...
[ "def", "run_temporal", "(", "self", ",", "checkpoint_dir", ",", "vid_dir", ",", "frame_ext", ",", "out_dir", ",", "amplification_factor", ",", "fl", ",", "fh", ",", "fs", ",", "n_filter_tap", ",", "filter_type", ")", ":", "nyq", "=", "fs", "/", "2.0", "i...
https://github.com/12dmodel/deep_motion_mag/blob/485243bd7428d08059c313321b5e6ebfd7f61991/magnet.py#L331-L512
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
SiteFacade.__init__
(self, verbose)
Class constructor. Simply creates a blank list and assigns it to instance variable _sites that will be filled with retrieved info from sites defined in the xml configuration file. Argument(s): No arguments are required. Return value(s): Nothing is returned from this Met...
Class constructor. Simply creates a blank list and assigns it to instance variable _sites that will be filled with retrieved info from sites defined in the xml configuration file.
[ "Class", "constructor", ".", "Simply", "creates", "a", "blank", "list", "and", "assigns", "it", "to", "instance", "variable", "_sites", "that", "will", "be", "filled", "with", "retrieved", "info", "from", "sites", "defined", "in", "the", "xml", "configuration"...
def __init__(self, verbose): """ Class constructor. Simply creates a blank list and assigns it to instance variable _sites that will be filled with retrieved info from sites defined in the xml configuration file. Argument(s): No arguments are required. Return va...
[ "def", "__init__", "(", "self", ",", "verbose", ")", ":", "self", ".", "_sites", "=", "[", "]", "self", ".", "_verbose", "=", "verbose" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L57-L71
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
SiteFacade.runSiteAutomation
(self, webretrievedelay, proxy, targetlist, sourcelist, useragent, botoutputrequested, refreshremotexml, versionlocation)
Builds site objects representative of each site listed in the xml config file. Appends a Site object or one of it's subordinate objects to the _sites instance variable so retrieved information can be used. Returns nothing. Argument(s): webretrievedelay -- The amount of seconds t...
Builds site objects representative of each site listed in the xml config file. Appends a Site object or one of it's subordinate objects to the _sites instance variable so retrieved information can be used. Returns nothing.
[ "Builds", "site", "objects", "representative", "of", "each", "site", "listed", "in", "the", "xml", "config", "file", ".", "Appends", "a", "Site", "object", "or", "one", "of", "it", "s", "subordinate", "objects", "to", "the", "_sites", "instance", "variable",...
def runSiteAutomation(self, webretrievedelay, proxy, targetlist, sourcelist, useragent, botoutputrequested, refreshremotexml, versionlocation): """ Builds site objects representative of each site listed in the xml config file. Appends a Site object or one of it's subord...
[ "def", "runSiteAutomation", "(", "self", ",", "webretrievedelay", ",", "proxy", ",", "targetlist", ",", "sourcelist", ",", "useragent", ",", "botoutputrequested", ",", "refreshremotexml", ",", "versionlocation", ")", ":", "if", "refreshremotexml", ":", "SitesFile", ...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L73-L140
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
SiteFacade.Sites
(self)
return self._sites
Checks the instance variable _sites is empty or None. Returns _sites (the site list) or None if it is empty. Argument(s): No arguments are required. Return value(s): list -- of Site objects or its subordinates. None -- if _sites is empty or None. Restriction(s)...
Checks the instance variable _sites is empty or None. Returns _sites (the site list) or None if it is empty.
[ "Checks", "the", "instance", "variable", "_sites", "is", "empty", "or", "None", ".", "Returns", "_sites", "(", "the", "site", "list", ")", "or", "None", "if", "it", "is", "empty", "." ]
def Sites(self): """ Checks the instance variable _sites is empty or None. Returns _sites (the site list) or None if it is empty. Argument(s): No arguments are required. Return value(s): list -- of Site objects or its subordinates. None -- if _sites is e...
[ "def", "Sites", "(", "self", ")", ":", "if", "self", ".", "_sites", "is", "None", "or", "len", "(", "self", ".", "_sites", ")", "==", "0", ":", "return", "None", "return", "self", ".", "_sites" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L172-L189
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
SiteFacade.identifyTargetType
(self, target)
return "hostname"
Checks the target information provided to determine if it is a(n) IP Address in standard; CIDR or dash notation, or an MD5 hash, or a string hostname. Returns a string md5 if MD5 hash is identified. Returns the string ip if any IP Address format is found. Returns the string hostname ...
Checks the target information provided to determine if it is a(n) IP Address in standard; CIDR or dash notation, or an MD5 hash, or a string hostname. Returns a string md5 if MD5 hash is identified. Returns the string ip if any IP Address format is found. Returns the string hostname ...
[ "Checks", "the", "target", "information", "provided", "to", "determine", "if", "it", "is", "a", "(", "n", ")", "IP", "Address", "in", "standard", ";", "CIDR", "or", "dash", "notation", "or", "an", "MD5", "hash", "or", "a", "string", "hostname", ".", "R...
def identifyTargetType(self, target): """ Checks the target information provided to determine if it is a(n) IP Address in standard; CIDR or dash notation, or an MD5 hash, or a string hostname. Returns a string md5 if MD5 hash is identified. Returns the string ip if any IP...
[ "def", "identifyTargetType", "(", "self", ",", "target", ")", ":", "ipAddress", "=", "re", ".", "compile", "(", "'\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}'", ")", "ipFind", "=", "re", ".", "findall", "(", "ipAddress", ",", "target", ")", "if", "ipFind", "is",...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L191-L220
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.__init__
(self, domainurl, webretrievedelay, proxy, targettype, reportstringforresult, target, useragent, friendlyname, regex, fullurl, boutoutputrequested, importantproperty, params, headers, method, postdata, verbose)
Class constructor. Sets the instance variables based on input from the arguments supplied when Automater is run and what the xml config file stores. Argument(s): domainurl -- string defined in xml in the domainurl XML tag. webretrievedelay -- the amount of seconds to wait betwee...
Class constructor. Sets the instance variables based on input from the arguments supplied when Automater is run and what the xml config file stores.
[ "Class", "constructor", ".", "Sets", "the", "instance", "variables", "based", "on", "input", "from", "the", "arguments", "supplied", "when", "Automater", "is", "run", "and", "what", "the", "xml", "config", "file", "stores", "." ]
def __init__(self, domainurl, webretrievedelay, proxy, targettype, reportstringforresult, target, useragent, friendlyname, regex, fullurl, boutoutputrequested, importantproperty, params, headers, method, postdata, verbose): """ Class constructor. Sets the instance varia...
[ "def", "__init__", "(", "self", ",", "domainurl", ",", "webretrievedelay", ",", "proxy", ",", "targettype", ",", "reportstringforresult", ",", "target", ",", "useragent", ",", "friendlyname", ",", "regex", ",", "fullurl", ",", "boutoutputrequested", ",", "import...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L282-L353
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.buildSiteFromXML
(self, siteelement, webretrievedelay, proxy, targettype, target, useragent, botoutputrequested, verbose)
return Site(domainurl, webretrievedelay, proxy, targettype, reportstringforresult, target, useragent, sitefriendlyname, regex, fullurl, botoutputrequested, importantproperty, params, headers, method.upper(), postdata, verbose)
Utilizes the Class Methods within this Class to build the Site object. Returns a Site object that defines results returned during the web retrieval investigations. Argument(s): siteelement -- the siteelement object that will be used as the start element. webretrievedelay...
Utilizes the Class Methods within this Class to build the Site object. Returns a Site object that defines results returned during the web retrieval investigations.
[ "Utilizes", "the", "Class", "Methods", "within", "this", "Class", "to", "build", "the", "Site", "object", ".", "Returns", "a", "Site", "object", "that", "defines", "results", "returned", "during", "the", "web", "retrieval", "investigations", "." ]
def buildSiteFromXML(self, siteelement, webretrievedelay, proxy, targettype, target, useragent, botoutputrequested, verbose): """ Utilizes the Class Methods within this Class to build the Site object. Returns a Site object that defines results returned during the web ...
[ "def", "buildSiteFromXML", "(", "self", ",", "siteelement", ",", "webretrievedelay", ",", "proxy", ",", "targettype", ",", "target", ",", "useragent", ",", "botoutputrequested", ",", "verbose", ")", ":", "domainurl", "=", "siteelement", ".", "find", "(", "\"do...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L367-L411
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.buildStringOrListfromXML
(self, siteelement, elementstring)
return variablename
Takes in a siteelement and then elementstring and builds a string or list from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. Returns a list of those entries if entry XML tags are found or a string of t...
Takes in a siteelement and then elementstring and builds a string or list from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. Returns a list of those entries if entry XML tags are found or a string of t...
[ "Takes", "in", "a", "siteelement", "and", "then", "elementstring", "and", "builds", "a", "string", "or", "list", "from", "multiple", "entry", "XML", "tags", "defined", "in", "the", "xml", "config", "file", ".", "Returns", "None", "if", "there", "are", "no"...
def buildStringOrListfromXML(self, siteelement, elementstring): """ Takes in a siteelement and then elementstring and builds a string or list from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. ...
[ "def", "buildStringOrListfromXML", "(", "self", ",", "siteelement", ",", "elementstring", ")", ":", "variablename", "=", "\"\"", "if", "len", "(", "siteelement", ".", "find", "(", "elementstring", ")", ".", "findall", "(", "\"entry\"", ")", ")", "==", "0", ...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L414-L450
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.buildDictionaryFromXML
(self, siteelement, elementstring)
return variablename
Takes in a siteelement and then elementstring and builds a dictionary from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. Returns a dictionary of those entries if entry XML tags are found. Argu...
Takes in a siteelement and then elementstring and builds a dictionary from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. Returns a dictionary of those entries if entry XML tags are found.
[ "Takes", "in", "a", "siteelement", "and", "then", "elementstring", "and", "builds", "a", "dictionary", "from", "multiple", "entry", "XML", "tags", "defined", "in", "the", "xml", "config", "file", ".", "Returns", "None", "if", "there", "are", "no", "entry", ...
def buildDictionaryFromXML(self, siteelement, elementstring): """ Takes in a siteelement and then elementstring and builds a dictionary from multiple entry XML tags defined in the xml config file. Returns None if there are no entry XML tags for this specific elementstring. Return...
[ "def", "buildDictionaryFromXML", "(", "self", ",", "siteelement", ",", "elementstring", ")", ":", "variablename", "=", "\"\"", "try", ":", "if", "len", "(", "siteelement", ".", "find", "(", "elementstring", ")", ".", "findall", "(", "\"entry\"", ")", ")", ...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L453-L485
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.WebRetrieveDelay
(self)
return self._webretrievedelay
Returns the string representation of the number of seconds that will be delayed between site retrievals. Argument(s): No arguments are required. Return value(s): string -- representation of an integer that is the delay in seconds that will be used between each web site ...
Returns the string representation of the number of seconds that will be delayed between site retrievals.
[ "Returns", "the", "string", "representation", "of", "the", "number", "of", "seconds", "that", "will", "be", "delayed", "between", "site", "retrievals", "." ]
def WebRetrieveDelay(self): """ Returns the string representation of the number of seconds that will be delayed between site retrievals. Argument(s): No arguments are required. Return value(s): string -- representation of an integer that is the delay in ...
[ "def", "WebRetrieveDelay", "(", "self", ")", ":", "return", "self", ".", "_webretrievedelay" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L488-L503
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Proxy
(self)
return self._proxy
Returns the string representation of the proxy used. Argument(s): No arguments are required. Return value(s): string -- representation of the proxy used Restriction(s): This Method is tagged as a Property.
Returns the string representation of the proxy used.
[ "Returns", "the", "string", "representation", "of", "the", "proxy", "used", "." ]
def Proxy(self): """ Returns the string representation of the proxy used. Argument(s): No arguments are required. Return value(s): string -- representation of the proxy used Restriction(s): This Method is tagged as a Property. """ return...
[ "def", "Proxy", "(", "self", ")", ":", "return", "self", ".", "_proxy" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L506-L519
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.TargetType
(self)
return self._targetType
Returns the target type information whether that be ip, md5, or hostname. Argument(s): No arguments are required. Return value(s): string -- defined as ip, md5, or hostname. Restriction(s): This Method is tagged as a Property.
Returns the target type information whether that be ip, md5, or hostname.
[ "Returns", "the", "target", "type", "information", "whether", "that", "be", "ip", "md5", "or", "hostname", "." ]
def TargetType(self): """ Returns the target type information whether that be ip, md5, or hostname. Argument(s): No arguments are required. Return value(s): string -- defined as ip, md5, or hostname. Restriction(s): This Method is tagged as a Pr...
[ "def", "TargetType", "(", "self", ")", ":", "return", "self", ".", "_targetType" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L522-L536
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.ReportStringForResult
(self)
return self._reportstringforresult
Returns the string representing a report string tag that precedes reporting information so the user knows what specifics are being found. Argument(s): No arguments are required. Return value(s): string -- representing a tag for reporting information. Restrictio...
Returns the string representing a report string tag that precedes reporting information so the user knows what specifics are being found.
[ "Returns", "the", "string", "representing", "a", "report", "string", "tag", "that", "precedes", "reporting", "information", "so", "the", "user", "knows", "what", "specifics", "are", "being", "found", "." ]
def ReportStringForResult(self): """ Returns the string representing a report string tag that precedes reporting information so the user knows what specifics are being found. Argument(s): No arguments are required. Return value(s): string -- representing...
[ "def", "ReportStringForResult", "(", "self", ")", ":", "return", "self", ".", "_reportstringforresult" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L539-L554
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.FriendlyName
(self)
return self._friendlyName
Returns the string representing a friendly string name. Argument(s): No arguments are required. Return value(s): string -- representing friendly name for a tag for reporting. Restriction(s): This Method is tagged as a Property.
Returns the string representing a friendly string name.
[ "Returns", "the", "string", "representing", "a", "friendly", "string", "name", "." ]
def FriendlyName(self): """ Returns the string representing a friendly string name. Argument(s): No arguments are required. Return value(s): string -- representing friendly name for a tag for reporting. Restriction(s): This Method is tagged as a Propert...
[ "def", "FriendlyName", "(", "self", ")", ":", "return", "self", ".", "_friendlyName" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L557-L570
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.URL
(self)
return self._sourceurl
Returns the string representing the Domain URL which is required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): string -- representing the URL of the site. Restriction(s): This Method is tagged as a Prop...
Returns the string representing the Domain URL which is required to retrieve the information being investigated.
[ "Returns", "the", "string", "representing", "the", "Domain", "URL", "which", "is", "required", "to", "retrieve", "the", "information", "being", "investigated", "." ]
def URL(self): """ Returns the string representing the Domain URL which is required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): string -- representing the URL of the site. Restriction(s): ...
[ "def", "URL", "(", "self", ")", ":", "return", "self", ".", "_sourceurl" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L573-L587
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.ErrorMessage
(self)
return self._errormessage
Returns the string representing the Error Message. Argument(s): No arguments are required. Return value(s): string -- representing the error message to print to the standard output. Restriction(s): This Method is tagged as a Property.
Returns the string representing the Error Message.
[ "Returns", "the", "string", "representing", "the", "Error", "Message", "." ]
def ErrorMessage(self): """ Returns the string representing the Error Message. Argument(s): No arguments are required. Return value(s): string -- representing the error message to print to the standard output. Restriction(s): This Method is tagg...
[ "def", "ErrorMessage", "(", "self", ")", ":", "return", "self", ".", "_errormessage" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L590-L604
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.UserMessage
(self)
return self._usermessage
Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): string -- representing the full URL of the site...
Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated.
[ "Returns", "the", "string", "representing", "the", "Full", "URL", "which", "is", "the", "domain", "URL", "plus", "querystrings", "and", "other", "information", "required", "to", "retrieve", "the", "information", "being", "investigated", "." ]
def UserMessage(self): """ Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): stri...
[ "def", "UserMessage", "(", "self", ")", ":", "return", "self", ".", "_usermessage" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L607-L623
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.FullURL
(self)
return self._fullURL
Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): string -- representing the full URL of the site...
Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated.
[ "Returns", "the", "string", "representing", "the", "Full", "URL", "which", "is", "the", "domain", "URL", "plus", "querystrings", "and", "other", "information", "required", "to", "retrieve", "the", "information", "being", "investigated", "." ]
def FullURL(self): """ Returns the string representing the Full URL which is the domain URL plus querystrings and other information required to retrieve the information being investigated. Argument(s): No arguments are required. Return value(s): string -...
[ "def", "FullURL", "(", "self", ")", ":", "return", "self", ".", "_fullURL" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L626-L642
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.FullURL
(self, fullurl)
Determines if the parameter has characters and assigns it to the instance variable _fullURL if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user wants the target information to be plac...
Determines if the parameter has characters and assigns it to the instance variable _fullURL if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user wants the target information to be plac...
[ "Determines", "if", "the", "parameter", "has", "characters", "and", "assigns", "it", "to", "the", "instance", "variable", "_fullURL", "if", "it", "does", "after", "replacing", "the", "target", "information", "where", "the", "keyword", "%TARGET%", "is", "used", ...
def FullURL(self, fullurl): """ Determines if the parameter has characters and assigns it to the instance variable _fullURL if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user...
[ "def", "FullURL", "(", "self", ",", "fullurl", ")", ":", "if", "len", "(", "fullurl", ")", ">", "0", ":", "fullurlreplaced", "=", "fullurl", ".", "replace", "(", "\"%TARGET%\"", ",", "self", ".", "_target", ")", "self", ".", "_fullURL", "=", "fullurlre...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L645-L667
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.RegEx
(self)
return self._regex
Returns string representing the regex being investigated. Argument(s): No arguments are required. Return value(s): string -- representation of the Regex from the _regex instance variable. Restriction(s): This Method is tagged as a Property.
Returns string representing the regex being investigated.
[ "Returns", "string", "representing", "the", "regex", "being", "investigated", "." ]
def RegEx(self): """ Returns string representing the regex being investigated. Argument(s): No arguments are required. Return value(s): string -- representation of the Regex from the _regex instance variable. Restriction(s): This Method is tagge...
[ "def", "RegEx", "(", "self", ")", ":", "return", "self", ".", "_regex" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L670-L684
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.RegEx
(self, regex)
Determines if the parameter has characters and assigns it to the instance variable _regex if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user wants the target information to be placed...
Determines if the parameter has characters and assigns it to the instance variable _regex if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user wants the target information to be placed...
[ "Determines", "if", "the", "parameter", "has", "characters", "and", "assigns", "it", "to", "the", "instance", "variable", "_regex", "if", "it", "does", "after", "replacing", "the", "target", "information", "where", "the", "keyword", "%TARGET%", "is", "used", "...
def RegEx(self, regex): """ Determines if the parameter has characters and assigns it to the instance variable _regex if it does after replacing the target information where the keyword %TARGET% is used. This keyword will be used in the xml configuration file where the user wants...
[ "def", "RegEx", "(", "self", ",", "regex", ")", ":", "if", "len", "(", "regex", ")", ">", "0", ":", "try", ":", "regexreplaced", "=", "regex", ".", "replace", "(", "\"%TARGET%\"", ",", "self", ".", "_target", ")", "self", ".", "_regex", "=", "regex...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L687-L715
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.BotOutputRequested
(self)
return self._botOutputRequested
Returns a true if the -b option was requested when the program was run. This identifies if the program is to run a more silent version of output during the run to help bots and other small format requirements. Argument(s): No arguments are required. Return value(s): ...
Returns a true if the -b option was requested when the program was run. This identifies if the program is to run a more silent version of output during the run to help bots and other small format requirements.
[ "Returns", "a", "true", "if", "the", "-", "b", "option", "was", "requested", "when", "the", "program", "was", "run", ".", "This", "identifies", "if", "the", "program", "is", "to", "run", "a", "more", "silent", "version", "of", "output", "during", "the", ...
def BotOutputRequested(self): """ Returns a true if the -b option was requested when the program was run. This identifies if the program is to run a more silent version of output during the run to help bots and other small format requirements. Argument(s): No arg...
[ "def", "BotOutputRequested", "(", "self", ")", ":", "return", "self", ".", "_botOutputRequested" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L718-L735
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.SourceURL
(self)
return self._sourceurl
Returns the string representing the Source URL which is simply the domain URL entered in the xml config file. Argument(s): No arguments are required. Return value(s): string -- representing the source URL of the site. Restriction(s): This Method is tagged as a ...
Returns the string representing the Source URL which is simply the domain URL entered in the xml config file.
[ "Returns", "the", "string", "representing", "the", "Source", "URL", "which", "is", "simply", "the", "domain", "URL", "entered", "in", "the", "xml", "config", "file", "." ]
def SourceURL(self): """ Returns the string representing the Source URL which is simply the domain URL entered in the xml config file. Argument(s): No arguments are required. Return value(s): string -- representing the source URL of the site. Restrictio...
[ "def", "SourceURL", "(", "self", ")", ":", "return", "self", ".", "_sourceurl" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L738-L752
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.ImportantPropertyString
(self)
return self._importantProperty
Returns the string representing the Important Property that the user wants the site to report. This is set using the xml config file in the importantproperty XML tag. Argument(s): No arguments are required. Return value(s): string -- representing the important property ...
Returns the string representing the Important Property that the user wants the site to report. This is set using the xml config file in the importantproperty XML tag.
[ "Returns", "the", "string", "representing", "the", "Important", "Property", "that", "the", "user", "wants", "the", "site", "to", "report", ".", "This", "is", "set", "using", "the", "xml", "config", "file", "in", "the", "importantproperty", "XML", "tag", "." ...
def ImportantPropertyString(self): """ Returns the string representing the Important Property that the user wants the site to report. This is set using the xml config file in the importantproperty XML tag. Argument(s): No arguments are required. Return value(s):...
[ "def", "ImportantPropertyString", "(", "self", ")", ":", "return", "self", ".", "_importantProperty" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L755-L771
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Params
(self)
return self._params
Determines if web Parameters were set for this specific site. Returns the string representing the Parameters using the _params instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are required. Return value(s): ...
Determines if web Parameters were set for this specific site. Returns the string representing the Parameters using the _params instance variable or returns None if the instance variable is empty or not set.
[ "Determines", "if", "web", "Parameters", "were", "set", "for", "this", "specific", "site", ".", "Returns", "the", "string", "representing", "the", "Parameters", "using", "the", "_params", "instance", "variable", "or", "returns", "None", "if", "the", "instance", ...
def Params(self): """ Determines if web Parameters were set for this specific site. Returns the string representing the Parameters using the _params instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are requ...
[ "def", "Params", "(", "self", ")", ":", "if", "self", ".", "_params", "is", "None", ":", "return", "None", "if", "len", "(", "self", ".", "_params", ")", "==", "0", ":", "return", "None", "return", "self", ".", "_params" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L774-L795
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Params
(self, params)
Determines if Parameters were required for this specific site. If web Parameters were set, this places the target into the parameters where required marked with the %TARGET% keyword in the xml config file. Argument(s): params -- dictionary representing web Parameters required. ...
Determines if Parameters were required for this specific site. If web Parameters were set, this places the target into the parameters where required marked with the %TARGET% keyword in the xml config file.
[ "Determines", "if", "Parameters", "were", "required", "for", "this", "specific", "site", ".", "If", "web", "Parameters", "were", "set", "this", "places", "the", "target", "into", "the", "parameters", "where", "required", "marked", "with", "the", "%TARGET%", "k...
def Params(self, params): """ Determines if Parameters were required for this specific site. If web Parameters were set, this places the target into the parameters where required marked with the %TARGET% keyword in the xml config file. Argument(s): params -- dict...
[ "def", "Params", "(", "self", ",", "params", ")", ":", "if", "len", "(", "params", ")", ">", "0", ":", "for", "key", "in", "params", ":", "if", "params", "[", "key", "]", "==", "\"%TARGET%\"", ":", "params", "[", "key", "]", "=", "self", ".", "...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L798-L820
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Headers
(self)
return self._headers
Determines if Headers were set for this specific site. Returns the string representing the Headers using the _headers instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are required. Return value(s): string ...
Determines if Headers were set for this specific site. Returns the string representing the Headers using the _headers instance variable or returns None if the instance variable is empty or not set.
[ "Determines", "if", "Headers", "were", "set", "for", "this", "specific", "site", ".", "Returns", "the", "string", "representing", "the", "Headers", "using", "the", "_headers", "instance", "variable", "or", "returns", "None", "if", "the", "instance", "variable", ...
def Headers(self): """ Determines if Headers were set for this specific site. Returns the string representing the Headers using the _headers instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are required. ...
[ "def", "Headers", "(", "self", ")", ":", "if", "self", ".", "_headers", "is", "None", ":", "return", "None", "if", "len", "(", "self", ".", "_headers", ")", "==", "0", ":", "return", "None", "return", "self", ".", "_headers" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L823-L844
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Headers
(self, headers)
Determines if Headers were required for this specific site. If web Headers were set, this places the target into the headers where required or marked with the %TARGET% keyword in the xml config file. Argument(s): headers -- dictionary representing web Headers required. ...
Determines if Headers were required for this specific site. If web Headers were set, this places the target into the headers where required or marked with the %TARGET% keyword in the xml config file.
[ "Determines", "if", "Headers", "were", "required", "for", "this", "specific", "site", ".", "If", "web", "Headers", "were", "set", "this", "places", "the", "target", "into", "the", "headers", "where", "required", "or", "marked", "with", "the", "%TARGET%", "ke...
def Headers(self, headers): """ Determines if Headers were required for this specific site. If web Headers were set, this places the target into the headers where required or marked with the %TARGET% keyword in the xml config file. Argument(s): headers -- diction...
[ "def", "Headers", "(", "self", ",", "headers", ")", ":", "if", "len", "(", "headers", ")", ">", "0", ":", "for", "key", "in", "headers", ":", "if", "headers", "[", "key", "]", "==", "\"%TARGET%\"", ":", "headers", "[", "key", "]", "=", "self", "....
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L847-L869
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.PostData
(self)
return self._postdata
Determines if PostData was set for this specific site. Returns the dict representing the PostHeaders using the _postdata instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are required. Return value(s): dict...
Determines if PostData was set for this specific site. Returns the dict representing the PostHeaders using the _postdata instance variable or returns None if the instance variable is empty or not set.
[ "Determines", "if", "PostData", "was", "set", "for", "this", "specific", "site", ".", "Returns", "the", "dict", "representing", "the", "PostHeaders", "using", "the", "_postdata", "instance", "variable", "or", "returns", "None", "if", "the", "instance", "variable...
def PostData(self): """ Determines if PostData was set for this specific site. Returns the dict representing the PostHeaders using the _postdata instance variable or returns None if the instance variable is empty or not set. Argument(s): No arguments are required...
[ "def", "PostData", "(", "self", ")", ":", "if", "self", ".", "_postdata", "is", "None", ":", "return", "None", "if", "len", "(", "self", ".", "_postdata", ")", "==", "0", ":", "return", "None", "return", "self", ".", "_postdata" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L872-L893
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.PostData
(self, postdata)
Determines if post data was required for this specific site. If postdata is set, this ensures %TARGET% is stripped if necessary. Argument(s): postdata -- dictionary representing web postdata required. Return value(s): Nothing is returned from this Method. Restriction(s...
Determines if post data was required for this specific site. If postdata is set, this ensures %TARGET% is stripped if necessary.
[ "Determines", "if", "post", "data", "was", "required", "for", "this", "specific", "site", ".", "If", "postdata", "is", "set", "this", "ensures", "%TARGET%", "is", "stripped", "if", "necessary", "." ]
def PostData(self, postdata): """ Determines if post data was required for this specific site. If postdata is set, this ensures %TARGET% is stripped if necessary. Argument(s): postdata -- dictionary representing web postdata required. Return value(s): Nothing is...
[ "def", "PostData", "(", "self", ",", "postdata", ")", ":", "if", "len", "(", "postdata", ")", ">", "0", ":", "for", "key", "in", "postdata", ":", "if", "postdata", "[", "key", "]", "==", "\"%TARGET%\"", ":", "postdata", "[", "key", "]", "=", "self"...
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L896-L916
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.Target
(self)
return self._target
Returns string representing the target being investigated. The string may be an IP Address, MD5 hash, or hostname. Argument(s): No arguments are required. Return value(s): string -- representation of the Target from the _target instance variable. Restriction(s)...
Returns string representing the target being investigated. The string may be an IP Address, MD5 hash, or hostname.
[ "Returns", "string", "representing", "the", "target", "being", "investigated", ".", "The", "string", "may", "be", "an", "IP", "Address", "MD5", "hash", "or", "hostname", "." ]
def Target(self): """ Returns string representing the target being investigated. The string may be an IP Address, MD5 hash, or hostname. Argument(s): No arguments are required. Return value(s): string -- representation of the Target from the _target inst...
[ "def", "Target", "(", "self", ")", ":", "return", "self", ".", "_target" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L919-L934
1aN0rmus/TekDefense-Automater
42548cf454e862669c0a482955358fe27f7150e8
siteinfo.py
python
Site.UserAgent
(self)
return self._userAgent
Returns string representing the user-agent that will be used when requesting or submitting information to a web site. This is a user-provided string implemented on the command line at execution or provided by default if not added during execution. Argument(s): No argumen...
Returns string representing the user-agent that will be used when requesting or submitting information to a web site. This is a user-provided string implemented on the command line at execution or provided by default if not added during execution.
[ "Returns", "string", "representing", "the", "user", "-", "agent", "that", "will", "be", "used", "when", "requesting", "or", "submitting", "information", "to", "a", "web", "site", ".", "This", "is", "a", "user", "-", "provided", "string", "implemented", "on",...
def UserAgent(self): """ Returns string representing the user-agent that will be used when requesting or submitting information to a web site. This is a user-provided string implemented on the command line at execution or provided by default if not added during execution....
[ "def", "UserAgent", "(", "self", ")", ":", "return", "self", ".", "_userAgent" ]
https://github.com/1aN0rmus/TekDefense-Automater/blob/42548cf454e862669c0a482955358fe27f7150e8/siteinfo.py#L937-L955