repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
ReFirmLabs/binwalk
src/binwalk/modules/general.py
General.open_file
def open_file(self, fname, length=None, offset=None, swap=None, block=None, peek=None): ''' Opens the specified file with all pertinent configuration settings. ''' if length is None: length = self.length if offset is None: offset = self.offset if s...
python
def open_file(self, fname, length=None, offset=None, swap=None, block=None, peek=None): ''' Opens the specified file with all pertinent configuration settings. ''' if length is None: length = self.length if offset is None: offset = self.offset if s...
[ "def", "open_file", "(", "self", ",", "fname", ",", "length", "=", "None", ",", "offset", "=", "None", ",", "swap", "=", "None", ",", "block", "=", "None", ",", "peek", "=", "None", ")", ":", "if", "length", "is", "None", ":", "length", "=", "sel...
Opens the specified file with all pertinent configuration settings.
[ "Opens", "the", "specified", "file", "with", "all", "pertinent", "configuration", "settings", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/general.py#L186-L203
train
Opens the specified file with all pertinent configuration settings.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/general.py
General._open_target_files
def _open_target_files(self): ''' Checks if the target files can be opened. Any files that cannot be opened are removed from the self.target_files list. ''' # Validate the target files listed in target_files for tfile in self.files: # Ignore directories. ...
python
def _open_target_files(self): ''' Checks if the target files can be opened. Any files that cannot be opened are removed from the self.target_files list. ''' # Validate the target files listed in target_files for tfile in self.files: # Ignore directories. ...
[ "def", "_open_target_files", "(", "self", ")", ":", "# Validate the target files listed in target_files", "for", "tfile", "in", "self", ".", "files", ":", "# Ignore directories.", "if", "not", "self", ".", "subclass", "==", "io", ".", "FileIO", "or", "not", "os", ...
Checks if the target files can be opened. Any files that cannot be opened are removed from the self.target_files list.
[ "Checks", "if", "the", "target", "files", "can", "be", "opened", ".", "Any", "files", "that", "cannot", "be", "opened", "are", "removed", "from", "the", "self", ".", "target_files", "list", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/general.py#L205-L222
train
Checks if the target files can be opened.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/signature.py
Signature.validate
def validate(self, r): ''' Called automatically by self.result. ''' if self.show_invalid: r.valid = True elif r.valid: if not r.description: r.valid = False if r.size and (r.size + r.offset) > r.file.size: r.val...
python
def validate(self, r): ''' Called automatically by self.result. ''' if self.show_invalid: r.valid = True elif r.valid: if not r.description: r.valid = False if r.size and (r.size + r.offset) > r.file.size: r.val...
[ "def", "validate", "(", "self", ",", "r", ")", ":", "if", "self", ".", "show_invalid", ":", "r", ".", "valid", "=", "True", "elif", "r", ".", "valid", ":", "if", "not", "r", ".", "description", ":", "r", ".", "valid", "=", "False", "if", "r", "...
Called automatically by self.result.
[ "Called", "automatically", "by", "self", ".", "result", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/signature.py#L107-L134
train
Validate the result of a single entry.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/plugin.py
Plugins.list_plugins
def list_plugins(self): ''' Obtain a list of all user and system plugin modules. Returns a dictionary of: { 'user' : { 'modules' : [list, of, module, names], 'descriptions' : {'module_name' : 'modul...
python
def list_plugins(self): ''' Obtain a list of all user and system plugin modules. Returns a dictionary of: { 'user' : { 'modules' : [list, of, module, names], 'descriptions' : {'module_name' : 'modul...
[ "def", "list_plugins", "(", "self", ")", ":", "plugins", "=", "{", "'user'", ":", "{", "'modules'", ":", "[", "]", ",", "'descriptions'", ":", "{", "}", ",", "'enabled'", ":", "{", "}", ",", "'path'", ":", "None", ",", "}", ",", "'system'", ":", ...
Obtain a list of all user and system plugin modules. Returns a dictionary of: { 'user' : { 'modules' : [list, of, module, names], 'descriptions' : {'module_name' : 'module pydoc string'}, ...
[ "Obtain", "a", "list", "of", "all", "user", "and", "system", "plugin", "modules", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/plugin.py#L132-L206
train
Obtain a list of all user and system plugin modules.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/entropy.py
Entropy.shannon
def shannon(self, data): ''' Performs a Shannon entropy analysis on a given block of data. ''' entropy = 0 if data: length = len(data) seen = dict(((chr(x), 0) for x in range(0, 256))) for byte in data: seen[byte] += 1 ...
python
def shannon(self, data): ''' Performs a Shannon entropy analysis on a given block of data. ''' entropy = 0 if data: length = len(data) seen = dict(((chr(x), 0) for x in range(0, 256))) for byte in data: seen[byte] += 1 ...
[ "def", "shannon", "(", "self", ",", "data", ")", ":", "entropy", "=", "0", "if", "data", ":", "length", "=", "len", "(", "data", ")", "seen", "=", "dict", "(", "(", "(", "chr", "(", "x", ")", ",", "0", ")", "for", "x", "in", "range", "(", "...
Performs a Shannon entropy analysis on a given block of data.
[ "Performs", "a", "Shannon", "entropy", "analysis", "on", "a", "given", "block", "of", "data", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/entropy.py#L221-L239
train
Calculates Shannon entropy on a given block of data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/entropy.py
Entropy.gzip
def gzip(self, data, truncate=True): ''' Performs an entropy analysis based on zlib compression ratio. This is faster than the shannon entropy analysis, but not as accurate. ''' # Entropy is a simple ratio of: <zlib compressed size> / <original # size> e = float(f...
python
def gzip(self, data, truncate=True): ''' Performs an entropy analysis based on zlib compression ratio. This is faster than the shannon entropy analysis, but not as accurate. ''' # Entropy is a simple ratio of: <zlib compressed size> / <original # size> e = float(f...
[ "def", "gzip", "(", "self", ",", "data", ",", "truncate", "=", "True", ")", ":", "# Entropy is a simple ratio of: <zlib compressed size> / <original", "# size>", "e", "=", "float", "(", "float", "(", "len", "(", "zlib", ".", "compress", "(", "str2bytes", "(", ...
Performs an entropy analysis based on zlib compression ratio. This is faster than the shannon entropy analysis, but not as accurate.
[ "Performs", "an", "entropy", "analysis", "based", "on", "zlib", "compression", "ratio", ".", "This", "is", "faster", "than", "the", "shannon", "entropy", "analysis", "but", "not", "as", "accurate", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/entropy.py#L241-L253
train
Calculates the entropy of a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/plugins/tar.py
TarPlugin.nts
def nts(self, s): """ Convert a null-terminated string field to a python string. """ # Use the string up to the first null char. p = s.find("\0") if p == -1: return s return s[:p]
python
def nts(self, s): """ Convert a null-terminated string field to a python string. """ # Use the string up to the first null char. p = s.find("\0") if p == -1: return s return s[:p]
[ "def", "nts", "(", "self", ",", "s", ")", ":", "# Use the string up to the first null char.", "p", "=", "s", ".", "find", "(", "\"\\0\"", ")", "if", "p", "==", "-", "1", ":", "return", "s", "return", "s", "[", ":", "p", "]" ]
Convert a null-terminated string field to a python string.
[ "Convert", "a", "null", "-", "terminated", "string", "field", "to", "a", "python", "string", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/tar.py#L13-L21
train
Convert a null - terminated string field to a python string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/plugins/tar.py
TarPlugin.nti
def nti(self, s): """ Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0x80): try: n = int(self.nts(s) or "0", 8) except ValueError: ...
python
def nti(self, s): """ Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0x80): try: n = int(self.nts(s) or "0", 8) except ValueError: ...
[ "def", "nti", "(", "self", ",", "s", ")", ":", "# There are two possible encodings for a number field, see", "# itn() below.", "if", "s", "[", "0", "]", "!=", "chr", "(", "0x80", ")", ":", "try", ":", "n", "=", "int", "(", "self", ".", "nts", "(", "s", ...
Convert a number field to a python number.
[ "Convert", "a", "number", "field", "to", "a", "python", "number", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/tar.py#L23-L39
train
Convert a number field to a python number.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
debug
def debug(msg): ''' Displays debug messages to stderr only if the Python interpreter was invoked with the -O flag. ''' if DEBUG: sys.stderr.write("DEBUG: " + msg + "\n") sys.stderr.flush()
python
def debug(msg): ''' Displays debug messages to stderr only if the Python interpreter was invoked with the -O flag. ''' if DEBUG: sys.stderr.write("DEBUG: " + msg + "\n") sys.stderr.flush()
[ "def", "debug", "(", "msg", ")", ":", "if", "DEBUG", ":", "sys", ".", "stderr", ".", "write", "(", "\"DEBUG: \"", "+", "msg", "+", "\"\\n\"", ")", "sys", ".", "stderr", ".", "flush", "(", ")" ]
Displays debug messages to stderr only if the Python interpreter was invoked with the -O flag.
[ "Displays", "debug", "messages", "to", "stderr", "only", "if", "the", "Python", "interpreter", "was", "invoked", "with", "the", "-", "O", "flag", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L30-L36
train
Displays debug messages to stderr only if DEBUG is set to True.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
file_md5
def file_md5(file_name): ''' Generate an MD5 hash of the specified file. @file_name - The file to hash. Returns an MD5 hex digest string. ''' md5 = hashlib.md5() with open(file_name, 'rb') as f: for chunk in iter(lambda: f.read(128 * md5.block_size), b''): md5.update(c...
python
def file_md5(file_name): ''' Generate an MD5 hash of the specified file. @file_name - The file to hash. Returns an MD5 hex digest string. ''' md5 = hashlib.md5() with open(file_name, 'rb') as f: for chunk in iter(lambda: f.read(128 * md5.block_size), b''): md5.update(c...
[ "def", "file_md5", "(", "file_name", ")", ":", "md5", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "file_name", ",", "'rb'", ")", "as", "f", ":", "for", "chunk", "in", "iter", "(", "lambda", ":", "f", ".", "read", "(", "128", "*", ...
Generate an MD5 hash of the specified file. @file_name - The file to hash. Returns an MD5 hex digest string.
[ "Generate", "an", "MD5", "hash", "of", "the", "specified", "file", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L71-L85
train
Generate an MD5 hash of the specified file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
file_size
def file_size(filename): ''' Obtains the size of a given file. @filename - Path to the file. Returns the size of the file. ''' # Using open/lseek works on both regular files and block devices fd = os.open(filename, os.O_RDONLY) try: return os.lseek(fd, 0, os.SEEK_END) excep...
python
def file_size(filename): ''' Obtains the size of a given file. @filename - Path to the file. Returns the size of the file. ''' # Using open/lseek works on both regular files and block devices fd = os.open(filename, os.O_RDONLY) try: return os.lseek(fd, 0, os.SEEK_END) excep...
[ "def", "file_size", "(", "filename", ")", ":", "# Using open/lseek works on both regular files and block devices", "fd", "=", "os", ".", "open", "(", "filename", ",", "os", ".", "O_RDONLY", ")", "try", ":", "return", "os", ".", "lseek", "(", "fd", ",", "0", ...
Obtains the size of a given file. @filename - Path to the file. Returns the size of the file.
[ "Obtains", "the", "size", "of", "a", "given", "file", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L88-L106
train
Returns the size of a given file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
get_quoted_strings
def get_quoted_strings(quoted_string): ''' Returns a string comprised of all data in between double quotes. @quoted_string - String to get quoted data from. Returns a string of quoted data on success. Returns a blank string if no quoted data is present. ''' try: # This regex grabs ...
python
def get_quoted_strings(quoted_string): ''' Returns a string comprised of all data in between double quotes. @quoted_string - String to get quoted data from. Returns a string of quoted data on success. Returns a blank string if no quoted data is present. ''' try: # This regex grabs ...
[ "def", "get_quoted_strings", "(", "quoted_string", ")", ":", "try", ":", "# This regex grabs all quoted data from string.", "# Note that this gets everything in between the first and last double quote.", "# This is intentional, as printed (and quoted) strings from a target file may contain", "...
Returns a string comprised of all data in between double quotes. @quoted_string - String to get quoted data from. Returns a string of quoted data on success. Returns a blank string if no quoted data is present.
[ "Returns", "a", "string", "comprised", "of", "all", "data", "in", "between", "double", "quotes", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L126-L146
train
Returns a string comprised of all data in between double quotes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
unique_file_name
def unique_file_name(base_name, extension=''): ''' Creates a unique file name based on the specified base name. @base_name - The base name to use for the unique file name. @extension - The file extension to use for the unique file name. Returns a unique file string. ''' idcount = 0 if...
python
def unique_file_name(base_name, extension=''): ''' Creates a unique file name based on the specified base name. @base_name - The base name to use for the unique file name. @extension - The file extension to use for the unique file name. Returns a unique file string. ''' idcount = 0 if...
[ "def", "unique_file_name", "(", "base_name", ",", "extension", "=", "''", ")", ":", "idcount", "=", "0", "if", "extension", "and", "not", "extension", ".", "startswith", "(", "'.'", ")", ":", "extension", "=", "'.%s'", "%", "extension", "fname", "=", "ba...
Creates a unique file name based on the specified base name. @base_name - The base name to use for the unique file name. @extension - The file extension to use for the unique file name. Returns a unique file string.
[ "Creates", "a", "unique", "file", "name", "based", "on", "the", "specified", "base", "name", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L149-L169
train
Returns a unique file name based on the specified base name and extension.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/common.py
strings
def strings(filename, minimum=4): ''' A strings generator, similar to the Unix strings utility. @filename - The file to search for strings in. @minimum - The minimum string length to search for. Yeilds printable ASCII strings from filename. ''' result = "" with BlockFile(filename) as...
python
def strings(filename, minimum=4): ''' A strings generator, similar to the Unix strings utility. @filename - The file to search for strings in. @minimum - The minimum string length to search for. Yeilds printable ASCII strings from filename. ''' result = "" with BlockFile(filename) as...
[ "def", "strings", "(", "filename", ",", "minimum", "=", "4", ")", ":", "result", "=", "\"\"", "with", "BlockFile", "(", "filename", ")", "as", "f", ":", "while", "True", ":", "(", "data", ",", "dlen", ")", "=", "f", ".", "read_block", "(", ")", "...
A strings generator, similar to the Unix strings utility. @filename - The file to search for strings in. @minimum - The minimum string length to search for. Yeilds printable ASCII strings from filename.
[ "A", "strings", "generator", "similar", "to", "the", "Unix", "strings", "utility", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/common.py#L172-L197
train
A generator that returns a list of strings from a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/compat.py
bytes2str
def bytes2str(bs): ''' For cross compatibility between Python 2 and Python 3 strings. ''' if isinstance(bs, type(b'')) and PY_MAJOR_VERSION > 2: return bs.decode('latin1') else: return bs
python
def bytes2str(bs): ''' For cross compatibility between Python 2 and Python 3 strings. ''' if isinstance(bs, type(b'')) and PY_MAJOR_VERSION > 2: return bs.decode('latin1') else: return bs
[ "def", "bytes2str", "(", "bs", ")", ":", "if", "isinstance", "(", "bs", ",", "type", "(", "b''", ")", ")", "and", "PY_MAJOR_VERSION", ">", "2", ":", "return", "bs", ".", "decode", "(", "'latin1'", ")", "else", ":", "return", "bs" ]
For cross compatibility between Python 2 and Python 3 strings.
[ "For", "cross", "compatibility", "between", "Python", "2", "and", "Python", "3", "strings", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/compat.py#L60-L67
train
Convert a byte string to a unicode string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.create_rule
def create_rule(self, txtrule=None, regex=None, extension=None, cmd=None, codes=[0, None], recurse=True): ''' Adds a set of rules to the extraction rule list. @txtrule - Rule string, or list of rule strings, in the format <regular expression>:<file extension>[:<command to run>] @regex...
python
def create_rule(self, txtrule=None, regex=None, extension=None, cmd=None, codes=[0, None], recurse=True): ''' Adds a set of rules to the extraction rule list. @txtrule - Rule string, or list of rule strings, in the format <regular expression>:<file extension>[:<command to run>] @regex...
[ "def", "create_rule", "(", "self", ",", "txtrule", "=", "None", ",", "regex", "=", "None", ",", "extension", "=", "None", ",", "cmd", "=", "None", ",", "codes", "=", "[", "0", ",", "None", "]", ",", "recurse", "=", "True", ")", ":", "rules", "=",...
Adds a set of rules to the extraction rule list. @txtrule - Rule string, or list of rule strings, in the format <regular expression>:<file extension>[:<command to run>] @regex - If rule string is not specified, this is the regular expression string to use. @extension - If rule string is n...
[ "Adds", "a", "set", "of", "rules", "to", "the", "extraction", "rule", "list", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L301-L362
train
Creates a set of rules for the current locale.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.remove_rules
def remove_rules(self, description): ''' Remove all rules that match a specified description. @description - The description to match against. Returns the number of rules removed. ''' rm = [] description = description.lower() for i in range(0, len(self....
python
def remove_rules(self, description): ''' Remove all rules that match a specified description. @description - The description to match against. Returns the number of rules removed. ''' rm = [] description = description.lower() for i in range(0, len(self....
[ "def", "remove_rules", "(", "self", ",", "description", ")", ":", "rm", "=", "[", "]", "description", "=", "description", ".", "lower", "(", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", ".", "extract_rules", ")", ")", ":", "if...
Remove all rules that match a specified description. @description - The description to match against. Returns the number of rules removed.
[ "Remove", "all", "rules", "that", "match", "a", "specified", "description", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L364-L382
train
Removes all rules that match a specified description.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.edit_rules
def edit_rules(self, description, key, value): ''' Edit all rules that match a specified description. @description - The description to match against. @key - The key to change for each matching rule. @value - The new key value for each matching rule. Retur...
python
def edit_rules(self, description, key, value): ''' Edit all rules that match a specified description. @description - The description to match against. @key - The key to change for each matching rule. @value - The new key value for each matching rule. Retur...
[ "def", "edit_rules", "(", "self", ",", "description", ",", "key", ",", "value", ")", ":", "count", "=", "0", "description", "=", "description", ".", "lower", "(", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", ".", "extract_rules"...
Edit all rules that match a specified description. @description - The description to match against. @key - The key to change for each matching rule. @value - The new key value for each matching rule. Returns the number of rules modified.
[ "Edit", "all", "rules", "that", "match", "a", "specified", "description", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L384-L403
train
Edit all rules that match a specified description.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.get_rules
def get_rules(self, description=None): ''' Returns a list of extraction rules that match a given description. @description - The description to match against. Returns a list of extraction rules that match the given description. If no description is provided, a list of all rules...
python
def get_rules(self, description=None): ''' Returns a list of extraction rules that match a given description. @description - The description to match against. Returns a list of extraction rules that match the given description. If no description is provided, a list of all rules...
[ "def", "get_rules", "(", "self", ",", "description", "=", "None", ")", ":", "if", "description", ":", "rules", "=", "[", "]", "description", "=", "description", ".", "lower", "(", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "self", "...
Returns a list of extraction rules that match a given description. @description - The description to match against. Returns a list of extraction rules that match the given description. If no description is provided, a list of all rules are returned.
[ "Returns", "a", "list", "of", "extraction", "rules", "that", "match", "a", "given", "description", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L413-L431
train
Returns a list of extraction rules that match a given description.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.load_from_file
def load_from_file(self, fname): ''' Loads extraction rules from the specified file. @fname - Path to the extraction rule file. Returns None. ''' try: # Process each line from the extract file, ignoring comments with open(fname, 'r') as f: ...
python
def load_from_file(self, fname): ''' Loads extraction rules from the specified file. @fname - Path to the extraction rule file. Returns None. ''' try: # Process each line from the extract file, ignoring comments with open(fname, 'r') as f: ...
[ "def", "load_from_file", "(", "self", ",", "fname", ")", ":", "try", ":", "# Process each line from the extract file, ignoring comments", "with", "open", "(", "fname", ",", "'r'", ")", "as", "f", ":", "for", "rule", "in", "f", ".", "readlines", "(", ")", ":"...
Loads extraction rules from the specified file. @fname - Path to the extraction rule file. Returns None.
[ "Loads", "extraction", "rules", "from", "the", "specified", "file", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L433-L449
train
Loads extraction rules from the specified file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.load_defaults
def load_defaults(self): ''' Loads default extraction rules from the user and system extract.conf files. Returns None. ''' # Load the user extract file first to ensure its rules take precedence. extract_files = [ self.config.settings.user.extract, ...
python
def load_defaults(self): ''' Loads default extraction rules from the user and system extract.conf files. Returns None. ''' # Load the user extract file first to ensure its rules take precedence. extract_files = [ self.config.settings.user.extract, ...
[ "def", "load_defaults", "(", "self", ")", ":", "# Load the user extract file first to ensure its rules take precedence.", "extract_files", "=", "[", "self", ".", "config", ".", "settings", ".", "user", ".", "extract", ",", "self", ".", "config", ".", "settings", "."...
Loads default extraction rules from the user and system extract.conf files. Returns None.
[ "Loads", "default", "extraction", "rules", "from", "the", "user", "and", "system", "extract", ".", "conf", "files", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L451-L471
train
Loads default extraction rules from the user and system extract. conf files. Returns None.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.build_output_directory
def build_output_directory(self, path): ''' Set the output directory for extracted files. @path - The path to the file that data will be extracted from. Returns None. ''' # If we have not already created an output directory for this target # file, create one now...
python
def build_output_directory(self, path): ''' Set the output directory for extracted files. @path - The path to the file that data will be extracted from. Returns None. ''' # If we have not already created an output directory for this target # file, create one now...
[ "def", "build_output_directory", "(", "self", ",", "path", ")", ":", "# If we have not already created an output directory for this target", "# file, create one now", "if", "not", "has_key", "(", "self", ".", "extraction_directories", ",", "path", ")", ":", "basedir", "="...
Set the output directory for extracted files. @path - The path to the file that data will be extracted from. Returns None.
[ "Set", "the", "output", "directory", "for", "extracted", "files", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L490-L536
train
Build the output directory for extracted files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.extract
def extract(self, offset, description, file_name, size, name=None): ''' Extract an embedded file from the target file, if it matches an extract rule. Called automatically by Binwalk.scan(). @offset - Offset inside the target file to begin the extraction. @description - Desc...
python
def extract(self, offset, description, file_name, size, name=None): ''' Extract an embedded file from the target file, if it matches an extract rule. Called automatically by Binwalk.scan(). @offset - Offset inside the target file to begin the extraction. @description - Desc...
[ "def", "extract", "(", "self", ",", "offset", ",", "description", ",", "file_name", ",", "size", ",", "name", "=", "None", ")", ":", "fname", "=", "''", "rule", "=", "None", "recurse", "=", "False", "command_line", "=", "''", "original_dir", "=", "os",...
Extract an embedded file from the target file, if it matches an extract rule. Called automatically by Binwalk.scan(). @offset - Offset inside the target file to begin the extraction. @description - Description of the embedded file to extract, as returned by libmagic. @file_name -...
[ "Extract", "an", "embedded", "file", "from", "the", "target", "file", "if", "it", "matches", "an", "extract", "rule", ".", "Called", "automatically", "by", "Binwalk", ".", "scan", "()", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L553-L676
train
Extracts an embedded file from the target file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor._entry_offset
def _entry_offset(self, index, entries, description): ''' Gets the offset of the first entry that matches the description. @index - Index into the entries list to begin searching. @entries - Dictionary of result entries. @description - Case insensitive description. ...
python
def _entry_offset(self, index, entries, description): ''' Gets the offset of the first entry that matches the description. @index - Index into the entries list to begin searching. @entries - Dictionary of result entries. @description - Case insensitive description. ...
[ "def", "_entry_offset", "(", "self", ",", "index", ",", "entries", ",", "description", ")", ":", "description", "=", "description", ".", "lower", "(", ")", "for", "(", "offset", ",", "infos", ")", "in", "entries", "[", "index", ":", "]", ":", "for", ...
Gets the offset of the first entry that matches the description. @index - Index into the entries list to begin searching. @entries - Dictionary of result entries. @description - Case insensitive description. Returns the offset, if a matching description is found. Retu...
[ "Gets", "the", "offset", "of", "the", "first", "entry", "that", "matches", "the", "description", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L687-L704
train
Returns the offset of the first entry that matches the description.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.match
def match(self, description): ''' Check to see if the provided description string matches an extract rule. Called internally by self.extract(). @description - Description string to check. Returns the associated rule dictionary if a match is found. Returns None if no mat...
python
def match(self, description): ''' Check to see if the provided description string matches an extract rule. Called internally by self.extract(). @description - Description string to check. Returns the associated rule dictionary if a match is found. Returns None if no mat...
[ "def", "match", "(", "self", ",", "description", ")", ":", "rules", "=", "[", "]", "ordered_rules", "=", "[", "]", "description", "=", "description", ".", "lower", "(", ")", "for", "rule", "in", "self", ".", "extract_rules", ":", "if", "rule", "[", "...
Check to see if the provided description string matches an extract rule. Called internally by self.extract(). @description - Description string to check. Returns the associated rule dictionary if a match is found. Returns None if no match is found.
[ "Check", "to", "see", "if", "the", "provided", "description", "string", "matches", "an", "extract", "rule", ".", "Called", "internally", "by", "self", ".", "extract", "()", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L706-L732
train
Check to see if the provided description string matches an extract rule. Returns the associated rule dictionary ordered by priority.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor._parse_rule
def _parse_rule(self, rule): ''' Parses an extraction rule. @rule - Rule string. Returns an array of ['<case insensitive matching string>', '<file extension>', '<command to run>', '<comma separated return codes>', <recurse into extracted directories: True|False>]. ''' v...
python
def _parse_rule(self, rule): ''' Parses an extraction rule. @rule - Rule string. Returns an array of ['<case insensitive matching string>', '<file extension>', '<command to run>', '<comma separated return codes>', <recurse into extracted directories: True|False>]. ''' v...
[ "def", "_parse_rule", "(", "self", ",", "rule", ")", ":", "values", "=", "rule", ".", "strip", "(", ")", ".", "split", "(", "self", ".", "RULE_DELIM", ",", "4", ")", "if", "len", "(", "values", ")", ">=", "4", ":", "codes", "=", "values", "[", ...
Parses an extraction rule. @rule - Rule string. Returns an array of ['<case insensitive matching string>', '<file extension>', '<command to run>', '<comma separated return codes>', <recurse into extracted directories: True|False>].
[ "Parses", "an", "extraction", "rule", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L734-L756
train
Parses an extraction rule.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor._dd
def _dd(self, file_name, offset, size, extension, output_file_name=None): ''' Extracts a file embedded inside the target file. @file_name - Path to the target file. @offset - Offset inside the target file where the embedded file begins. @size - Numbe...
python
def _dd(self, file_name, offset, size, extension, output_file_name=None): ''' Extracts a file embedded inside the target file. @file_name - Path to the target file. @offset - Offset inside the target file where the embedded file begins. @size - Numbe...
[ "def", "_dd", "(", "self", ",", "file_name", ",", "offset", ",", "size", ",", "extension", ",", "output_file_name", "=", "None", ")", ":", "total_size", "=", "0", "# Default extracted file name is <displayed hex offset>.<extension>", "default_bname", "=", "\"%X\"", ...
Extracts a file embedded inside the target file. @file_name - Path to the target file. @offset - Offset inside the target file where the embedded file begins. @size - Number of bytes to extract. @extension - The file exension to assign to the extracte...
[ "Extracts", "a", "file", "embedded", "inside", "the", "target", "file", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L758-L835
train
This function extracts a file from the target file and writes it to the output file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/modules/extractor.py
Extractor.execute
def execute(self, cmd, fname, codes=[0, None]): ''' Execute a command against the specified file. @cmd - Command to execute. @fname - File to run command against. @codes - List of return codes indicating cmd success. Returns True on success, False on failure, or None ...
python
def execute(self, cmd, fname, codes=[0, None]): ''' Execute a command against the specified file. @cmd - Command to execute. @fname - File to run command against. @codes - List of return codes indicating cmd success. Returns True on success, False on failure, or None ...
[ "def", "execute", "(", "self", ",", "cmd", ",", "fname", ",", "codes", "=", "[", "0", ",", "None", "]", ")", ":", "tmp", "=", "None", "rval", "=", "0", "retval", "=", "True", "command_list", "=", "[", "]", "binwalk", ".", "core", ".", "common", ...
Execute a command against the specified file. @cmd - Command to execute. @fname - File to run command against. @codes - List of return codes indicating cmd success. Returns True on success, False on failure, or None if the external extraction utility could not be found.
[ "Execute", "a", "command", "against", "the", "specified", "file", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/modules/extractor.py#L837-L912
train
Execute a command against the specified file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/display.py
Display._fix_unicode_list
def _fix_unicode_list(self, columns): ''' Convenience wrapper for self.log which is passed a list of format arguments. ''' if type(columns) in [list, tuple]: for i in range(0, len(columns)): try: columns[i] = self._fix_unicode(columns[i]) ...
python
def _fix_unicode_list(self, columns): ''' Convenience wrapper for self.log which is passed a list of format arguments. ''' if type(columns) in [list, tuple]: for i in range(0, len(columns)): try: columns[i] = self._fix_unicode(columns[i]) ...
[ "def", "_fix_unicode_list", "(", "self", ",", "columns", ")", ":", "if", "type", "(", "columns", ")", "in", "[", "list", ",", "tuple", "]", ":", "for", "i", "in", "range", "(", "0", ",", "len", "(", "columns", ")", ")", ":", "try", ":", "columns"...
Convenience wrapper for self.log which is passed a list of format arguments.
[ "Convenience", "wrapper", "for", "self", ".", "log", "which", "is", "passed", "a", "list", "of", "format", "arguments", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/display.py#L51-L61
train
Helper method to convert unicode strings to unicode.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/display.py
Display._append_to_data_parts
def _append_to_data_parts(self, data, start, end): ''' Intelligently appends data to self.string_parts. For use by self._format. ''' try: while data[start] == ' ': start += 1 if start == end: end = len(data[start:]) ...
python
def _append_to_data_parts(self, data, start, end): ''' Intelligently appends data to self.string_parts. For use by self._format. ''' try: while data[start] == ' ': start += 1 if start == end: end = len(data[start:]) ...
[ "def", "_append_to_data_parts", "(", "self", ",", "data", ",", "start", ",", "end", ")", ":", "try", ":", "while", "data", "[", "start", "]", "==", "' '", ":", "start", "+=", "1", "if", "start", "==", "end", ":", "end", "=", "len", "(", "data", "...
Intelligently appends data to self.string_parts. For use by self._format.
[ "Intelligently", "appends", "data", "to", "self", ".", "string_parts", ".", "For", "use", "by", "self", ".", "_format", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/display.py#L155-L178
train
Intelligently appends data to self. string_parts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/display.py
Display._format_line
def _format_line(self, line): ''' Formats a line of text to fit in the terminal window. For Tim. ''' delim = '\n' offset = 0 self.string_parts = [] # Split the line into an array of columns, e.g., ['0', '0x00000000', # 'Some description here'] ...
python
def _format_line(self, line): ''' Formats a line of text to fit in the terminal window. For Tim. ''' delim = '\n' offset = 0 self.string_parts = [] # Split the line into an array of columns, e.g., ['0', '0x00000000', # 'Some description here'] ...
[ "def", "_format_line", "(", "self", ",", "line", ")", ":", "delim", "=", "'\\n'", "offset", "=", "0", "self", ".", "string_parts", "=", "[", "]", "# Split the line into an array of columns, e.g., ['0', '0x00000000',", "# 'Some description here']", "line_columns", "=", ...
Formats a line of text to fit in the terminal window. For Tim.
[ "Formats", "a", "line", "of", "text", "to", "fit", "in", "the", "terminal", "window", ".", "For", "Tim", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/display.py#L180-L230
train
Formats a line of text to fit in the terminal window.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/display.py
Display._configure_formatting
def _configure_formatting(self): ''' Configures output formatting, and fitting output to the current terminal width. Returns None. ''' self.format_strings(self.DEFAULT_FORMAT, self.DEFAULT_FORMAT) if self.fit_to_screen: try: import fcntl ...
python
def _configure_formatting(self): ''' Configures output formatting, and fitting output to the current terminal width. Returns None. ''' self.format_strings(self.DEFAULT_FORMAT, self.DEFAULT_FORMAT) if self.fit_to_screen: try: import fcntl ...
[ "def", "_configure_formatting", "(", "self", ")", ":", "self", ".", "format_strings", "(", "self", ".", "DEFAULT_FORMAT", ",", "self", ".", "DEFAULT_FORMAT", ")", "if", "self", ".", "fit_to_screen", ":", "try", ":", "import", "fcntl", "import", "struct", "im...
Configures output formatting, and fitting output to the current terminal width. Returns None.
[ "Configures", "output", "formatting", "and", "fitting", "output", "to", "the", "current", "terminal", "width", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/display.py#L232-L252
train
Configures output formatting and fitting output to the current terminal width.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings._magic_signature_files
def _magic_signature_files(self, system_only=False, user_only=False): ''' Find all user/system magic signature files. @system_only - If True, only the system magic file directory will be searched. @user_only - If True, only the user magic file directory will be searched. Retu...
python
def _magic_signature_files(self, system_only=False, user_only=False): ''' Find all user/system magic signature files. @system_only - If True, only the system magic file directory will be searched. @user_only - If True, only the user magic file directory will be searched. Retu...
[ "def", "_magic_signature_files", "(", "self", ",", "system_only", "=", "False", ",", "user_only", "=", "False", ")", ":", "files", "=", "[", "]", "user_binarch", "=", "self", ".", "_user_path", "(", "self", ".", "BINWALK_MAGIC_DIR", ",", "self", ".", "BINA...
Find all user/system magic signature files. @system_only - If True, only the system magic file directory will be searched. @user_only - If True, only the user magic file directory will be searched. Returns a list of user/system magic signature files.
[ "Find", "all", "user", "/", "system", "magic", "signature", "files", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L56-L87
train
Return a list of all user and system magic signature files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings.find_magic_file
def find_magic_file(self, fname, system_only=False, user_only=False): ''' Finds the specified magic file name in the system / user magic file directories. @fname - The name of the magic file. @system_only - If True, only the system magic file directory will be searched. @u...
python
def find_magic_file(self, fname, system_only=False, user_only=False): ''' Finds the specified magic file name in the system / user magic file directories. @fname - The name of the magic file. @system_only - If True, only the system magic file directory will be searched. @u...
[ "def", "find_magic_file", "(", "self", ",", "fname", ",", "system_only", "=", "False", ",", "user_only", "=", "False", ")", ":", "loc", "=", "None", "if", "not", "system_only", ":", "fpath", "=", "self", ".", "_user_path", "(", "self", ".", "BINWALK_MAGI...
Finds the specified magic file name in the system / user magic file directories. @fname - The name of the magic file. @system_only - If True, only the system magic file directory will be searched. @user_only - If True, only the user magic file directory will be searched. If sys...
[ "Finds", "the", "specified", "magic", "file", "name", "in", "the", "system", "/", "user", "magic", "file", "directories", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L89-L113
train
Finds the specified magic file in the system or user magic file directories.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings._get_user_dir
def _get_user_dir(self): ''' Get the user's home directory. ''' try: # This should work in both Windows and Unix environments for envname in ['USERPROFILE', 'HOME']: user_dir = os.getenv(envname) if user_dir is not None: ...
python
def _get_user_dir(self): ''' Get the user's home directory. ''' try: # This should work in both Windows and Unix environments for envname in ['USERPROFILE', 'HOME']: user_dir = os.getenv(envname) if user_dir is not None: ...
[ "def", "_get_user_dir", "(", "self", ")", ":", "try", ":", "# This should work in both Windows and Unix environments", "for", "envname", "in", "[", "'USERPROFILE'", ",", "'HOME'", "]", ":", "user_dir", "=", "os", ".", "getenv", "(", "envname", ")", "if", "user_d...
Get the user's home directory.
[ "Get", "the", "user", "s", "home", "directory", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L125-L140
train
Get the user s home directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings._file_path
def _file_path(self, dirname, filename): ''' Builds an absolute path and creates the directory and file if they don't already exist. @dirname - Directory path. @filename - File name. Returns a full path of 'dirname/filename'. ''' if not os.path.exists(dirname):...
python
def _file_path(self, dirname, filename): ''' Builds an absolute path and creates the directory and file if they don't already exist. @dirname - Directory path. @filename - File name. Returns a full path of 'dirname/filename'. ''' if not os.path.exists(dirname):...
[ "def", "_file_path", "(", "self", ",", "dirname", ",", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "dirname", ")", ":", "try", ":", "os", ".", "makedirs", "(", "dirname", ")", "except", "KeyboardInterrupt", "as", "e", ":...
Builds an absolute path and creates the directory and file if they don't already exist. @dirname - Directory path. @filename - File name. Returns a full path of 'dirname/filename'.
[ "Builds", "an", "absolute", "path", "and", "creates", "the", "directory", "and", "file", "if", "they", "don", "t", "already", "exist", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L142-L169
train
Builds an absolute path and creates the directory and file if they don t already exist.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings._user_path
def _user_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the user binwalk directory. @subdir - Subdirectory inside the user binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basenam...
python
def _user_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the user binwalk directory. @subdir - Subdirectory inside the user binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basenam...
[ "def", "_user_path", "(", "self", ",", "subdir", ",", "basename", "=", "''", ")", ":", "try", ":", "return", "self", ".", "_file_path", "(", "os", ".", "path", ".", "join", "(", "self", ".", "user_dir", ",", "self", ".", "BINWALK_USER_DIR", ",", "sub...
Gets the full path to the 'subdir/basename' file in the user binwalk directory. @subdir - Subdirectory inside the user binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basename' file.
[ "Gets", "the", "full", "path", "to", "the", "subdir", "/", "basename", "file", "in", "the", "user", "binwalk", "directory", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L171-L185
train
Gets the full path to the user binwalk file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/core/settings.py
Settings._system_path
def _system_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/b...
python
def _system_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/b...
[ "def", "_system_path", "(", "self", ",", "subdir", ",", "basename", "=", "''", ")", ":", "try", ":", "return", "self", ".", "_file_path", "(", "os", ".", "path", ".", "join", "(", "self", ".", "system_dir", ",", "subdir", ")", ",", "basename", ")", ...
Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basename' file.
[ "Gets", "the", "full", "path", "to", "the", "subdir", "/", "basename", "file", "in", "the", "system", "binwalk", "directory", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/settings.py#L187-L201
train
Returns the full path to the basename file in the system binwalk directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/plugins/hilink.py
HilinkDecryptor._decrypt_and_extract
def _decrypt_and_extract(self, fname): ''' This does the extraction (e.g., it decrypts the image and writes it to a new file on disk). ''' with open(fname, "r") as fp_in: encrypted_data = fp_in.read() decrypted_data = self._hilink_decrypt(encrypted_data) ...
python
def _decrypt_and_extract(self, fname): ''' This does the extraction (e.g., it decrypts the image and writes it to a new file on disk). ''' with open(fname, "r") as fp_in: encrypted_data = fp_in.read() decrypted_data = self._hilink_decrypt(encrypted_data) ...
[ "def", "_decrypt_and_extract", "(", "self", ",", "fname", ")", ":", "with", "open", "(", "fname", ",", "\"r\"", ")", "as", "fp_in", ":", "encrypted_data", "=", "fp_in", ".", "read", "(", ")", "decrypted_data", "=", "self", ".", "_hilink_decrypt", "(", "e...
This does the extraction (e.g., it decrypts the image and writes it to a new file on disk).
[ "This", "does", "the", "extraction", "(", "e", ".", "g", ".", "it", "decrypts", "the", "image", "and", "writes", "it", "to", "a", "new", "file", "on", "disk", ")", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/hilink.py#L38-L48
train
This does the decryption and extraction of the image.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/plugins/hilink.py
HilinkDecryptor._hilink_decrypt
def _hilink_decrypt(self, encrypted_firmware): ''' This does the actual decryption. ''' cipher = DES.new(self.DES_KEY, DES.MODE_ECB) p1 = encrypted_firmware[0:3] p2 = encrypted_firmware[3:] p2 += b"\x00" * (8 - (len(p2) % 8)) d1 = p1 + cipher.decrypt(p2)...
python
def _hilink_decrypt(self, encrypted_firmware): ''' This does the actual decryption. ''' cipher = DES.new(self.DES_KEY, DES.MODE_ECB) p1 = encrypted_firmware[0:3] p2 = encrypted_firmware[3:] p2 += b"\x00" * (8 - (len(p2) % 8)) d1 = p1 + cipher.decrypt(p2)...
[ "def", "_hilink_decrypt", "(", "self", ",", "encrypted_firmware", ")", ":", "cipher", "=", "DES", ".", "new", "(", "self", ".", "DES_KEY", ",", "DES", ".", "MODE_ECB", ")", "p1", "=", "encrypted_firmware", "[", "0", ":", "3", "]", "p2", "=", "encrypted...
This does the actual decryption.
[ "This", "does", "the", "actual", "decryption", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/hilink.py#L50-L63
train
This does the actual decryption.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
ReFirmLabs/binwalk
src/binwalk/plugins/hilink.py
HilinkDecryptor.scan
def scan(self, result): ''' Validate signature results. ''' if self.enabled is True: if result.valid is True: if result.description.lower().startswith(self.SIGNATURE_DESCRIPTION) is True: # Read in the first 64 bytes of the suspected encryp...
python
def scan(self, result): ''' Validate signature results. ''' if self.enabled is True: if result.valid is True: if result.description.lower().startswith(self.SIGNATURE_DESCRIPTION) is True: # Read in the first 64 bytes of the suspected encryp...
[ "def", "scan", "(", "self", ",", "result", ")", ":", "if", "self", ".", "enabled", "is", "True", ":", "if", "result", ".", "valid", "is", "True", ":", "if", "result", ".", "description", ".", "lower", "(", ")", ".", "startswith", "(", "self", ".", ...
Validate signature results.
[ "Validate", "signature", "results", "." ]
a0c5315fd2bae167e5c3d8469ce95d5defc743c2
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/plugins/hilink.py#L65-L94
train
Validate signature results.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/new_messages_observer.py
run
def run(): print("Environment", os.environ) try: os.environ["SELENIUM"] except KeyError: print("Please set the environment variable SELENIUM to Selenium URL") sys.exit(1) driver = WhatsAPIDriver(client='remote', command_executor=os.environ["SELENIUM"]) print("Waiting for QR"...
python
def run(): print("Environment", os.environ) try: os.environ["SELENIUM"] except KeyError: print("Please set the environment variable SELENIUM to Selenium URL") sys.exit(1) driver = WhatsAPIDriver(client='remote', command_executor=os.environ["SELENIUM"]) print("Waiting for QR"...
[ "def", "run", "(", ")", ":", "print", "(", "\"Environment\"", ",", "os", ".", "environ", ")", "try", ":", "os", ".", "environ", "[", "\"SELENIUM\"", "]", "except", "KeyError", ":", "print", "(", "\"Please set the environment variable SELENIUM to Selenium URL\"", ...
Locks the main thread while the subscription in running
[ "Locks", "the", "main", "thread", "while", "the", "subscription", "in", "running" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/new_messages_observer.py#L8-L26
train
This function is run in a thread.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.save_firefox_profile
def save_firefox_profile(self, remove_old=False): """Function to save the firefox profile to the permanant one""" self.logger.info("Saving profile from %s to %s" % (self._profile.path, self._profile_path)) if remove_old: if os.path.exists(self._profile_path): try: ...
python
def save_firefox_profile(self, remove_old=False): """Function to save the firefox profile to the permanant one""" self.logger.info("Saving profile from %s to %s" % (self._profile.path, self._profile_path)) if remove_old: if os.path.exists(self._profile_path): try: ...
[ "def", "save_firefox_profile", "(", "self", ",", "remove_old", "=", "False", ")", ":", "self", ".", "logger", ".", "info", "(", "\"Saving profile from %s to %s\"", "%", "(", "self", ".", "_profile", ".", "path", ",", "self", ".", "_profile_path", ")", ")", ...
Function to save the firefox profile to the permanant one
[ "Function", "to", "save", "the", "firefox", "profile", "to", "the", "permanant", "one" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L111-L137
train
Function to save the firefox profile to the permanant one
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.wait_for_login
def wait_for_login(self, timeout=90): """Waits for the QR to go away""" WebDriverWait(self.driver, timeout).until( EC.visibility_of_element_located((By.CSS_SELECTOR, self._SELECTORS['mainPage'])) )
python
def wait_for_login(self, timeout=90): """Waits for the QR to go away""" WebDriverWait(self.driver, timeout).until( EC.visibility_of_element_located((By.CSS_SELECTOR, self._SELECTORS['mainPage'])) )
[ "def", "wait_for_login", "(", "self", ",", "timeout", "=", "90", ")", ":", "WebDriverWait", "(", "self", ".", "driver", ",", "timeout", ")", ".", "until", "(", "EC", ".", "visibility_of_element_located", "(", "(", "By", ".", "CSS_SELECTOR", ",", "self", ...
Waits for the QR to go away
[ "Waits", "for", "the", "QR", "to", "go", "away" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L258-L262
train
Waits for QR to go away
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_qr
def get_qr(self, filename=None): """Get pairing QR code from client""" if "Click to reload QR code" in self.driver.page_source: self.reload_qr() qr = self.driver.find_element_by_css_selector(self._SELECTORS['qrCode']) if filename is None: fd, fn_png = tempfile.mks...
python
def get_qr(self, filename=None): """Get pairing QR code from client""" if "Click to reload QR code" in self.driver.page_source: self.reload_qr() qr = self.driver.find_element_by_css_selector(self._SELECTORS['qrCode']) if filename is None: fd, fn_png = tempfile.mks...
[ "def", "get_qr", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "\"Click to reload QR code\"", "in", "self", ".", "driver", ".", "page_source", ":", "self", ".", "reload_qr", "(", ")", "qr", "=", "self", ".", "driver", ".", "find_element_by_css...
Get pairing QR code from client
[ "Get", "pairing", "QR", "code", "from", "client" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L267-L280
train
Get pairing QR code from client
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_contacts
def get_contacts(self): """ Fetches list of all contacts This will return chats with people from the address book only Use get_all_chats for all chats :return: List of contacts :rtype: list[Contact] """ all_contacts = self.wapi_functions.getAllContacts() ...
python
def get_contacts(self): """ Fetches list of all contacts This will return chats with people from the address book only Use get_all_chats for all chats :return: List of contacts :rtype: list[Contact] """ all_contacts = self.wapi_functions.getAllContacts() ...
[ "def", "get_contacts", "(", "self", ")", ":", "all_contacts", "=", "self", ".", "wapi_functions", ".", "getAllContacts", "(", ")", "return", "[", "Contact", "(", "contact", ",", "self", ")", "for", "contact", "in", "all_contacts", "]" ]
Fetches list of all contacts This will return chats with people from the address book only Use get_all_chats for all chats :return: List of contacts :rtype: list[Contact]
[ "Fetches", "list", "of", "all", "contacts", "This", "will", "return", "chats", "with", "people", "from", "the", "address", "book", "only", "Use", "get_all_chats", "for", "all", "chats" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L292-L302
train
Fetches list of all contacts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_my_contacts
def get_my_contacts(self): """ Fetches list of added contacts :return: List of contacts :rtype: list[Contact] """ my_contacts = self.wapi_functions.getMyContacts() return [Contact(contact, self) for contact in my_contacts]
python
def get_my_contacts(self): """ Fetches list of added contacts :return: List of contacts :rtype: list[Contact] """ my_contacts = self.wapi_functions.getMyContacts() return [Contact(contact, self) for contact in my_contacts]
[ "def", "get_my_contacts", "(", "self", ")", ":", "my_contacts", "=", "self", ".", "wapi_functions", ".", "getMyContacts", "(", ")", "return", "[", "Contact", "(", "contact", ",", "self", ")", "for", "contact", "in", "my_contacts", "]" ]
Fetches list of added contacts :return: List of contacts :rtype: list[Contact]
[ "Fetches", "list", "of", "added", "contacts" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L304-L312
train
Fetches list of added contacts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_all_chats
def get_all_chats(self): """ Fetches all chats :return: List of chats :rtype: list[Chat] """ chats = self.wapi_functions.getAllChats() if chats: return [factory_chat(chat, self) for chat in chats] else: return []
python
def get_all_chats(self): """ Fetches all chats :return: List of chats :rtype: list[Chat] """ chats = self.wapi_functions.getAllChats() if chats: return [factory_chat(chat, self) for chat in chats] else: return []
[ "def", "get_all_chats", "(", "self", ")", ":", "chats", "=", "self", ".", "wapi_functions", ".", "getAllChats", "(", ")", "if", "chats", ":", "return", "[", "factory_chat", "(", "chat", ",", "self", ")", "for", "chat", "in", "chats", "]", "else", ":", ...
Fetches all chats :return: List of chats :rtype: list[Chat]
[ "Fetches", "all", "chats" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L314-L325
train
Fetches all chats in the system
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_unread
def get_unread(self, include_me=False, include_notifications=False, use_unread_count=False): """ Fetches unread messages :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_...
python
def get_unread(self, include_me=False, include_notifications=False, use_unread_count=False): """ Fetches unread messages :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_...
[ "def", "get_unread", "(", "self", ",", "include_me", "=", "False", ",", "include_notifications", "=", "False", ",", "use_unread_count", "=", "False", ")", ":", "raw_message_groups", "=", "self", ".", "wapi_functions", ".", "getUnreadMessages", "(", "include_me", ...
Fetches unread messages :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_notifications: bool or None :param use_unread_count: If set uses chat's 'unreadCount' attribute to fetch ...
[ "Fetches", "unread", "messages", ":", "param", "include_me", ":", "Include", "user", "s", "messages", ":", "type", "include_me", ":", "bool", "or", "None", ":", "param", "include_notifications", ":", "Include", "events", "happening", "on", "chat", ":", "type",...
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L336-L357
train
Fetches all unread messages from the server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_unread_messages_in_chat
def get_unread_messages_in_chat(self, id, include_me=False, include_notifications=False): """ I fetch unread messages from an asked chat. :param id: chat id :type id: str ...
python
def get_unread_messages_in_chat(self, id, include_me=False, include_notifications=False): """ I fetch unread messages from an asked chat. :param id: chat id :type id: str ...
[ "def", "get_unread_messages_in_chat", "(", "self", ",", "id", ",", "include_me", "=", "False", ",", "include_notifications", "=", "False", ")", ":", "# get unread messages", "messages", "=", "self", ".", "wapi_functions", ".", "getUnreadMessagesInChat", "(", "id", ...
I fetch unread messages from an asked chat. :param id: chat id :type id: str :param include_me: if user's messages are to be included :type include_me: bool :param include_notifications: if events happening on chat are to be included :type include_notifications: bool ...
[ "I", "fetch", "unread", "messages", "from", "an", "asked", "chat", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L359-L386
train
I fetch unread messages from an asked chat.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_all_messages_in_chat
def get_all_messages_in_chat(self, chat, include_me=False, include_notifications=False): """ Fetches messages in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_no...
python
def get_all_messages_in_chat(self, chat, include_me=False, include_notifications=False): """ Fetches messages in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_no...
[ "def", "get_all_messages_in_chat", "(", "self", ",", "chat", ",", "include_me", "=", "False", ",", "include_notifications", "=", "False", ")", ":", "message_objs", "=", "self", ".", "wapi_functions", ".", "getAllMessagesInChat", "(", "chat", ".", "id", ",", "i...
Fetches messages in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_notifications: bool or None :return: List of messages in chat :rtype: list[Message]
[ "Fetches", "messages", "in", "chat" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L390-L405
train
Fetches all messages in a chat
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_all_message_ids_in_chat
def get_all_message_ids_in_chat(self, chat, include_me=False, include_notifications=False): """ Fetches message ids in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type incl...
python
def get_all_message_ids_in_chat(self, chat, include_me=False, include_notifications=False): """ Fetches message ids in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type incl...
[ "def", "get_all_message_ids_in_chat", "(", "self", ",", "chat", ",", "include_me", "=", "False", ",", "include_notifications", "=", "False", ")", ":", "return", "self", ".", "wapi_functions", ".", "getAllMessageIdsInChat", "(", "chat", ".", "id", ",", "include_m...
Fetches message ids in chat :param include_me: Include user's messages :type include_me: bool or None :param include_notifications: Include events happening on chat :type include_notifications: bool or None :return: List of message ids in chat :rtype: list[str]
[ "Fetches", "message", "ids", "in", "chat" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L407-L418
train
Fetches all message ids in a chat
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_message_by_id
def get_message_by_id(self, message_id): """ Fetch a message :param message_id: Message ID :type message_id: str :return: Message or False :rtype: Message """ result = self.wapi_functions.getMessageById(message_id) if result: result =...
python
def get_message_by_id(self, message_id): """ Fetch a message :param message_id: Message ID :type message_id: str :return: Message or False :rtype: Message """ result = self.wapi_functions.getMessageById(message_id) if result: result =...
[ "def", "get_message_by_id", "(", "self", ",", "message_id", ")", ":", "result", "=", "self", ".", "wapi_functions", ".", "getMessageById", "(", "message_id", ")", "if", "result", ":", "result", "=", "factory_message", "(", "result", ",", "self", ")", "return...
Fetch a message :param message_id: Message ID :type message_id: str :return: Message or False :rtype: Message
[ "Fetch", "a", "message" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L420-L434
train
Fetch a message by its ID
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_contact_from_id
def get_contact_from_id(self, contact_id): """ Fetches a contact given its ID :param contact_id: Contact ID :type contact_id: str :return: Contact or Error :rtype: Contact """ contact = self.wapi_functions.getContact(contact_id) if contact is Non...
python
def get_contact_from_id(self, contact_id): """ Fetches a contact given its ID :param contact_id: Contact ID :type contact_id: str :return: Contact or Error :rtype: Contact """ contact = self.wapi_functions.getContact(contact_id) if contact is Non...
[ "def", "get_contact_from_id", "(", "self", ",", "contact_id", ")", ":", "contact", "=", "self", ".", "wapi_functions", ".", "getContact", "(", "contact_id", ")", "if", "contact", "is", "None", ":", "raise", "ContactNotFoundError", "(", "\"Contact {0} not found\"",...
Fetches a contact given its ID :param contact_id: Contact ID :type contact_id: str :return: Contact or Error :rtype: Contact
[ "Fetches", "a", "contact", "given", "its", "ID" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L436-L450
train
Fetches a contact given its ID
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_chat_from_id
def get_chat_from_id(self, chat_id): """ Fetches a chat given its ID :param chat_id: Chat ID :type chat_id: str :return: Chat or Error :rtype: Chat """ chat = self.wapi_functions.getChatById(chat_id) if chat: return factory_chat(chat, ...
python
def get_chat_from_id(self, chat_id): """ Fetches a chat given its ID :param chat_id: Chat ID :type chat_id: str :return: Chat or Error :rtype: Chat """ chat = self.wapi_functions.getChatById(chat_id) if chat: return factory_chat(chat, ...
[ "def", "get_chat_from_id", "(", "self", ",", "chat_id", ")", ":", "chat", "=", "self", ".", "wapi_functions", ".", "getChatById", "(", "chat_id", ")", "if", "chat", ":", "return", "factory_chat", "(", "chat", ",", "self", ")", "raise", "ChatNotFoundError", ...
Fetches a chat given its ID :param chat_id: Chat ID :type chat_id: str :return: Chat or Error :rtype: Chat
[ "Fetches", "a", "chat", "given", "its", "ID" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L452-L465
train
Fetches a chat given its ID
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_chat_from_phone_number
def get_chat_from_phone_number(self, number, createIfNotFound = False): """ Gets chat by phone number Number format should be as it appears in Whatsapp ID For example, for the number: +972-51-234-5678 This function would receive: 972512345678 :param numbe...
python
def get_chat_from_phone_number(self, number, createIfNotFound = False): """ Gets chat by phone number Number format should be as it appears in Whatsapp ID For example, for the number: +972-51-234-5678 This function would receive: 972512345678 :param numbe...
[ "def", "get_chat_from_phone_number", "(", "self", ",", "number", ",", "createIfNotFound", "=", "False", ")", ":", "for", "chat", "in", "self", ".", "get_all_chats", "(", ")", ":", "if", "not", "isinstance", "(", "chat", ",", "UserChat", ")", "or", "number"...
Gets chat by phone number Number format should be as it appears in Whatsapp ID For example, for the number: +972-51-234-5678 This function would receive: 972512345678 :param number: Phone number :return: Chat :rtype: Chat
[ "Gets", "chat", "by", "phone", "number", "Number", "format", "should", "be", "as", "it", "appears", "in", "Whatsapp", "ID", "For", "example", "for", "the", "number", ":", "+", "972", "-", "51", "-", "234", "-", "5678", "This", "function", "would", "rec...
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L467-L492
train
Gets chat by phone number
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_status
def get_status(self): """ Returns status of the driver :return: Status :rtype: WhatsAPIDriverStatus """ if self.driver is None: return WhatsAPIDriverStatus.NotConnected if self.driver.session_id is None: return WhatsAPIDriverStatus.NotConn...
python
def get_status(self): """ Returns status of the driver :return: Status :rtype: WhatsAPIDriverStatus """ if self.driver is None: return WhatsAPIDriverStatus.NotConnected if self.driver.session_id is None: return WhatsAPIDriverStatus.NotConn...
[ "def", "get_status", "(", "self", ")", ":", "if", "self", ".", "driver", "is", "None", ":", "return", "WhatsAPIDriverStatus", ".", "NotConnected", "if", "self", ".", "driver", ".", "session_id", "is", "None", ":", "return", "WhatsAPIDriverStatus", ".", "NotC...
Returns status of the driver :return: Status :rtype: WhatsAPIDriverStatus
[ "Returns", "status", "of", "the", "driver" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L497-L518
train
Returns the status of the driver
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.contact_get_common_groups
def contact_get_common_groups(self, contact_id): """ Returns groups common between a user and the contact with given id. :return: Contact or Error :rtype: Contact """ for group in self.wapi_functions.getCommonGroups(contact_id): yield factory_chat(group, self...
python
def contact_get_common_groups(self, contact_id): """ Returns groups common between a user and the contact with given id. :return: Contact or Error :rtype: Contact """ for group in self.wapi_functions.getCommonGroups(contact_id): yield factory_chat(group, self...
[ "def", "contact_get_common_groups", "(", "self", ",", "contact_id", ")", ":", "for", "group", "in", "self", ".", "wapi_functions", ".", "getCommonGroups", "(", "contact_id", ")", ":", "yield", "factory_chat", "(", "group", ",", "self", ")" ]
Returns groups common between a user and the contact with given id. :return: Contact or Error :rtype: Contact
[ "Returns", "groups", "common", "between", "a", "user", "and", "the", "contact", "with", "given", "id", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L520-L528
train
Returns the groups common between a user and a contact with given id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.convert_to_base64
def convert_to_base64(self, path): """ :param path: file path :return: returns the converted string and formatted for the send media function send_media """ mime = magic.Magic(mime=True) content_type = mime.from_file(path) archive = '' with open(path, "rb...
python
def convert_to_base64(self, path): """ :param path: file path :return: returns the converted string and formatted for the send media function send_media """ mime = magic.Magic(mime=True) content_type = mime.from_file(path) archive = '' with open(path, "rb...
[ "def", "convert_to_base64", "(", "self", ",", "path", ")", ":", "mime", "=", "magic", ".", "Magic", "(", "mime", "=", "True", ")", "content_type", "=", "mime", ".", "from_file", "(", "path", ")", "archive", "=", "''", "with", "open", "(", "path", ","...
:param path: file path :return: returns the converted string and formatted for the send media function send_media
[ ":", "param", "path", ":", "file", "path", ":", "return", ":", "returns", "the", "converted", "string", "and", "formatted", "for", "the", "send", "media", "function", "send_media" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L555-L567
train
converts the file path to base64 and returns the converted string formatted for the send media function
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.send_media
def send_media(self, path, chatid, caption): """ converts the file to base64 and sends it using the sendImage function of wapi.js :param path: file path :param chatid: chatId to be sent :param caption: :return: """ imgBase64 = self.convert_to_base64(pa...
python
def send_media(self, path, chatid, caption): """ converts the file to base64 and sends it using the sendImage function of wapi.js :param path: file path :param chatid: chatId to be sent :param caption: :return: """ imgBase64 = self.convert_to_base64(pa...
[ "def", "send_media", "(", "self", ",", "path", ",", "chatid", ",", "caption", ")", ":", "imgBase64", "=", "self", ".", "convert_to_base64", "(", "path", ")", "filename", "=", "os", ".", "path", ".", "split", "(", "path", ")", "[", "-", "1", "]", "r...
converts the file to base64 and sends it using the sendImage function of wapi.js :param path: file path :param chatid: chatId to be sent :param caption: :return:
[ "converts", "the", "file", "to", "base64", "and", "sends", "it", "using", "the", "sendImage", "function", "of", "wapi", ".", "js", ":", "param", "path", ":", "file", "path", ":", "param", "chatid", ":", "chatId", "to", "be", "sent", ":", "param", "capt...
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L570-L580
train
This method is used to send a file to the chat using the sendImage function of wapi. js
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_profile_pic_from_id
def get_profile_pic_from_id(self, id): """ Get full profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str """ profile_pic = self.wapi_functions.getProfilePicFromId(id) if ...
python
def get_profile_pic_from_id(self, id): """ Get full profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str """ profile_pic = self.wapi_functions.getProfilePicFromId(id) if ...
[ "def", "get_profile_pic_from_id", "(", "self", ",", "id", ")", ":", "profile_pic", "=", "self", ".", "wapi_functions", ".", "getProfilePicFromId", "(", "id", ")", "if", "profile_pic", ":", "return", "b64decode", "(", "profile_pic", ")", "else", ":", "return", ...
Get full profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str
[ "Get", "full", "profile", "pic", "from", "an", "id", "The", "ID", "must", "be", "on", "your", "contact", "book", "to", "successfully", "get", "their", "profile", "picture", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L623-L636
train
Get full profile picture from an ID
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.get_profile_pic_small_from_id
def get_profile_pic_small_from_id(self, id): """ Get small profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str """ profile_pic_small = self.wapi_functions.getProfilePicSmallFrom...
python
def get_profile_pic_small_from_id(self, id): """ Get small profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str """ profile_pic_small = self.wapi_functions.getProfilePicSmallFrom...
[ "def", "get_profile_pic_small_from_id", "(", "self", ",", "id", ")", ":", "profile_pic_small", "=", "self", ".", "wapi_functions", ".", "getProfilePicSmallFromId", "(", "id", ")", "if", "profile_pic", ":", "return", "b64decode", "(", "profile_pic_small", ")", "els...
Get small profile pic from an id The ID must be on your contact book to successfully get their profile picture. :param id: ID :type id: str
[ "Get", "small", "profile", "pic", "from", "an", "id", "The", "ID", "must", "be", "on", "your", "contact", "book", "to", "successfully", "get", "their", "profile", "picture", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L638-L651
train
Get small profile pic from an ID
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.delete_message
def delete_message(self, chat_id, message_array, revoke=False): """ Delete a chat :param chat_id: id of chat :param message_array: one or more message(s) id :param revoke: Set to true so the message will be deleted for everyone, not only you :return: """ ...
python
def delete_message(self, chat_id, message_array, revoke=False): """ Delete a chat :param chat_id: id of chat :param message_array: one or more message(s) id :param revoke: Set to true so the message will be deleted for everyone, not only you :return: """ ...
[ "def", "delete_message", "(", "self", ",", "chat_id", ",", "message_array", ",", "revoke", "=", "False", ")", ":", "return", "self", ".", "wapi_functions", ".", "deleteMessage", "(", "chat_id", ",", "message_array", ",", "revoke", "=", "False", ")" ]
Delete a chat :param chat_id: id of chat :param message_array: one or more message(s) id :param revoke: Set to true so the message will be deleted for everyone, not only you :return:
[ "Delete", "a", "chat" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L719-L728
train
Use this method to delete a message from a chat
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/__init__.py
WhatsAPIDriver.check_number_status
def check_number_status(self, number_id): """ Check if a number is valid/registered in the whatsapp service :param number_id: number id :return: """ number_status = self.wapi_functions.checkNumberStatus(number_id) return NumberStatus(number_status, self)
python
def check_number_status(self, number_id): """ Check if a number is valid/registered in the whatsapp service :param number_id: number id :return: """ number_status = self.wapi_functions.checkNumberStatus(number_id) return NumberStatus(number_status, self)
[ "def", "check_number_status", "(", "self", ",", "number_id", ")", ":", "number_status", "=", "self", ".", "wapi_functions", ".", "checkNumberStatus", "(", "number_id", ")", "return", "NumberStatus", "(", "number_status", ",", "self", ")" ]
Check if a number is valid/registered in the whatsapp service :param number_id: number id :return:
[ "Check", "if", "a", "number", "is", "valid", "/", "registered", "in", "the", "whatsapp", "service" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/__init__.py#L730-L738
train
Check if a number is valid in the whatsapp service.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/objects/chat.py
factory_chat
def factory_chat(js_obj, driver=None): """Factory function for creating appropriate object given selenium JS object""" if js_obj["kind"] not in ["chat", "group", "broadcast"]: raise AssertionError("Expected chat, group or broadcast object, got {0}".format(js_obj["kind"])) if js_obj["isGroup"]: ...
python
def factory_chat(js_obj, driver=None): """Factory function for creating appropriate object given selenium JS object""" if js_obj["kind"] not in ["chat", "group", "broadcast"]: raise AssertionError("Expected chat, group or broadcast object, got {0}".format(js_obj["kind"])) if js_obj["isGroup"]: ...
[ "def", "factory_chat", "(", "js_obj", ",", "driver", "=", "None", ")", ":", "if", "js_obj", "[", "\"kind\"", "]", "not", "in", "[", "\"chat\"", ",", "\"group\"", ",", "\"broadcast\"", "]", ":", "raise", "AssertionError", "(", "\"Expected chat, group or broadca...
Factory function for creating appropriate object given selenium JS object
[ "Factory", "function", "for", "creating", "appropriate", "object", "given", "selenium", "JS", "object" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L7-L18
train
Factory function for creating appropriate object given selenium JS object
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/objects/chat.py
Chat.get_unread_messages
def get_unread_messages(self, include_me=False, include_notifications=False): """ I fetch unread messages. :param include_me: if user's messages are to be included :type include_me: bool :param include_notifications: if e...
python
def get_unread_messages(self, include_me=False, include_notifications=False): """ I fetch unread messages. :param include_me: if user's messages are to be included :type include_me: bool :param include_notifications: if e...
[ "def", "get_unread_messages", "(", "self", ",", "include_me", "=", "False", ",", "include_notifications", "=", "False", ")", ":", "return", "list", "(", "self", ".", "driver", ".", "get_unread_messages_in_chat", "(", "self", ".", "id", ",", "include_me", ",", ...
I fetch unread messages. :param include_me: if user's messages are to be included :type include_me: bool :param include_notifications: if events happening on chat are to be included :type include_notifications: bool :return: list of unread messages :rtype: list
[ "I", "fetch", "unread", "messages", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L42-L61
train
I fetch unread messages.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/objects/chat.py
Chat.load_earlier_messages_till
def load_earlier_messages_till(self, last): """ Triggers loading of messages till a specific point in time :param last: Datetime object for the last message to be loaded :type last: datetime :return: Nothing :rtype: None """ timestamp = time.mktime(last.t...
python
def load_earlier_messages_till(self, last): """ Triggers loading of messages till a specific point in time :param last: Datetime object for the last message to be loaded :type last: datetime :return: Nothing :rtype: None """ timestamp = time.mktime(last.t...
[ "def", "load_earlier_messages_till", "(", "self", ",", "last", ")", ":", "timestamp", "=", "time", ".", "mktime", "(", "last", ".", "timetuple", "(", ")", ")", "self", ".", "driver", ".", "wapi_functions", ".", "loadEarlierMessagesTillDate", "(", "self", "."...
Triggers loading of messages till a specific point in time :param last: Datetime object for the last message to be loaded :type last: datetime :return: Nothing :rtype: None
[ "Triggers", "loading", "of", "messages", "till", "a", "specific", "point", "in", "time" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/chat.py#L71-L81
train
Triggers loading of messages till a specific point in time
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/objects/message.py
factory_message
def factory_message(js_obj, driver): """Factory function for creating appropriate object given selenium JS object""" if js_obj is None: return if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]: return GeoMessage(js_obj, driver) if js_obj["isMedia"]: ret...
python
def factory_message(js_obj, driver): """Factory function for creating appropriate object given selenium JS object""" if js_obj is None: return if "lat" in js_obj and "lng" in js_obj and js_obj["lat"] and js_obj["lng"]: return GeoMessage(js_obj, driver) if js_obj["isMedia"]: ret...
[ "def", "factory_message", "(", "js_obj", ",", "driver", ")", ":", "if", "js_obj", "is", "None", ":", "return", "if", "\"lat\"", "in", "js_obj", "and", "\"lng\"", "in", "js_obj", "and", "js_obj", "[", "\"lat\"", "]", "and", "js_obj", "[", "\"lng\"", "]", ...
Factory function for creating appropriate object given selenium JS object
[ "Factory", "function", "for", "creating", "appropriate", "object", "given", "selenium", "JS", "object" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/message.py#L21-L41
train
Factory function for creating appropriate object given selenium JS object
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
create_logger
def create_logger(): """Initial the global logger variable""" global logger formatter = logging.Formatter('%(asctime)s|%(levelname)s|%(message)s') handler = TimedRotatingFileHandler(log_file, when="midnight", interval=1) handler.setFormatter(formatter) handler.setLevel(log_level) handler.su...
python
def create_logger(): """Initial the global logger variable""" global logger formatter = logging.Formatter('%(asctime)s|%(levelname)s|%(message)s') handler = TimedRotatingFileHandler(log_file, when="midnight", interval=1) handler.setFormatter(formatter) handler.setLevel(log_level) handler.su...
[ "def", "create_logger", "(", ")", ":", "global", "logger", "formatter", "=", "logging", ".", "Formatter", "(", "'%(asctime)s|%(levelname)s|%(message)s'", ")", "handler", "=", "TimedRotatingFileHandler", "(", "log_file", ",", "when", "=", "\"midnight\"", ",", "interv...
Initial the global logger variable
[ "Initial", "the", "global", "logger", "variable" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L156-L167
train
Initial the global logger variable
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
init_driver
def init_driver(client_id): """Initialises a new driver via webwhatsapi module @param client_id: ID of user client @return webwhatsapi object """ # Create profile directory if it does not exist profile_path = CHROME_CACHE_PATH + str(client_id) if not os.path.exists(profile_path): ...
python
def init_driver(client_id): """Initialises a new driver via webwhatsapi module @param client_id: ID of user client @return webwhatsapi object """ # Create profile directory if it does not exist profile_path = CHROME_CACHE_PATH + str(client_id) if not os.path.exists(profile_path): ...
[ "def", "init_driver", "(", "client_id", ")", ":", "# Create profile directory if it does not exist", "profile_path", "=", "CHROME_CACHE_PATH", "+", "str", "(", "client_id", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "profile_path", ")", ":", "os", ...
Initialises a new driver via webwhatsapi module @param client_id: ID of user client @return webwhatsapi object
[ "Initialises", "a", "new", "driver", "via", "webwhatsapi", "module" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L170-L199
train
Initialises a new webwhatsapi object based on the given client_id.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
init_client
def init_client(client_id): """Initialse a driver for client and store for future reference @param client_id: ID of client user @return whebwhatsapi object """ if client_id not in drivers: drivers[client_id] = init_driver(client_id) return drivers[client_id]
python
def init_client(client_id): """Initialse a driver for client and store for future reference @param client_id: ID of client user @return whebwhatsapi object """ if client_id not in drivers: drivers[client_id] = init_driver(client_id) return drivers[client_id]
[ "def", "init_client", "(", "client_id", ")", ":", "if", "client_id", "not", "in", "drivers", ":", "drivers", "[", "client_id", "]", "=", "init_driver", "(", "client_id", ")", "return", "drivers", "[", "client_id", "]" ]
Initialse a driver for client and store for future reference @param client_id: ID of client user @return whebwhatsapi object
[ "Initialse", "a", "driver", "for", "client", "and", "store", "for", "future", "reference" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L202-L210
train
Initialse a driver for client and store for future reference
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
delete_client
def delete_client(client_id, preserve_cache): """Delete all objects related to client @param client_id: ID of client user @param preserve_cache: Boolean, whether to delete the chrome profile folder or not """ if client_id in drivers: drivers.pop(client_id).quit() try: ...
python
def delete_client(client_id, preserve_cache): """Delete all objects related to client @param client_id: ID of client user @param preserve_cache: Boolean, whether to delete the chrome profile folder or not """ if client_id in drivers: drivers.pop(client_id).quit() try: ...
[ "def", "delete_client", "(", "client_id", ",", "preserve_cache", ")", ":", "if", "client_id", "in", "drivers", ":", "drivers", ".", "pop", "(", "client_id", ")", ".", "quit", "(", ")", "try", ":", "timers", "[", "client_id", "]", ".", "stop", "(", ")",...
Delete all objects related to client @param client_id: ID of client user @param preserve_cache: Boolean, whether to delete the chrome profile folder or not
[ "Delete", "all", "objects", "related", "to", "client" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L213-L231
train
Delete all objects related to a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
init_timer
def init_timer(client_id): """Create a timer for the client driver to watch for events @param client_id: ID of clinet user """ if client_id in timers and timers[client_id]: timers[client_id].start() return # Create a timer to call check_new_message function after every 2 seconds...
python
def init_timer(client_id): """Create a timer for the client driver to watch for events @param client_id: ID of clinet user """ if client_id in timers and timers[client_id]: timers[client_id].start() return # Create a timer to call check_new_message function after every 2 seconds...
[ "def", "init_timer", "(", "client_id", ")", ":", "if", "client_id", "in", "timers", "and", "timers", "[", "client_id", "]", ":", "timers", "[", "client_id", "]", ".", "start", "(", ")", "return", "# Create a timer to call check_new_message function after every 2 sec...
Create a timer for the client driver to watch for events @param client_id: ID of clinet user
[ "Create", "a", "timer", "for", "the", "client", "driver", "to", "watch", "for", "events" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L234-L244
train
Create a timer for the client driver to watch for events
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
check_new_messages
def check_new_messages(client_id): """Check for new unread messages and send them to the custom api @param client_id: ID of client user """ # Return if driver is not defined or if whatsapp is not logged in. # Stop the timer as well if client_id not in drivers or not drivers[client_id] or not dr...
python
def check_new_messages(client_id): """Check for new unread messages and send them to the custom api @param client_id: ID of client user """ # Return if driver is not defined or if whatsapp is not logged in. # Stop the timer as well if client_id not in drivers or not drivers[client_id] or not dr...
[ "def", "check_new_messages", "(", "client_id", ")", ":", "# Return if driver is not defined or if whatsapp is not logged in.", "# Stop the timer as well", "if", "client_id", "not", "in", "drivers", "or", "not", "drivers", "[", "client_id", "]", "or", "not", "drivers", "["...
Check for new unread messages and send them to the custom api @param client_id: ID of client user
[ "Check", "for", "new", "unread", "messages", "and", "send", "them", "to", "the", "custom", "api" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L247-L277
train
Check for new unread messages and send them to the custom api
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
get_client_info
def get_client_info(client_id): """Get the status of a perticular client, as to he/she is connected or not @param client_id: ID of client user @return JSON object { "driver_status": webdriver status "is_alive": if driver is active or not "is_logged_in": if user is logged in or n...
python
def get_client_info(client_id): """Get the status of a perticular client, as to he/she is connected or not @param client_id: ID of client user @return JSON object { "driver_status": webdriver status "is_alive": if driver is active or not "is_logged_in": if user is logged in or n...
[ "def", "get_client_info", "(", "client_id", ")", ":", "if", "client_id", "not", "in", "drivers", ":", "return", "None", "driver_status", "=", "drivers", "[", "client_id", "]", ".", "get_status", "(", ")", "is_alive", "=", "False", "is_logged_in", "=", "False...
Get the status of a perticular client, as to he/she is connected or not @param client_id: ID of client user @return JSON object { "driver_status": webdriver status "is_alive": if driver is active or not "is_logged_in": if user is logged in or not "is_timer": if timer is runn...
[ "Get", "the", "status", "of", "a", "perticular", "client", "as", "to", "he", "/", "she", "is", "connected", "or", "not" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L280-L307
train
Get the status of a perticular client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
create_static_profile_path
def create_static_profile_path(client_id): """Create a profile path folder if not exist @param client_id: ID of client user @return string profile path """ profile_path = os.path.join(STATIC_FILES_PATH, str(client_id)) if not os.path.exists(profile_path): os.makedirs(profile_path) ...
python
def create_static_profile_path(client_id): """Create a profile path folder if not exist @param client_id: ID of client user @return string profile path """ profile_path = os.path.join(STATIC_FILES_PATH, str(client_id)) if not os.path.exists(profile_path): os.makedirs(profile_path) ...
[ "def", "create_static_profile_path", "(", "client_id", ")", ":", "profile_path", "=", "os", ".", "path", ".", "join", "(", "STATIC_FILES_PATH", ",", "str", "(", "client_id", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "profile_path", ")",...
Create a profile path folder if not exist @param client_id: ID of client user @return string profile path
[ "Create", "a", "profile", "path", "folder", "if", "not", "exist" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L354-L363
train
Create a profile path folder if not exist
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
before_request
def before_request(): """This runs before every API request. The function take cares of creating driver object is not already created. Also it checks for few prerequisits parameters and set global variables for other functions to use Required paramters for an API hit are: auth-key: key string t...
python
def before_request(): """This runs before every API request. The function take cares of creating driver object is not already created. Also it checks for few prerequisits parameters and set global variables for other functions to use Required paramters for an API hit are: auth-key: key string t...
[ "def", "before_request", "(", ")", ":", "global", "logger", "if", "not", "request", ".", "url_rule", ":", "abort", "(", "404", ")", "if", "logger", "==", "None", ":", "create_logger", "(", ")", "logger", ".", "info", "(", "\"API call \"", "+", "request",...
This runs before every API request. The function take cares of creating driver object is not already created. Also it checks for few prerequisits parameters and set global variables for other functions to use Required paramters for an API hit are: auth-key: key string to identify valid request ...
[ "This", "runs", "before", "every", "API", "request", ".", "The", "function", "take", "cares", "of", "creating", "driver", "object", "is", "not", "already", "created", ".", "Also", "it", "checks", "for", "few", "prerequisits", "parameters", "and", "set", "glo...
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L390-L438
train
This function runs before every API request. It creates a new object and checks for required prerequisites and sets global variables for other functions to use.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
create_client
def create_client(): """Create a new client driver. The driver is automatically created in before_request function.""" result = False if g.client_id in drivers: result = True return jsonify({'Success': result})
python
def create_client(): """Create a new client driver. The driver is automatically created in before_request function.""" result = False if g.client_id in drivers: result = True return jsonify({'Success': result})
[ "def", "create_client", "(", ")", ":", "result", "=", "False", "if", "g", ".", "client_id", "in", "drivers", ":", "result", "=", "True", "return", "jsonify", "(", "{", "'Success'", ":", "result", "}", ")" ]
Create a new client driver. The driver is automatically created in before_request function.
[ "Create", "a", "new", "client", "driver", ".", "The", "driver", "is", "automatically", "created", "in", "before_request", "function", "." ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L473-L479
train
Create a new client driver.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
delete_client
def delete_client(): """Delete all objects related to client""" preserve_cache = request.args.get('preserve_cache', False) delete_client(g.client_id, preserve_cache) return jsonify({'Success': True})
python
def delete_client(): """Delete all objects related to client""" preserve_cache = request.args.get('preserve_cache', False) delete_client(g.client_id, preserve_cache) return jsonify({'Success': True})
[ "def", "delete_client", "(", ")", ":", "preserve_cache", "=", "request", ".", "args", ".", "get", "(", "'preserve_cache'", ",", "False", ")", "delete_client", "(", "g", ".", "client_id", ",", "preserve_cache", ")", "return", "jsonify", "(", "{", "'Success'",...
Delete all objects related to client
[ "Delete", "all", "objects", "related", "to", "client" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L483-L487
train
Delete all objects related to client
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
get_screen
def get_screen(): """Capture chrome screen image and send it back. If the screen is currently at qr scanning phase, return the image of qr only, else return image of full screen""" img_title = 'screen_' + g.client_id + '.png' image_path = STATIC_FILES_PATH + img_title if g.driver_status != What...
python
def get_screen(): """Capture chrome screen image and send it back. If the screen is currently at qr scanning phase, return the image of qr only, else return image of full screen""" img_title = 'screen_' + g.client_id + '.png' image_path = STATIC_FILES_PATH + img_title if g.driver_status != What...
[ "def", "get_screen", "(", ")", ":", "img_title", "=", "'screen_'", "+", "g", ".", "client_id", "+", "'.png'", "image_path", "=", "STATIC_FILES_PATH", "+", "img_title", "if", "g", ".", "driver_status", "!=", "WhatsAPIDriverStatus", ".", "LoggedIn", ":", "try", ...
Capture chrome screen image and send it back. If the screen is currently at qr scanning phase, return the image of qr only, else return image of full screen
[ "Capture", "chrome", "screen", "image", "and", "send", "it", "back", ".", "If", "the", "screen", "is", "currently", "at", "qr", "scanning", "phase", "return", "the", "image", "of", "qr", "only", "else", "return", "image", "of", "full", "screen" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L493-L506
train
Capture chrome screen image and send it back.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
get_unread_messages
def get_unread_messages(): """Get all unread messages""" mark_seen = request.args.get('mark_seen', True) unread_msg = g.driver.get_unread() if mark_seen: for msg in unread_msg: msg.chat.send_seen() return jsonify(unread_msg)
python
def get_unread_messages(): """Get all unread messages""" mark_seen = request.args.get('mark_seen', True) unread_msg = g.driver.get_unread() if mark_seen: for msg in unread_msg: msg.chat.send_seen() return jsonify(unread_msg)
[ "def", "get_unread_messages", "(", ")", ":", "mark_seen", "=", "request", ".", "args", ".", "get", "(", "'mark_seen'", ",", "True", ")", "unread_msg", "=", "g", ".", "driver", ".", "get_unread", "(", ")", "if", "mark_seen", ":", "for", "msg", "in", "un...
Get all unread messages
[ "Get", "all", "unread", "messages" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L518-L527
train
Get all unread messages
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
get_messages
def get_messages(chat_id): """Return all of the chat messages""" mark_seen = request.args.get('mark_seen', True) chat = g.driver.get_chat_from_id(chat_id) msgs = list(g.driver.get_all_messages_in_chat(chat)) for msg in msgs: print(msg.id) if mark_seen: for msg in msgs: ...
python
def get_messages(chat_id): """Return all of the chat messages""" mark_seen = request.args.get('mark_seen', True) chat = g.driver.get_chat_from_id(chat_id) msgs = list(g.driver.get_all_messages_in_chat(chat)) for msg in msgs: print(msg.id) if mark_seen: for msg in msgs: ...
[ "def", "get_messages", "(", "chat_id", ")", ":", "mark_seen", "=", "request", ".", "args", ".", "get", "(", "'mark_seen'", ",", "True", ")", "chat", "=", "g", ".", "driver", ".", "get_chat_from_id", "(", "chat_id", ")", "msgs", "=", "list", "(", "g", ...
Return all of the chat messages
[ "Return", "all", "of", "the", "chat", "messages" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L549-L567
train
Return all of the chat messages in a single chat
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
send_message
def send_message(chat_id): """Send a message to a chat If a media file is found, send_media is called, else a simple text message is sent """ files = request.files if files: res = send_media(chat_id, request) else: message = request.form.get('message') res = g.drive...
python
def send_message(chat_id): """Send a message to a chat If a media file is found, send_media is called, else a simple text message is sent """ files = request.files if files: res = send_media(chat_id, request) else: message = request.form.get('message') res = g.drive...
[ "def", "send_message", "(", "chat_id", ")", ":", "files", "=", "request", ".", "files", "if", "files", ":", "res", "=", "send_media", "(", "chat_id", ",", "request", ")", "else", ":", "message", "=", "request", ".", "form", ".", "get", "(", "'message'"...
Send a message to a chat If a media file is found, send_media is called, else a simple text message is sent
[ "Send", "a", "message", "to", "a", "chat", "If", "a", "media", "file", "is", "found", "send_media", "is", "called", "else", "a", "simple", "text", "message", "is", "sent" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L572-L589
train
Send a message to a chat
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
download_message_media
def download_message_media(msg_id): """Download a media file""" message = g.driver.get_message_by_id(msg_id) if not message or not message.mime: abort(404) profile_path = create_static_profile_path(g.client_id) filename = message.save_media(profile_path, True) if os.path.exists(filena...
python
def download_message_media(msg_id): """Download a media file""" message = g.driver.get_message_by_id(msg_id) if not message or not message.mime: abort(404) profile_path = create_static_profile_path(g.client_id) filename = message.save_media(profile_path, True) if os.path.exists(filena...
[ "def", "download_message_media", "(", "msg_id", ")", ":", "message", "=", "g", ".", "driver", ".", "get_message_by_id", "(", "msg_id", ")", "if", "not", "message", "or", "not", "message", ".", "mime", ":", "abort", "(", "404", ")", "profile_path", "=", "...
Download a media file
[ "Download", "a", "media", "file" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L594-L607
train
Download a media file from the message
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
get_active_clients
def get_active_clients(): """Get a list of all active clients and their status""" global drivers if not drivers: return jsonify([]) result = {client: get_client_info(client) for client in drivers} return jsonify(result)
python
def get_active_clients(): """Get a list of all active clients and their status""" global drivers if not drivers: return jsonify([]) result = {client: get_client_info(client) for client in drivers} return jsonify(result)
[ "def", "get_active_clients", "(", ")", ":", "global", "drivers", "if", "not", "drivers", ":", "return", "jsonify", "(", "[", "]", ")", "result", "=", "{", "client", ":", "get_client_info", "(", "client", ")", "for", "client", "in", "drivers", "}", "retur...
Get a list of all active clients and their status
[ "Get", "a", "list", "of", "all", "active", "clients", "and", "their", "status" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L613-L621
train
Get a list of all active clients and their status
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
run_clients
def run_clients(): """Force create driver for client """ clients = request.form.get('clients') if not clients: return jsonify({'Error': 'no clients provided'}) result = {} for client_id in clients.split(','): if client_id not in drivers: init_client(client_id) ...
python
def run_clients(): """Force create driver for client """ clients = request.form.get('clients') if not clients: return jsonify({'Error': 'no clients provided'}) result = {} for client_id in clients.split(','): if client_id not in drivers: init_client(client_id) ...
[ "def", "run_clients", "(", ")", ":", "clients", "=", "request", ".", "form", ".", "get", "(", "'clients'", ")", "if", "not", "clients", ":", "return", "jsonify", "(", "{", "'Error'", ":", "'no clients provided'", "}", ")", "result", "=", "{", "}", "for...
Force create driver for client
[ "Force", "create", "driver", "for", "client" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L625-L639
train
Create driver for all clients
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
kill_clients
def kill_clients(): """Force kill driver and other objects for a perticular clien""" clients = request.form.get('clients').split(',') kill_dead = request.args.get('kill_dead', default=False) kill_dead = kill_dead and kill_dead in ['true', '1'] if not kill_dead and not clients: return jsonif...
python
def kill_clients(): """Force kill driver and other objects for a perticular clien""" clients = request.form.get('clients').split(',') kill_dead = request.args.get('kill_dead', default=False) kill_dead = kill_dead and kill_dead in ['true', '1'] if not kill_dead and not clients: return jsonif...
[ "def", "kill_clients", "(", ")", ":", "clients", "=", "request", ".", "form", ".", "get", "(", "'clients'", ")", ".", "split", "(", "','", ")", "kill_dead", "=", "request", ".", "args", ".", "get", "(", "'kill_dead'", ",", "default", "=", "False", ")...
Force kill driver and other objects for a perticular clien
[ "Force", "kill", "driver", "and", "other", "objects", "for", "a", "perticular", "clien" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L643-L663
train
Force kill all the clients and all the others
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
mukulhase/WebWhatsapp-Wrapper
webwhatsapi/objects/whatsapp_object.py
driver_needed
def driver_needed(func): """ Decorator for WhatsappObjectWithId methods that need to communicate with the browser It ensures that the object receives a driver instance at construction :param func: WhatsappObjectWithId method :return: Wrapped method """ def wrapped(self, *args): if...
python
def driver_needed(func): """ Decorator for WhatsappObjectWithId methods that need to communicate with the browser It ensures that the object receives a driver instance at construction :param func: WhatsappObjectWithId method :return: Wrapped method """ def wrapped(self, *args): if...
[ "def", "driver_needed", "(", "func", ")", ":", "def", "wrapped", "(", "self", ",", "*", "args", ")", ":", "if", "not", "self", ".", "driver", ":", "raise", "AttributeError", "(", "\"No driver passed to object\"", ")", "return", "func", "(", "self", ",", ...
Decorator for WhatsappObjectWithId methods that need to communicate with the browser It ensures that the object receives a driver instance at construction :param func: WhatsappObjectWithId method :return: Wrapped method
[ "Decorator", "for", "WhatsappObjectWithId", "methods", "that", "need", "to", "communicate", "with", "the", "browser" ]
81b918ee4e0cd0cb563807a72baa167f670d70cb
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/webwhatsapi/objects/whatsapp_object.py#L4-L20
train
Decorator for WhatsappObjectWithId methods that need to communicate with the browser
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.dist_dir
def dist_dir(self): '''The dist dir at which to place the finished distribution.''' if self.distribution is None: warning('Tried to access {}.dist_dir, but {}.distribution ' 'is None'.format(self, self)) exit(1) return self.distribution.dist_dir
python
def dist_dir(self): '''The dist dir at which to place the finished distribution.''' if self.distribution is None: warning('Tried to access {}.dist_dir, but {}.distribution ' 'is None'.format(self, self)) exit(1) return self.distribution.dist_dir
[ "def", "dist_dir", "(", "self", ")", ":", "if", "self", ".", "distribution", "is", "None", ":", "warning", "(", "'Tried to access {}.dist_dir, but {}.distribution '", "'is None'", ".", "format", "(", "self", ",", "self", ")", ")", "exit", "(", "1", ")", "ret...
The dist dir at which to place the finished distribution.
[ "The", "dist", "dir", "at", "which", "to", "place", "the", "finished", "distribution", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L70-L76
train
The dist dir at which to place the finished distribution.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.check_recipe_choices
def check_recipe_choices(self): '''Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.''' recipes = [] built_recipes = self.ctx.recipe_build_order for recipe in self.recipe_depends: ...
python
def check_recipe_choices(self): '''Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.''' recipes = [] built_recipes = self.ctx.recipe_build_order for recipe in self.recipe_depends: ...
[ "def", "check_recipe_choices", "(", "self", ")", ":", "recipes", "=", "[", "]", "built_recipes", "=", "self", ".", "ctx", ".", "recipe_build_order", "for", "recipe", "in", "self", ".", "recipe_depends", ":", "if", "isinstance", "(", "recipe", ",", "(", "tu...
Checks what recipes are being built to see which of the alternative and optional dependencies are being used, and returns a list of these.
[ "Checks", "what", "recipes", "are", "being", "built", "to", "see", "which", "of", "the", "alternative", "and", "optional", "dependencies", "are", "being", "used", "and", "returns", "a", "list", "of", "these", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L82-L94
train
Checks what recipes are being built to see which of the alternative and optional dependencies are being used and returns a list of these.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.prepare_build_dir
def prepare_build_dir(self): '''Ensure that a build dir exists for the recipe. This same single dir will be used for building all different archs.''' self.build_dir = self.get_build_dir() self.common_dir = self.get_common_dir() copy_files(join(self.bootstrap_dir, 'build'), self.b...
python
def prepare_build_dir(self): '''Ensure that a build dir exists for the recipe. This same single dir will be used for building all different archs.''' self.build_dir = self.get_build_dir() self.common_dir = self.get_common_dir() copy_files(join(self.bootstrap_dir, 'build'), self.b...
[ "def", "prepare_build_dir", "(", "self", ")", ":", "self", ".", "build_dir", "=", "self", ".", "get_build_dir", "(", ")", "self", ".", "common_dir", "=", "self", ".", "get_common_dir", "(", ")", "copy_files", "(", "join", "(", "self", ".", "bootstrap_dir",...
Ensure that a build dir exists for the recipe. This same single dir will be used for building all different archs.
[ "Ensure", "that", "a", "build", "dir", "exists", "for", "the", "recipe", ".", "This", "same", "single", "dir", "will", "be", "used", "for", "building", "all", "different", "archs", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L115-L132
train
Ensure that a build dir exists for the recipe. This same single dir will be used for building all different archs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.list_bootstraps
def list_bootstraps(cls): '''Find all the available bootstraps and return them.''' forbidden_dirs = ('__pycache__', 'common') bootstraps_dir = join(dirname(__file__), 'bootstraps') for name in listdir(bootstraps_dir): if name in forbidden_dirs: continue ...
python
def list_bootstraps(cls): '''Find all the available bootstraps and return them.''' forbidden_dirs = ('__pycache__', 'common') bootstraps_dir = join(dirname(__file__), 'bootstraps') for name in listdir(bootstraps_dir): if name in forbidden_dirs: continue ...
[ "def", "list_bootstraps", "(", "cls", ")", ":", "forbidden_dirs", "=", "(", "'__pycache__'", ",", "'common'", ")", "bootstraps_dir", "=", "join", "(", "dirname", "(", "__file__", ")", ",", "'bootstraps'", ")", "for", "name", "in", "listdir", "(", "bootstraps...
Find all the available bootstraps and return them.
[ "Find", "all", "the", "available", "bootstraps", "and", "return", "them", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L141-L150
train
Find all the available bootstraps and return them.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.get_bootstrap_from_recipes
def get_bootstrap_from_recipes(cls, recipes, ctx): '''Returns a bootstrap whose recipe requirements do not conflict with the given recipes.''' info('Trying to find a bootstrap that matches the given recipes.') bootstraps = [cls.get_bootstrap(name, ctx) for name in c...
python
def get_bootstrap_from_recipes(cls, recipes, ctx): '''Returns a bootstrap whose recipe requirements do not conflict with the given recipes.''' info('Trying to find a bootstrap that matches the given recipes.') bootstraps = [cls.get_bootstrap(name, ctx) for name in c...
[ "def", "get_bootstrap_from_recipes", "(", "cls", ",", "recipes", ",", "ctx", ")", ":", "info", "(", "'Trying to find a bootstrap that matches the given recipes.'", ")", "bootstraps", "=", "[", "cls", ".", "get_bootstrap", "(", "name", ",", "ctx", ")", "for", "name...
Returns a bootstrap whose recipe requirements do not conflict with the given recipes.
[ "Returns", "a", "bootstrap", "whose", "recipe", "requirements", "do", "not", "conflict", "with", "the", "given", "recipes", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L153-L191
train
Returns a bootstrap that matches the given recipes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.get_bootstrap
def get_bootstrap(cls, name, ctx): '''Returns an instance of a bootstrap with the given name. This is the only way you should access a bootstrap class, as it sets the bootstrap directory correctly. ''' if name is None: return None if not hasattr(cls, 'bootstr...
python
def get_bootstrap(cls, name, ctx): '''Returns an instance of a bootstrap with the given name. This is the only way you should access a bootstrap class, as it sets the bootstrap directory correctly. ''' if name is None: return None if not hasattr(cls, 'bootstr...
[ "def", "get_bootstrap", "(", "cls", ",", "name", ",", "ctx", ")", ":", "if", "name", "is", "None", ":", "return", "None", "if", "not", "hasattr", "(", "cls", ",", "'bootstraps'", ")", ":", "cls", ".", "bootstraps", "=", "{", "}", "if", "name", "in"...
Returns an instance of a bootstrap with the given name. This is the only way you should access a bootstrap class, as it sets the bootstrap directory correctly.
[ "Returns", "an", "instance", "of", "a", "bootstrap", "with", "the", "given", "name", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L194-L213
train
Returns an instance of a bootstrap with the given name.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.distribute_libs
def distribute_libs(self, arch, src_dirs, wildcard='*', dest_dir="libs"): '''Copy existing arch libs from build dirs to current dist dir.''' info('Copying libs') tgt_dir = join(dest_dir, arch.arch) ensure_dir(tgt_dir) for src_dir in src_dirs: for lib in glob.glob(join...
python
def distribute_libs(self, arch, src_dirs, wildcard='*', dest_dir="libs"): '''Copy existing arch libs from build dirs to current dist dir.''' info('Copying libs') tgt_dir = join(dest_dir, arch.arch) ensure_dir(tgt_dir) for src_dir in src_dirs: for lib in glob.glob(join...
[ "def", "distribute_libs", "(", "self", ",", "arch", ",", "src_dirs", ",", "wildcard", "=", "'*'", ",", "dest_dir", "=", "\"libs\"", ")", ":", "info", "(", "'Copying libs'", ")", "tgt_dir", "=", "join", "(", "dest_dir", ",", "arch", ".", "arch", ")", "e...
Copy existing arch libs from build dirs to current dist dir.
[ "Copy", "existing", "arch", "libs", "from", "build", "dirs", "to", "current", "dist", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L215-L222
train
Copy existing arch libs from build dirs to current dist dir.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.distribute_javaclasses
def distribute_javaclasses(self, javaclass_dir, dest_dir="src"): '''Copy existing javaclasses from build dir to current dist dir.''' info('Copying java files') ensure_dir(dest_dir) for filename in glob.glob(javaclass_dir): shprint(sh.cp, '-a', filename, dest_dir)
python
def distribute_javaclasses(self, javaclass_dir, dest_dir="src"): '''Copy existing javaclasses from build dir to current dist dir.''' info('Copying java files') ensure_dir(dest_dir) for filename in glob.glob(javaclass_dir): shprint(sh.cp, '-a', filename, dest_dir)
[ "def", "distribute_javaclasses", "(", "self", ",", "javaclass_dir", ",", "dest_dir", "=", "\"src\"", ")", ":", "info", "(", "'Copying java files'", ")", "ensure_dir", "(", "dest_dir", ")", "for", "filename", "in", "glob", ".", "glob", "(", "javaclass_dir", ")"...
Copy existing javaclasses from build dir to current dist dir.
[ "Copy", "existing", "javaclasses", "from", "build", "dir", "to", "current", "dist", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L224-L229
train
Copy existing javaclasses from build dir to current dist dir.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap.distribute_aars
def distribute_aars(self, arch): '''Process existing .aar bundles and copy to current dist dir.''' info('Unpacking aars') for aar in glob.glob(join(self.ctx.aars_dir, '*.aar')): self._unpack_aar(aar, arch)
python
def distribute_aars(self, arch): '''Process existing .aar bundles and copy to current dist dir.''' info('Unpacking aars') for aar in glob.glob(join(self.ctx.aars_dir, '*.aar')): self._unpack_aar(aar, arch)
[ "def", "distribute_aars", "(", "self", ",", "arch", ")", ":", "info", "(", "'Unpacking aars'", ")", "for", "aar", "in", "glob", ".", "glob", "(", "join", "(", "self", ".", "ctx", ".", "aars_dir", ",", "'*.aar'", ")", ")", ":", "self", ".", "_unpack_a...
Process existing .aar bundles and copy to current dist dir.
[ "Process", "existing", ".", "aar", "bundles", "and", "copy", "to", "current", "dist", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L231-L235
train
Process existing. aar bundles and copy to current dist dir.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
pythonforandroid/bootstrap.py
Bootstrap._unpack_aar
def _unpack_aar(self, aar, arch): '''Unpack content of .aar bundle and copy to current dist dir.''' with temp_directory() as temp_dir: name = splitext(basename(aar))[0] jar_name = name + '.jar' info("unpack {} aar".format(name)) debug(" from {}".format(aa...
python
def _unpack_aar(self, aar, arch): '''Unpack content of .aar bundle and copy to current dist dir.''' with temp_directory() as temp_dir: name = splitext(basename(aar))[0] jar_name = name + '.jar' info("unpack {} aar".format(name)) debug(" from {}".format(aa...
[ "def", "_unpack_aar", "(", "self", ",", "aar", ",", "arch", ")", ":", "with", "temp_directory", "(", ")", "as", "temp_dir", ":", "name", "=", "splitext", "(", "basename", "(", "aar", ")", ")", "[", "0", "]", "jar_name", "=", "name", "+", "'.jar'", ...
Unpack content of .aar bundle and copy to current dist dir.
[ "Unpack", "content", "of", ".", "aar", "bundle", "and", "copy", "to", "current", "dist", "dir", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/bootstrap.py#L237-L263
train
Unpack content of. aar bundle and copy to current dist dir.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
ci/rebuild_updated_recipes.py
modified_recipes
def modified_recipes(branch='origin/master'): """ Returns a set of modified recipes between the current branch and the one in param. """ # using the contrib version on purpose rather than sh.git, since it comes # with a bunch of fixes, e.g. disabled TTY, see: # https://stackoverflow.com/a/20...
python
def modified_recipes(branch='origin/master'): """ Returns a set of modified recipes between the current branch and the one in param. """ # using the contrib version on purpose rather than sh.git, since it comes # with a bunch of fixes, e.g. disabled TTY, see: # https://stackoverflow.com/a/20...
[ "def", "modified_recipes", "(", "branch", "=", "'origin/master'", ")", ":", "# using the contrib version on purpose rather than sh.git, since it comes", "# with a bunch of fixes, e.g. disabled TTY, see:", "# https://stackoverflow.com/a/20128598/185510", "git_diff", "=", "sh", ".", "con...
Returns a set of modified recipes between the current branch and the one in param.
[ "Returns", "a", "set", "of", "modified", "recipes", "between", "the", "current", "branch", "and", "the", "one", "in", "param", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L34-L48
train
Returns a set of modified recipes between the current branch and the one in param.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
kivy/python-for-android
ci/rebuild_updated_recipes.py
build
def build(target_python, requirements): """ Builds an APK given a target Python and a set of requirements. """ if not requirements: return testapp = 'setup_testapp_python2.py' android_sdk_home = os.environ['ANDROID_SDK_HOME'] android_ndk_home = os.environ['ANDROID_NDK_HOME'] if t...
python
def build(target_python, requirements): """ Builds an APK given a target Python and a set of requirements. """ if not requirements: return testapp = 'setup_testapp_python2.py' android_sdk_home = os.environ['ANDROID_SDK_HOME'] android_ndk_home = os.environ['ANDROID_NDK_HOME'] if t...
[ "def", "build", "(", "target_python", ",", "requirements", ")", ":", "if", "not", "requirements", ":", "return", "testapp", "=", "'setup_testapp_python2.py'", "android_sdk_home", "=", "os", ".", "environ", "[", "'ANDROID_SDK_HOME'", "]", "android_ndk_home", "=", "...
Builds an APK given a target Python and a set of requirements.
[ "Builds", "an", "APK", "given", "a", "target", "Python", "and", "a", "set", "of", "requirements", "." ]
8e0e8056bc22e4d5bd3398a6b0301f38ff167933
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/ci/rebuild_updated_recipes.py#L51-L71
train
Builds an APK given a target Python and a set of requirements.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...