cwe
stringclasses
9 values
func_name
stringclasses
551 values
func_src_before
stringlengths
72
114k
func_src_after
stringclasses
576 values
line_changes
stringclasses
576 values
char_changes
stringclasses
574 values
commit_link
stringclasses
430 values
file_name
stringclasses
411 values
vul_type
stringclasses
9 values
num_tokens
float64
16
28.1k
refactored
bool
2 classes
parsing_score
bool
2 classes
generated
bool
2 classes
cwe-078
test_create_modify_host
def test_create_modify_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
def test_create_modify_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
{'deleted': [{'line_no': 13, 'char_start': 504, 'char_end': 557, 'line': " show_host_cmd = 'showhost -verbose fakehost'\n"}, {'line_no': 16, 'char_start': 635, 'char_end': 690, 'line': " create_host_cmd = ('createhost -add fakehost '\n"}, {'line_no': 17, 'char_start': 690, 'char_end': 752, 'line': " ...
{'deleted': [{'char_start': 661, 'char_end': 662, 'chars': '('}, {'char_start': 728, 'char_end': 744, 'chars': '12345 1234567890'}, {'char_start': 750, 'char_end': 751, 'chars': ')'}], 'added': [{'char_start': 528, 'char_end': 529, 'chars': '['}, {'char_start': 538, 'char_end': 540, 'chars': "',"}, {'char_start': 541, ...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
296
false
true
false
cwe-078
get_lines
def get_lines(command: str) -> List[str]: """ Run a command and return lines of output :param str command: the command to run :returns: list of whitespace-stripped lines output by command """ stdout = get_output(command) return [line.strip().decode() for line in stdout.splitlines()]
def get_lines(command: List[str]) -> List[str]: """ Run a command and return lines of output :param str command: the command to run :returns: list of whitespace-stripped lines output by command """ stdout = get_output(command) return [line.strip() for line in stdout.splitlines()]
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 42, 'line': 'def get_lines(command: str) -> List[str]:\n'}, {'line_no': 9, 'char_start': 246, 'char_end': 312, 'line': ' return [line.strip().decode() for line in stdout.splitlines()]\n'}], 'added': [{'line_no': 1, 'char_start': 0, 'char_end': 48, 'line': 'def...
{'deleted': [{'char_start': 268, 'char_end': 277, 'chars': '().decode'}], 'added': [{'char_start': 23, 'char_end': 28, 'chars': 'List['}, {'char_start': 31, 'char_end': 32, 'chars': ']'}]}
github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76
isort/hooks.py
cwe-078
73
false
true
false
cwe-078
_get_least_used_nsp
def _get_least_used_nsp(self, nspss): """"Return the nsp that has the fewest active vluns.""" # return only the nsp (node:server:port) result = self.common._cli_run('showvlun -a -showcols Port', None) # count the number of nsps (there is 1 for each active vlun) nsp_counts = ...
def _get_least_used_nsp(self, nspss): """"Return the nsp that has the fewest active vluns.""" # return only the nsp (node:server:port) result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port']) # count the number of nsps (there is 1 for each active vlun) nsp_coun...
{'deleted': [{'line_no': 4, 'char_start': 155, 'char_end': 229, 'line': " result = self.common._cli_run('showvlun -a -showcols Port', None)\n"}], 'added': [{'line_no': 4, 'char_start': 155, 'char_end': 234, 'line': " result = self.common._cli_run(['showvlun', '-a', '-showcols', 'Port'])\n"}]}
{'deleted': [{'char_start': 221, 'char_end': 227, 'chars': ', None'}], 'added': [{'char_start': 193, 'char_end': 194, 'chars': '['}, {'char_start': 203, 'char_end': 205, 'chars': "',"}, {'char_start': 206, 'char_end': 207, 'chars': "'"}, {'char_start': 209, 'char_end': 211, 'chars': "',"}, {'char_start': 212, 'char_end...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_iscsi.py
cwe-078
256
false
true
false
cwe-078
verify
def verify(self, data): credentials = self._formatCredentials(data, name='current') command = '{} rclone lsjson current:'.format(credentials) try: result = self._execute(command) return { 'result': True, 'message': 'Success', ...
def verify(self, data): credentials = self._formatCredentials(data, name='current') command = [ 'rclone', 'lsjson', 'current:', ] try: result = self._execute(command, credentials) return { 'result': True, ...
{'deleted': [{'line_no': 3, 'char_start': 96, 'char_end': 162, 'line': " command = '{} rclone lsjson current:'.format(credentials)\n"}, {'line_no': 6, 'char_start': 176, 'char_end': 220, 'line': ' result = self._execute(command)\n'}], 'added': [{'line_no': 3, 'char_start': 96, 'char_end': 116, 'line':...
{'deleted': [{'char_start': 115, 'char_end': 118, 'chars': '{} '}, {'char_start': 141, 'char_end': 161, 'chars': '.format(credentials)'}], 'added': [{'char_start': 114, 'char_end': 123, 'chars': '[\n '}, {'char_start': 124, 'char_end': 129, 'chars': " '"}, {'char_start': 135, 'char_end': 141, 'chars': "',\n ...
github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db
src/backend/api/utils/rclone_connection.py
cwe-078
104
false
true
false
cwe-078
start
def start(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") #subprocess.call("jar -x %s" % target, shell=True) with zipfile.ZipFile(target, 'r') as zip: zip.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying m...
def start(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") #subprocess.call("jar -x %s" % target, shell=True) with zipfile.ZipFile(target, 'r') as zip: zip.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying m...
{'deleted': [{'line_no': 44, 'char_start': 1462, 'char_end': 1539, 'line': ' if subprocess.call("javac -cp tmp/ tmp/%s" % backdoor, shell=True) != 0:\n'}], 'added': [{'line_no': 45, 'char_start': 1540, 'char_end': 1623, 'line': " if subprocess.call(['javac','-cp','tmp/','tmp/%s'%backdoor],shell=False) != 0:\n"}]}
{'deleted': [], 'added': [{'char_start': 1466, 'char_end': 1467, 'chars': '#'}, {'char_start': 1531, 'char_end': 1614, 'chars': "e) != 0:\n if subprocess.call(['javac','-cp','tmp/','tmp/%s'%backdoor],shell=Fals"}]}
github.com/Atticuss/ajar/commit/5ed8aba271ad20e6168f2e3bd6c25ba89b84484f
ajar.py
cwe-078
483
false
true
false
cwe-078
test_create_host
def test_create_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_domain", ...
def test_create_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpfcdriver.hpcommon.HP3PARCommon, "get_domain", ...
{'deleted': [{'line_no': 13, 'char_start': 501, 'char_end': 554, 'line': " show_host_cmd = 'showhost -verbose fakehost'\n"}, {'line_no': 16, 'char_start': 635, 'char_end': 712, 'line': " create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n"}, {'line_no': 17, 'char_start': 712, 'char_en...
{'deleted': [{'char_start': 692, 'char_end': 706, 'chars': " (\\'OpenStack\\"}, {'char_start': 708, 'char_end': 711, 'chars': ") '"}], 'added': [{'char_start': 525, 'char_end': 526, 'chars': '['}, {'char_start': 535, 'char_end': 537, 'chars': "',"}, {'char_start': 538, 'char_end': 539, 'chars': "'"}, {'char_start': 547...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
295
false
true
false
cwe-078
_delete_3par_host
def _delete_3par_host(self, hostname): self._cli_run('removehost %s' % hostname, None)
def _delete_3par_host(self, hostname): self._cli_run(['removehost', hostname])
{'deleted': [{'line_no': 2, 'char_start': 43, 'char_end': 98, 'line': " self._cli_run('removehost %s' % hostname, None)\n"}], 'added': [{'line_no': 2, 'char_start': 43, 'char_end': 90, 'line': " self._cli_run(['removehost', hostname])\n"}]}
{'deleted': [{'char_start': 76, 'char_end': 79, 'chars': ' %s'}, {'char_start': 80, 'char_end': 82, 'chars': ' %'}, {'char_start': 91, 'char_end': 97, 'chars': ', None'}], 'added': [{'char_start': 65, 'char_end': 66, 'chars': '['}, {'char_start': 78, 'char_end': 79, 'chars': ','}, {'char_start': 88, 'char_end': 89, 'ch...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
28
false
true
false
cwe-078
openscript
openscript( char_u *name, int directly) /* when TRUE execute directly */ { if (curscript + 1 == NSCRIPT) { emsg(_(e_nesting)); return; } #ifdef FEAT_EVAL if (ignore_script) /* Not reading from script, also don't open one. Warning message? */ return; #endif if (scriptin[curscript] != N...
openscript( char_u *name, int directly) /* when TRUE execute directly */ { if (curscript + 1 == NSCRIPT) { emsg(_(e_nesting)); return; } // Disallow sourcing a file in the sandbox, the commands would be executed // later, possibly outside of the sandbox. if (check_secure()) return; ...
{'deleted': [], 'added': [{'line_no': 10, 'char_start': 160, 'char_end': 161, 'line': '\n'}, {'line_no': 13, 'char_start': 287, 'char_end': 311, 'line': ' if (check_secure())\n'}, {'line_no': 14, 'char_start': 311, 'char_end': 320, 'line': '\treturn;\n'}, {'line_no': 15, 'char_start': 320, 'char_end': 321, 'line': '...
{'deleted': [], 'added': [{'char_start': 160, 'char_end': 321, 'chars': '\n // Disallow sourcing a file in the sandbox, the commands would be executed\n // later, possibly outside of the sandbox.\n if (check_secure())\n\treturn;\n\n'}]}
github.com/vim/vim/commit/53575521406739cf20bbe4e384d88e7dca11f040
src/getchar.c
cwe-078
498
false
false
false
cwe-078
test_settings_path_skip_issue_909
def test_settings_path_skip_issue_909(tmpdir): base_dir = tmpdir.mkdir('project') config_dir = base_dir.mkdir('conf') config_dir.join('.isort.cfg').write('[isort]\n' 'skip =\n' ' file_to_be_skipped.py\n' ...
def test_settings_path_skip_issue_909(tmpdir): base_dir = tmpdir.mkdir('project') config_dir = base_dir.mkdir('conf') config_dir.join('.isort.cfg').write('[isort]\n' 'skip =\n' ' file_to_be_skipped.py\n' ...
{'deleted': [{'line_no': 24, 'char_start': 1201, 'char_end': 1249, 'line': " check_output(['isort', '--check-only'])\n"}, {'line_no': 25, 'char_start': 1249, 'char_end': 1338, 'line': " results = check_output(['isort', '--check-only', '--settings-path=conf/.isort.cfg'])\n"}, {'line_no': 28, 'char_start': 1377...
{'deleted': [{'char_start': 1209, 'char_end': 1216, 'chars': 'check_o'}, {'char_start': 1217, 'char_end': 1218, 'chars': 't'}, {'char_start': 1220, 'char_end': 1221, 'chars': 't'}, {'char_start': 1259, 'char_end': 1260, 'chars': 's'}, {'char_start': 1264, 'char_end': 1265, 'chars': 'h'}, {'char_start': 1266, 'char_end'...
github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76
test_isort.py
cwe-078
257
false
true
false
cwe-078
IsBlacklistedArg
bool IsBlacklistedArg(const base::CommandLine::CharType* arg) { #if defined(OS_WIN) const auto converted = base::WideToUTF8(arg); const char* a = converted.c_str(); #else const char* a = arg; #endif static const char* prefixes[] = {"--", "-", "/"}; int prefix_length = 0; for (auto& prefix : prefixes) { ...
bool IsBlacklistedArg(const base::CommandLine::CharType* arg) { #if defined(OS_WIN) const auto converted = base::WideToUTF8(arg); const char* a = converted.c_str(); #else const char* a = arg; #endif static const char* prefixes[] = {"--", "-", "/"}; int prefix_length = 0; for (auto& prefix : prefixes) { ...
{'deleted': [{'line_no': 21, 'char_start': 500, 'char_end': 549, 'line': ' std::string switch_name(a, strcspn(a, "="));\n'}], 'added': [{'line_no': 21, 'char_start': 500, 'char_end': 530, 'line': ' std::string switch_name =\n'}, {'line_no': 22, 'char_start': 530, 'char_end': 597, 'line': ' base::ToLowerASC...
{'deleted': [], 'added': [{'char_start': 527, 'char_end': 574, 'chars': ' =\n base::ToLowerASCII(base::StringPiece'}, {'char_start': 592, 'char_end': 593, 'chars': ')'}]}
github.com/electron/electron/commit/ce361a12e355f9e1e99c989f1ea056c9e502dbe7
atom/app/command_line_args.cc
cwe-078
214
false
true
false
cwe-078
mkdir
def mkdir(self, data, path): credentials = self._formatCredentials(data, name='current') command = ( '{credentials} ' 'rclone touch current:{path}/.keep' ).format( credentials=credentials, path=path, ) try: result ...
def mkdir(self, data, path): credentials = self._formatCredentials(data, name='current') command = [ 'rclone', 'touch', 'current:{}/.keep'.format(path), ] try: result = self._execute(command, credentials) return { ...
{'deleted': [{'line_no': 3, 'char_start': 101, 'char_end': 102, 'line': '\n'}, {'line_no': 4, 'char_start': 102, 'char_end': 122, 'line': ' command = (\n'}, {'line_no': 5, 'char_start': 122, 'char_end': 151, 'line': " '{credentials} '\n"}, {'line_no': 6, 'char_start': 151, 'char_end': 199, 'line': " ...
{'deleted': [{'char_start': 101, 'char_end': 102, 'chars': '\n'}, {'char_start': 120, 'char_end': 121, 'chars': '('}, {'char_start': 135, 'char_end': 137, 'chars': '{c'}, {'char_start': 138, 'char_end': 145, 'chars': 'edentia'}, {'char_start': 146, 'char_end': 149, 'chars': 's} '}, {'char_start': 164, 'char_end': 171, ...
github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db
src/backend/api/utils/rclone_connection.py
cwe-078
101
false
true
false
cwe-078
fetch
def fetch(url): '''Download and verify a package url.''' base = os.path.basename(url) print('Fetching %s...' % base) fetch_file(url + '.asc') fetch_file(url) fetch_file(url + '.sha256') fetch_file(url + '.asc.sha256') print('Verifying %s...' % base) # TODO: check for verification failure. os.system(...
def fetch(url): '''Download and verify a package url.''' base = os.path.basename(url) print('Fetching %s...' % base) fetch_file(url + '.asc') fetch_file(url) fetch_file(url + '.sha256') fetch_file(url + '.asc.sha256') print('Verifying %s...' % base) # TODO: check for verification failure. subprocess...
{'deleted': [{'line_no': 11, 'char_start': 308, 'char_end': 350, 'line': " os.system('shasum -c %s.sha256' % base)\n"}, {'line_no': 12, 'char_start': 350, 'char_end': 396, 'line': " os.system('shasum -c %s.asc.sha256' % base)\n"}, {'line_no': 13, 'char_start': 396, 'char_end': 449, 'line': " os.system('gpg --verify ...
{'deleted': [{'char_start': 312, 'char_end': 313, 'chars': '.'}, {'char_start': 314, 'char_end': 317, 'chars': 'yst'}, {'char_start': 318, 'char_end': 319, 'chars': 'm'}, {'char_start': 331, 'char_end': 332, 'chars': '%'}, {'char_start': 341, 'char_end': 348, 'chars': ' % base'}, {'char_start': 353, 'char_end': 355, 'c...
github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb
repack_rust.py
cwe-078
160
false
true
false
cwe-078
test_initialize_connection
def test_initialize_connection(self): self.driver._eql_execute = self.mox.\ CreateMock(self.driver._eql_execute) volume = {'name': self.volume_name} self.stubs.Set(self.driver, "_get_iscsi_properties", self._fake_get_iscsi_properties) self.driver._e...
def test_initialize_connection(self): self.driver._eql_execute = self.mox.\ CreateMock(self.driver._eql_execute) volume = {'name': self.volume_name} self.stubs.Set(self.driver, "_get_iscsi_properties", self._fake_get_iscsi_properties) self.driver._e...
{'deleted': [{'line_no': 10, 'char_start': 495, 'char_end': 547, 'line': " 'authmethod chap',\n"}], 'added': [{'line_no': 10, 'char_start': 495, 'char_end': 550, 'line': " 'authmethod', 'chap',\n"}]}
{'deleted': [], 'added': [{'char_start': 539, 'char_end': 541, 'chars': "',"}, {'char_start': 542, 'char_end': 543, 'chars': "'"}]}
github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e
cinder/tests/test_eqlx.py
cwe-078
163
false
true
false
cwe-078
extend_volume
def extend_volume(self, volume, new_size): LOG.debug(_('enter: extend_volume: volume %s') % volume['id']) ret = self._ensure_vdisk_no_fc_mappings(volume['name'], allow_snaps=False) if not ret: exception_message = (_('extend_volume: ...
def extend_volume(self, volume, new_size): LOG.debug(_('enter: extend_volume: volume %s') % volume['id']) ret = self._ensure_vdisk_no_fc_mappings(volume['name'], allow_snaps=False) if not ret: exception_message = (_('extend_volume: ...
{'deleted': [{'line_no': 11, 'char_start': 544, 'char_end': 621, 'line': " ssh_cmd = ('svctask expandvdisksize -size %(amt)d -unit gb %(name)s'\n"}, {'line_no': 12, 'char_start': 621, 'char_end': 687, 'line': " % {'amt': extend_amt, 'name': volume['name']})\n"}], 'added': [{'line_no': 11, 'char...
{'deleted': [{'char_start': 594, 'char_end': 595, 'chars': '%'}, {'char_start': 596, 'char_end': 598, 'chars': 'am'}, {'char_start': 599, 'char_end': 600, 'chars': ')'}, {'char_start': 601, 'char_end': 614, 'chars': ' -unit gb %(n'}, {'char_start': 616, 'char_end': 617, 'chars': 'e'}, {'char_start': 618, 'char_end': 62...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
214
false
true
false
cwe-078
add_extra_args
def add_extra_args(self, args=None): """Add more args depending on how known args are set.""" parsed = vars(self.parse_known_args(nohelp=True)[0]) # find which image mode specified if any, and add additional arguments image_mode = parsed.get('image_mode', None) if image_mode...
def add_extra_args(self, args=None): """Add more args depending on how known args are set.""" parsed = vars(self.parse_known_args(args, nohelp=True)[0]) # find which image mode specified if any, and add additional arguments image_mode = parsed.get('image_mode', None) if imag...
{'deleted': [{'line_no': 3, 'char_start': 106, 'char_end': 167, 'line': ' parsed = vars(self.parse_known_args(nohelp=True)[0])\n'}], 'added': [{'line_no': 3, 'char_start': 106, 'char_end': 173, 'line': ' parsed = vars(self.parse_known_args(args, nohelp=True)[0])\n'}]}
{'deleted': [], 'added': [{'char_start': 150, 'char_end': 156, 'chars': 'args, '}]}
github.com/freedombenLiu/ParlAI/commit/601668d569e1276e0b8bf2bf8fb43e391e10d170
parlai/core/params.py
cwe-078
244
false
true
false
cwe-078
_get_fc_wwpns
def _get_fc_wwpns(self): for key in self._storage_nodes: node = self._storage_nodes[key] ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id'] raw = self._run_ssh(ssh_cmd) resp = CLIResponse(raw, delim='!', with_header=False) wwpns = set(node['WWPN']...
def _get_fc_wwpns(self): for key in self._storage_nodes: node = self._storage_nodes[key] ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!', node['id']] raw = self._run_ssh(ssh_cmd) resp = CLIResponse(raw, delim='!', with_header=False) wwpns = set(node[...
{'deleted': [{'line_no': 4, 'char_start': 113, 'char_end': 177, 'line': " ssh_cmd = 'svcinfo lsnode -delim ! %s' % node['id']\n"}], 'added': [{'line_no': 4, 'char_start': 113, 'char_end': 184, 'line': " ssh_cmd = ['svcinfo', 'lsnode', '-delim', '!', node['id']]\n"}]}
{'deleted': [{'char_start': 159, 'char_end': 162, 'chars': ' %s'}, {'char_start': 163, 'char_end': 165, 'chars': ' %'}], 'added': [{'char_start': 135, 'char_end': 136, 'chars': '['}, {'char_start': 144, 'char_end': 146, 'chars': "',"}, {'char_start': 147, 'char_end': 148, 'chars': "'"}, {'char_start': 154, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
167
false
true
false
cwe-078
_remove_volume_from_volume_set
def _remove_volume_from_volume_set(self, volume_name, vvs_name): self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)
def _remove_volume_from_volume_set(self, volume_name, vvs_name): self._cli_run(['removevvset', '-f', vvs_name, volume_name])
{'deleted': [{'line_no': 2, 'char_start': 69, 'char_end': 146, 'line': " self._cli_run('removevvset -f %s %s' % (vvs_name, volume_name), None)\n"}], 'added': [{'line_no': 2, 'char_start': 69, 'char_end': 136, 'line': " self._cli_run(['removevvset', '-f', vvs_name, volume_name])\n"}]}
{'deleted': [{'char_start': 106, 'char_end': 112, 'chars': ' %s %s'}, {'char_start': 113, 'char_end': 115, 'chars': ' %'}, {'char_start': 116, 'char_end': 117, 'chars': '('}, {'char_start': 138, 'char_end': 145, 'chars': '), None'}], 'added': [{'char_start': 91, 'char_end': 92, 'chars': '['}, {'char_start': 104, 'char_...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
44
false
true
false
cwe-078
get_logs
@app.route('/api/uploads/<sid>/logs') def get_logs(sid): if '/' not in sid: path = os.path.join(app.config['UPLOAD_FOLDER'], sid) if os.path.isfile(os.path.join(path, app.config['LOG_FILE'])): return send_from_directory(directory=path, filename=app...
@app.route('/api/uploads/<sid>/logs') def get_logs(sid): if utils.sid_is_valid(sid): path = join(app.config['UPLOAD_FOLDER'], sid) if os.path.isfile(join(path, app.config['LOG_FILE'])): return send_from_directory(directory=path, filename=app.confi...
{'deleted': [{'line_no': 3, 'char_start': 57, 'char_end': 80, 'line': " if '/' not in sid:\n"}, {'line_no': 4, 'char_start': 80, 'char_end': 142, 'line': " path = os.path.join(app.config['UPLOAD_FOLDER'], sid)\n"}, {'line_no': 5, 'char_start': 142, 'char_end': 213, 'line': " if os.path.isfile(os.path.j...
{'deleted': [{'char_start': 64, 'char_end': 70, 'chars': "'/' no"}, {'char_start': 71, 'char_end': 72, 'chars': ' '}, {'char_start': 73, 'char_end': 75, 'chars': 'n '}, {'char_start': 95, 'char_end': 103, 'chars': 'os.path.'}, {'char_start': 168, 'char_end': 176, 'chars': 'os.path.'}, {'char_start': 404, 'char_end': 40...
github.com/cheukyin699/genset-demo-site/commit/abb55b1a6786b0a995c2cdf77a7977a1d51cfc0d
app/views.py
cwe-078
90
false
true
false
cwe-078
_get_hostvdisk_mappings
def _get_hostvdisk_mappings(self, host_name): """Return the defined storage mappings for a host.""" return_data = {} ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name out, err = self._run_ssh(ssh_cmd) mappings = out.strip().split('\n') if len(mappings): ...
def _get_hostvdisk_mappings(self, host_name): """Return the defined storage mappings for a host.""" return_data = {} ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host_name] out, err = self._run_ssh(ssh_cmd) mappings = out.strip().split('\n') if len(mapping...
{'deleted': [{'line_no': 5, 'char_start': 138, 'char_end': 205, 'line': " ssh_cmd = 'svcinfo lshostvdiskmap -delim ! %s' % host_name\n"}], 'added': [{'line_no': 5, 'char_start': 138, 'char_end': 212, 'line': " ssh_cmd = ['svcinfo', 'lshostvdiskmap', '-delim', '!', host_name]\n"}]}
{'deleted': [{'char_start': 188, 'char_end': 191, 'chars': ' %s'}, {'char_start': 192, 'char_end': 194, 'chars': ' %'}], 'added': [{'char_start': 156, 'char_end': 157, 'chars': '['}, {'char_start': 165, 'char_end': 167, 'chars': "',"}, {'char_start': 168, 'char_end': 169, 'chars': "'"}, {'char_start': 183, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
132
false
true
false
cwe-078
initialize_connection
def initialize_connection(self, volume, connector): """Restrict access to a volume.""" try: cmd = ['volume', 'select', volume['name'], 'access', 'create', 'initiator', connector['initiator']] if self.configuration.eqlx_use_chap: cmd.extend([...
def initialize_connection(self, volume, connector): """Restrict access to a volume.""" try: cmd = ['volume', 'select', volume['name'], 'access', 'create', 'initiator', connector['initiator']] if self.configuration.eqlx_use_chap: cmd.extend([...
{'deleted': [{'line_no': 7, 'char_start': 292, 'char_end': 351, 'line': " cmd.extend(['authmethod chap', 'username',\n"}], 'added': [{'line_no': 7, 'char_start': 292, 'char_end': 354, 'line': " cmd.extend(['authmethod', 'chap', 'username',\n"}]}
{'deleted': [], 'added': [{'char_start': 331, 'char_end': 333, 'chars': "',"}, {'char_start': 334, 'char_end': 335, 'chars': "'"}]}
github.com/thatsdone/cinder/commit/9e858bebb89de05b1c9ecc27f5bd9fbff95a728e
cinder/volume/drivers/eqlx.py
cwe-078
160
false
true
false
cwe-078
test_create_invalid_host
def test_create_invalid_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
def test_create_invalid_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
{'deleted': [{'line_no': 13, 'char_start': 505, 'char_end': 558, 'line': " show_host_cmd = 'showhost -verbose fakehost'\n"}, {'line_no': 16, 'char_start': 639, 'char_end': 706, 'line': " create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n"}, {'line_no': 17, 'char_start': 706, 'char_end': 753, 'li...
{'deleted': [{'char_start': 703, 'char_end': 704, 'chars': ' '}, {'char_start': 733, 'char_end': 734, 'chars': "'"}, {'char_start': 735, 'char_end': 736, 'chars': '\\'}, {'char_start': 746, 'char_end': 747, 'chars': '\\'}, {'char_start': 780, 'char_end': 789, 'chars': "'fakehost"}], 'added': [{'char_start': 529, 'char_...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
324
false
true
false
cwe-078
_get_3par_hostname_from_wwn_iqn
def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn): out = self._cli_run('showhost -d', None) # wwns_iqn may be a list of strings or a single # string. So, if necessary, create a list to loop. if not isinstance(wwns_iqn, list): wwn_iqn_list = [wwns_iqn] else: ...
def _get_3par_hostname_from_wwn_iqn(self, wwns_iqn): out = self._cli_run(['showhost', '-d']) # wwns_iqn may be a list of strings or a single # string. So, if necessary, create a list to loop. if not isinstance(wwns_iqn, list): wwn_iqn_list = [wwns_iqn] else: ...
{'deleted': [{'line_no': 2, 'char_start': 57, 'char_end': 106, 'line': " out = self._cli_run('showhost -d', None)\n"}], 'added': [{'line_no': 2, 'char_start': 57, 'char_end': 105, 'line': " out = self._cli_run(['showhost', '-d'])\n"}]}
{'deleted': [{'char_start': 98, 'char_end': 104, 'chars': ', None'}], 'added': [{'char_start': 85, 'char_end': 86, 'chars': '['}, {'char_start': 95, 'char_end': 97, 'chars': "',"}, {'char_start': 98, 'char_end': 99, 'chars': "'"}, {'char_start': 102, 'char_end': 103, 'chars': ']'}]}
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
152
false
true
false
cwe-078
take_bug_report
def take_bug_report(self, test_name, begin_time): """Takes a bug report on the device and stores it in a file. Args: test_name: Name of the test case that triggered this bug report. begin_time: Logline format timestamp taken when the test started. """ new_br ...
def take_bug_report(self, test_name, begin_time): """Takes a bug report on the device and stores it in a file. Args: test_name: Name of the test case that triggered this bug report. begin_time: Logline format timestamp taken when the test started. """ new_br ...
{'deleted': [{'line_no': 33, 'char_start': 1526, 'char_end': 1592, 'line': " self.adb.pull('%s %s' % (br_out_path, full_out_path))\n"}, {'line_no': 35, 'char_start': 1606, 'char_end': 1662, 'line': " self.adb.bugreport(' > %s' % full_out_path)\n"}], 'added': [{'line_no': 33, 'char_start': 1526, 'c...
{'deleted': [{'char_start': 1552, 'char_end': 1563, 'chars': "'%s %s' % ("}, {'char_start': 1589, 'char_end': 1590, 'chars': ')'}], 'added': [{'char_start': 1552, 'char_end': 1553, 'chars': '['}, {'char_start': 1579, 'char_end': 1580, 'chars': ']'}, {'char_start': 1608, 'char_end': 1725, 'chars': '# shell=True as this ...
github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee
mobly/controllers/android_device.py
cwe-078
416
false
true
false
cwe-078
terminate_connection
def terminate_connection(self, volume, connector, **kwargs): """Cleanup after an iSCSI connection has been terminated. When we clean up a terminated connection between a given connector and volume, we: 1. Translate the given connector to a host name 2. Remove the volume-to-h...
def terminate_connection(self, volume, connector, **kwargs): """Cleanup after an iSCSI connection has been terminated. When we clean up a terminated connection between a given connector and volume, we: 1. Translate the given connector to a host name 2. Remove the volume-to-h...
{'deleted': [{'line_no': 27, 'char_start': 1277, 'char_end': 1340, 'line': " ssh_cmd = 'svctask rmvdiskhostmap -host %s %s' % \\\n"}, {'line_no': 28, 'char_start': 1340, 'char_end': 1378, 'line': ' (host_name, vol_name)\n'}], 'added': [{'line_no': 27, 'char_start': 1277, 'char_end': 1349, 'lin...
{'deleted': [{'char_start': 1329, 'char_end': 1330, 'chars': '%'}, {'char_start': 1332, 'char_end': 1340, 'chars': "%s' % \\\n"}, {'char_start': 1356, 'char_end': 1367, 'chars': '(host_name,'}, {'char_start': 1376, 'char_end': 1377, 'chars': ')'}], 'added': [{'char_start': 1299, 'char_end': 1300, 'chars': '['}, {'char_...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
462
false
true
false
cwe-078
_update_volume_stats
def _update_volume_stats(self): """Retrieve stats info from volume group.""" LOG.debug(_("Updating volume stats")) data = {} data['vendor_name'] = 'IBM' data['driver_version'] = '1.1' data['storage_protocol'] = list(self._enabled_protocols) data['total_capa...
def _update_volume_stats(self): """Retrieve stats info from volume group.""" LOG.debug(_("Updating volume stats")) data = {} data['vendor_name'] = 'IBM' data['driver_version'] = '1.1' data['storage_protocol'] = list(self._enabled_protocols) data['total_capa...
{'deleted': [{'line_no': 18, 'char_start': 584, 'char_end': 630, 'line': " ssh_cmd = 'svcinfo lssystem -delim !'\n"}, {'line_no': 30, 'char_start': 1179, 'char_end': 1244, 'line': " ssh_cmd = 'svcinfo lsmdiskgrp -bytes -delim ! %s' % pool\n"}], 'added': [{'line_no': 18, 'char_start': 584, 'char_end': 641,...
{'deleted': [{'char_start': 1232, 'char_end': 1235, 'chars': ' %s'}, {'char_start': 1236, 'char_end': 1238, 'chars': ' %'}], 'added': [{'char_start': 602, 'char_end': 603, 'chars': '['}, {'char_start': 611, 'char_end': 613, 'chars': "',"}, {'char_start': 614, 'char_end': 615, 'chars': "'"}, {'char_start': 623, 'char_en...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
432
false
true
false
cwe-078
_find_host_exhaustive
def _find_host_exhaustive(self, connector, hosts): for host in hosts: ssh_cmd = 'svcinfo lshost -delim ! %s' % host out, err = self._run_ssh(ssh_cmd) self._assert_ssh_return(len(out.strip()), '_find_host_exhaustive', ...
def _find_host_exhaustive(self, connector, hosts): for host in hosts: ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host] out, err = self._run_ssh(ssh_cmd) self._assert_ssh_return(len(out.strip()), '_find_host_exhaustive', ...
{'deleted': [{'line_no': 3, 'char_start': 82, 'char_end': 140, 'line': " ssh_cmd = 'svcinfo lshost -delim ! %s' % host\n"}], 'added': [{'line_no': 3, 'char_start': 82, 'char_end': 147, 'line': " ssh_cmd = ['svcinfo', 'lshost', '-delim', '!', host]\n"}]}
{'deleted': [{'char_start': 128, 'char_end': 131, 'chars': ' %s'}, {'char_start': 132, 'char_end': 134, 'chars': ' %'}], 'added': [{'char_start': 104, 'char_end': 105, 'chars': '['}, {'char_start': 113, 'char_end': 115, 'chars': "',"}, {'char_start': 116, 'char_end': 117, 'chars': "'"}, {'char_start': 123, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
205
false
true
false
cwe-078
_remove_volume_set
def _remove_volume_set(self, vvs_name): # Must first clear the QoS rules before removing the volume set self._cli_run('setqos -clear vvset:%s' % (vvs_name), None) self._cli_run('removevvset -f %s' % (vvs_name), None)
def _remove_volume_set(self, vvs_name): # Must first clear the QoS rules before removing the volume set self._cli_run(['setqos', '-clear', 'vvset:%s' % (vvs_name)]) self._cli_run(['removevvset', '-f', vvs_name])
{'deleted': [{'line_no': 3, 'char_start': 116, 'char_end': 183, 'line': " self._cli_run('setqos -clear vvset:%s' % (vvs_name), None)\n"}, {'line_no': 4, 'char_start': 183, 'char_end': 244, 'line': " self._cli_run('removevvset -f %s' % (vvs_name), None)\n"}], 'added': [{'line_no': 3, 'char_start': 116, 'ch...
{'deleted': [{'char_start': 175, 'char_end': 181, 'chars': ', None'}, {'char_start': 220, 'char_end': 223, 'chars': ' %s'}, {'char_start': 224, 'char_end': 226, 'chars': ' %'}, {'char_start': 227, 'char_end': 228, 'chars': '('}, {'char_start': 236, 'char_end': 243, 'chars': '), None'}], 'added': [{'char_start': 138, 'c...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
72
false
true
false
cwe-078
initHeader
def initHeader(self): """Initialize the IP header according to the IP format definition. """ # Ethernet header # Retrieve remote MAC address dstMacAddr = arpreq.arpreq(self.remoteIP) if dstMacAddr is not None: dstMacAddr = dstMacAddr.replace(':', '') ...
def initHeader(self): """Initialize the IP header according to the IP format definition. """ # Ethernet header # Retrieve remote MAC address dstMacAddr = arpreq.arpreq(self.remoteIP) if dstMacAddr is not None: dstMacAddr = dstMacAddr.replace(':', '') ...
{'deleted': [{'line_no': 15, 'char_start': 423, 'char_end': 505, 'line': ' p = subprocess.Popen("ping -c1 {}".format(self.remoteIP), shell=True)\n'}], 'added': [{'line_no': 15, 'char_start': 423, 'char_end': 493, 'line': ' p = subprocess.Popen(["/bin/ping", "-c1", self.remoteIP])\n'}]}
{'deleted': [{'char_start': 465, 'char_end': 468, 'chars': ' {}'}, {'char_start': 469, 'char_end': 477, 'chars': '.format('}, {'char_start': 490, 'char_end': 503, 'chars': '), shell=True'}], 'added': [{'char_start': 456, 'char_end': 457, 'chars': '['}, {'char_start': 458, 'char_end': 463, 'chars': '/bin/'}, {'char_star...
github.com/netzob/netzob/commit/557abf64867d715497979b029efedbd2777b912e
src/netzob/Simulator/Channels/RawEthernetClient.py
cwe-078
1,073
false
true
false
cwe-078
_formatCredentials
def _formatCredentials(self, data, name): """ Credentials are of the form RCLONE_CONFIG_CURRENT_TYPE=s3 ^ ^ ^ ^ [mandatory ][name ][key][value] """ prefix = "RCLONE_CONFIG_{}".format(name.upper()) credentials = '' cred...
def _formatCredentials(self, data, name): """ Credentials are of the form RCLONE_CONFIG_CURRENT_TYPE=s3 ^ ^ ^ ^ [mandatory ][name ][key][value] """ prefix = "RCLONE_CONFIG_{}".format(name.upper()) credentials = {} cred...
{'deleted': [{'line_no': 11, 'char_start': 283, 'char_end': 308, 'line': " credentials = ''\n"}, {'line_no': 12, 'char_start': 308, 'char_end': 373, 'line': ' credentials += "{}_TYPE=\'{}\' ".format(prefix, data.type)\n'}, {'line_no': 17, 'char_start': 518, 'char_end': 583, 'line': ' creden...
{'deleted': [{'char_start': 305, 'char_end': 307, 'chars': "''"}, {'char_start': 327, 'char_end': 332, 'chars': ' += "'}, {'char_start': 339, 'char_end': 340, 'chars': '='}, {'char_start': 341, 'char_end': 346, 'chars': '{}\' "'}, {'char_start': 360, 'char_end': 361, 'chars': ','}, {'char_start': 371, 'char_end': 372, ...
github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db
src/backend/api/utils/rclone_connection.py
cwe-078
599
false
true
false
cwe-078
get_ports
def get_ports(self): # First get the active FC ports out = self._cli_run('showport', None) # strip out header # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type, # Protocol,Label,Partner,FailoverState out = out[1:len(out) - 2] ports = {'FC': [], 'iS...
def get_ports(self): # First get the active FC ports out = self._cli_run(['showport']) # strip out header # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type, # Protocol,Label,Partner,FailoverState out = out[1:len(out) - 2] ports = {'FC': [], 'iSCSI'...
{'deleted': [{'line_no': 3, 'char_start': 65, 'char_end': 111, 'line': " out = self._cli_run('showport', None)\n"}, {'line_no': 20, 'char_start': 603, 'char_end': 656, 'line': " out = self._cli_run('showport -iscsi', None)\n"}, {'line_no': 34, 'char_start': 1031, 'char_end': 1091, 'line': " result ...
{'deleted': [{'char_start': 103, 'char_end': 109, 'chars': ', None'}, {'char_start': 648, 'char_end': 654, 'chars': ', None'}, {'char_start': 1083, 'char_end': 1089, 'chars': ', None'}], 'added': [{'char_start': 93, 'char_end': 94, 'chars': '['}, {'char_start': 104, 'char_end': 105, 'chars': ']'}, {'char_start': 627, '...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
450
false
true
false
cwe-078
_modify_3par_fibrechan_host
def _modify_3par_fibrechan_host(self, hostname, wwn): # when using -add, you can not send the persona or domain options out = self.common._cli_run('createhost -add %s %s' % (hostname, " ".join(wwn)), None)
def _modify_3par_fibrechan_host(self, hostname, wwns): # when using -add, you can not send the persona or domain options command = ['createhost', '-add', hostname] for wwn in wwns: command.append(wwn) out = self.common._cli_run(command)
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 58, 'line': ' def _modify_3par_fibrechan_host(self, hostname, wwn):\n'}, {'line_no': 3, 'char_start': 132, 'char_end': 191, 'line': " out = self.common._cli_run('createhost -add %s %s'\n"}, {'line_no': 4, 'char_start': 191, 'char_end': 260, 'line': ' ...
{'deleted': [{'char_start': 58, 'char_end': 58, 'chars': ''}, {'char_start': 140, 'char_end': 151, 'chars': 'out = self.'}, {'char_start': 155, 'char_end': 156, 'chars': 'o'}, {'char_start': 157, 'char_end': 167, 'chars': '._cli_run('}, {'char_start': 184, 'char_end': 188, 'chars': '%s %'}, {'char_start': 189, 'char_en...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_fc.py
cwe-078
67
false
true
false
cwe-078
_modify_3par_iscsi_host
def _modify_3par_iscsi_host(self, hostname, iscsi_iqn): # when using -add, you can not send the persona or domain options self.common._cli_run('createhost -iscsi -add %s %s' % (hostname, iscsi_iqn), None)
def _modify_3par_iscsi_host(self, hostname, iscsi_iqn): # when using -add, you can not send the persona or domain options command = ['createhost', '-iscsi', '-add', hostname, iscsi_iqn] self.common._cli_run(command)
{'deleted': [{'line_no': 3, 'char_start': 134, 'char_end': 194, 'line': " self.common._cli_run('createhost -iscsi -add %s %s'\n"}, {'line_no': 4, 'char_start': 194, 'char_end': 253, 'line': ' % (hostname, iscsi_iqn), None)\n'}], 'added': [{'line_no': 3, 'char_start': 134, 'char_end': ...
{'deleted': [{'char_start': 142, 'char_end': 147, 'chars': 'self.'}, {'char_start': 151, 'char_end': 152, 'chars': 'o'}, {'char_start': 153, 'char_end': 163, 'chars': '._cli_run('}, {'char_start': 186, 'char_end': 192, 'chars': ' %s %s'}, {'char_start': 193, 'char_end': 222, 'chars': '\n '}, ...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_iscsi.py
cwe-078
68
false
true
false
cwe-078
handle_message
def handle_message(self, ch, method, properties, body): """ this is a pika.basic_consumer callback handles client inputs, runs appropriate workflows and views Args: ch: amqp channel method: amqp method properties: body: message body ...
def handle_message(self, ch, method, properties, body): """ this is a pika.basic_consumer callback handles client inputs, runs appropriate workflows and views Args: ch: amqp channel method: amqp method properties: body: message body ...
{'deleted': [{'line_no': 28, 'char_start': 867, 'char_end': 929, 'line': " headers = {'remote_ip': input['_zops_remote_ip']}\n"}], 'added': [{'line_no': 13, 'char_start': 349, 'char_end': 370, 'line': ' headers = {}\n'}, {'line_no': 29, 'char_start': 889, 'char_end': 951, 'line': " headers ...
{'deleted': [], 'added': [{'char_start': 357, 'char_end': 378, 'chars': 'headers = {}\n '}, {'char_start': 597, 'char_end': 598, 'chars': ' '}, {'char_start': 947, 'char_end': 1003, 'chars': "'],\n 'source': input['_zops_source"}]}
github.com/zetaops/zengine/commit/52eafbee90f8ddf78be0c7452828d49423246851
zengine/wf_daemon.py
cwe-078
453
false
true
false
cwe-078
_call_prepare_fc_map
def _call_prepare_fc_map(self, fc_map_id, source, target): try: out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id) except exception.ProcessExecutionError as e: with excutils.save_and_reraise_exception(): LOG.error(_('_prepare_fc_map: Failed to pr...
def _call_prepare_fc_map(self, fc_map_id, source, target): try: out, err = self._run_ssh(['svctask', 'prestartfcmap', fc_map_id]) except exception.ProcessExecutionError as e: with excutils.save_and_reraise_exception(): LOG.error(_('_prepare_fc_map: Failed to p...
{'deleted': [{'line_no': 3, 'char_start': 76, 'char_end': 153, 'line': " out, err = self._run_ssh('svctask prestartfcmap %s' % fc_map_id)\n"}], 'added': [{'line_no': 3, 'char_start': 76, 'char_end': 154, 'line': " out, err = self._run_ssh(['svctask', 'prestartfcmap', fc_map_id])\n"}]}
{'deleted': [{'char_start': 135, 'char_end': 138, 'chars': ' %s'}, {'char_start': 139, 'char_end': 141, 'chars': ' %'}], 'added': [{'char_start': 113, 'char_end': 114, 'chars': '['}, {'char_start': 122, 'char_end': 124, 'chars': "',"}, {'char_start': 125, 'char_end': 126, 'chars': "'"}, {'char_start': 140, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
134
false
true
false
cwe-078
test_get_least_used_nsp
def test_get_least_used_nsp(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_vlun_cmd = 'showvlun -a -...
def test_get_least_used_nsp(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_vlun_cmd = ['showvlun', '...
{'deleted': [{'line_no': 9, 'char_start': 282, 'char_end': 335, 'line': " show_vlun_cmd = 'showvlun -a -showcols Port'\n"}], 'added': [{'line_no': 9, 'char_start': 282, 'char_end': 346, 'line': " show_vlun_cmd = ['showvlun', '-a', '-showcols', 'Port']\n"}]}
{'deleted': [], 'added': [{'char_start': 306, 'char_end': 307, 'chars': '['}, {'char_start': 316, 'char_end': 318, 'chars': "',"}, {'char_start': 319, 'char_end': 320, 'chars': "'"}, {'char_start': 322, 'char_end': 324, 'chars': "',"}, {'char_start': 325, 'char_end': 326, 'chars': "'"}, {'char_start': 335, 'char_end': ...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
336
false
true
false
cwe-078
_get_host_from_connector
def _get_host_from_connector(self, connector): """List the hosts defined in the storage. Return the host name with the given connection info, or None if there is no host fitting that information. """ prefix = self._connector_to_hostname_prefix(connector) LOG.debug(...
def _get_host_from_connector(self, connector): """List the hosts defined in the storage. Return the host name with the given connection info, or None if there is no host fitting that information. """ prefix = self._connector_to_hostname_prefix(connector) LOG.debug(...
{'deleted': [{'line_no': 13, 'char_start': 421, 'char_end': 465, 'line': " ssh_cmd = 'svcinfo lshost -delim !'\n"}], 'added': [{'line_no': 13, 'char_start': 421, 'char_end': 476, 'line': " ssh_cmd = ['svcinfo', 'lshost', '-delim', '!']\n"}]}
{'deleted': [], 'added': [{'char_start': 439, 'char_end': 440, 'chars': '['}, {'char_start': 448, 'char_end': 450, 'chars': "',"}, {'char_start': 451, 'char_end': 452, 'chars': "'"}, {'char_start': 458, 'char_end': 460, 'chars': "',"}, {'char_start': 461, 'char_end': 462, 'chars': "'"}, {'char_start': 468, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
331
false
true
false
cwe-078
get_output
def get_output(command: str) -> bytes: """ Run a command and return raw output :param str command: the command to run :returns: the stdout output of the command """ return subprocess.check_output(command.split())
def get_output(command: List[str]) -> str: """ Run a command and return raw output :param str command: the command to run :returns: the stdout output of the command """ result = subprocess.run(command, stdout=subprocess.PIPE, check=True) return result.stdout.decode()
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 39, 'line': 'def get_output(command: str) -> bytes:\n'}, {'line_no': 8, 'char_start': 186, 'char_end': 237, 'line': ' return subprocess.check_output(command.split())\n'}], 'added': [{'line_no': 1, 'char_start': 0, 'char_end': 43, 'line': 'def get_output(comman...
{'deleted': [{'char_start': 32, 'char_end': 36, 'chars': 'byte'}, {'char_start': 213, 'char_end': 215, 'chars': '_o'}, {'char_start': 217, 'char_end': 218, 'chars': 'p'}, {'char_start': 220, 'char_end': 221, 'chars': '('}, {'char_start': 223, 'char_end': 227, 'chars': 'mman'}, {'char_start': 228, 'char_end': 234, 'char...
github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76
isort/hooks.py
cwe-078
53
false
true
false
cwe-078
test_create_invalid_host
def test_create_invalid_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
def test_create_invalid_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", ...
{'deleted': [{'line_no': 13, 'char_start': 505, 'char_end': 558, 'line': " show_host_cmd = 'showhost -verbose fakehost'\n"}, {'line_no': 16, 'char_start': 639, 'char_end': 716, 'line': " create_host_cmd = ('createhost -persona 1 -domain (\\'OpenStack\\',) '\n"}, {'line_no': 17, 'char_start': 716, 'char_en...
{'deleted': [{'char_start': 696, 'char_end': 710, 'chars': " (\\'OpenStack\\"}, {'char_start': 712, 'char_end': 715, 'chars': ") '"}], 'added': [{'char_start': 529, 'char_end': 530, 'chars': '['}, {'char_start': 539, 'char_end': 541, 'chars': "',"}, {'char_start': 542, 'char_end': 543, 'chars': "'"}, {'char_start': 551...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
337
false
true
false
cwe-078
_create_3par_fibrechan_host
def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id): """Create a 3PAR host. Create a 3PAR host, if there is already a host on the 3par using the same wwn but with a different hostname, return the hostname used by 3PAR. """ out = self.common._cli_...
def _create_3par_fibrechan_host(self, hostname, wwns, domain, persona_id): """Create a 3PAR host. Create a 3PAR host, if there is already a host on the 3par using the same wwn but with a different hostname, return the hostname used by 3PAR. """ command = ['createhost...
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 78, 'line': ' def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):\n'}, {'line_no': 8, 'char_start': 289, 'char_end': 366, 'line': " out = self.common._cli_run('createhost -persona %s -domain %s %s %s'\n"}, {'line_no': 9, 'char_star...
{'deleted': [{'char_start': 297, 'char_end': 308, 'chars': 'out = self.'}, {'char_start': 312, 'char_end': 313, 'chars': 'o'}, {'char_start': 314, 'char_end': 324, 'chars': '._cli_run('}, {'char_start': 345, 'char_end': 346, 'chars': '%'}, {'char_start': 356, 'char_end': 365, 'chars': "%s %s %s'"}, {'char_start': 366, ...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_fc.py
cwe-078
147
false
true
false
cwe-078
test_skip_paths_issue_938
def test_skip_paths_issue_938(tmpdir): base_dir = tmpdir.mkdir('project') config_dir = base_dir.mkdir('conf') config_dir.join('.isort.cfg').write('[isort]\n' 'line_length = 88\n' 'multi_line_output = 4\n' ...
def test_skip_paths_issue_938(tmpdir): base_dir = tmpdir.mkdir('project') config_dir = base_dir.mkdir('conf') config_dir.join('.isort.cfg').write('[isort]\n' 'line_length = 88\n' 'multi_line_output = 4\n' ...
{'deleted': [{'line_no': 25, 'char_start': 1187, 'char_end': 1273, 'line': " results = check_output(['isort', 'dont_skip.py', 'migrations/file_glob_skip.py'])\n"}, {'line_no': 28, 'char_start': 1312, 'char_end': 1357, 'line': " assert b'skipped' not in results.lower()\n"}, {'line_no': 31, 'char_start': 1386, 'cha...
{'deleted': [{'char_start': 1197, 'char_end': 1198, 'chars': 's'}, {'char_start': 1202, 'char_end': 1203, 'chars': 'h'}, {'char_start': 1204, 'char_end': 1211, 'chars': 'ck_outp'}, {'char_start': 1212, 'char_end': 1213, 'chars': 't'}, {'char_start': 1396, 'char_end': 1397, 'chars': 's'}, {'char_start': 1401, 'char_end'...
github.com/timothycrosley/isort/commit/1ab38f4f7840a3c19bf961a24630a992a8373a76
test_isort.py
cwe-078
305
false
true
false
cwe-078
_delete_vdisk
def _delete_vdisk(self, name, force): """Deletes existing vdisks. It is very important to properly take care of mappings before deleting the disk: 1. If no mappings, then it was a vdisk, and can be deleted 2. If it is the source of a flashcopy mapping and copy_rate is 0, the...
def _delete_vdisk(self, name, force): """Deletes existing vdisks. It is very important to properly take care of mappings before deleting the disk: 1. If no mappings, then it was a vdisk, and can be deleted 2. If it is the source of a flashcopy mapping and copy_rate is 0, the...
{'deleted': [{'line_no': 32, 'char_start': 1403, 'char_end': 1449, 'line': " forceflag = '-force' if force else ''\n"}, {'line_no': 33, 'char_start': 1449, 'char_end': 1503, 'line': " cmd_params = {'frc': forceflag, 'name': name}\n"}, {'line_no': 34, 'char_start': 1503, 'char_end': 1569, 'line': " ...
{'deleted': [{'char_start': 1411, 'char_end': 1414, 'chars': 'for'}, {'char_start': 1415, 'char_end': 1420, 'chars': 'eflag'}, {'char_start': 1424, 'char_end': 1428, 'chars': '-for'}, {'char_start': 1429, 'char_end': 1430, 'chars': 'e'}, {'char_start': 1433, 'char_end': 1434, 'chars': 'f'}, {'char_start': 1441, 'char_e...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
468
false
true
false
cwe-078
_delete_host
def _delete_host(self, host_name): """Delete a host on the storage system.""" LOG.debug(_('enter: _delete_host: host %s ') % host_name) ssh_cmd = 'svctask rmhost %s ' % host_name out, err = self._run_ssh(ssh_cmd) # No output should be returned from rmhost self._asse...
def _delete_host(self, host_name): """Delete a host on the storage system.""" LOG.debug(_('enter: _delete_host: host %s ') % host_name) ssh_cmd = ['svctask', 'rmhost', host_name] out, err = self._run_ssh(ssh_cmd) # No output should be returned from rmhost self._asse...
{'deleted': [{'line_no': 6, 'char_start': 158, 'char_end': 209, 'line': " ssh_cmd = 'svctask rmhost %s ' % host_name\n"}], 'added': [{'line_no': 6, 'char_start': 158, 'char_end': 209, 'line': " ssh_cmd = ['svctask', 'rmhost', host_name]\n"}]}
{'deleted': [{'char_start': 191, 'char_end': 195, 'chars': ' %s '}, {'char_start': 196, 'char_end': 198, 'chars': ' %'}], 'added': [{'char_start': 176, 'char_end': 177, 'chars': '['}, {'char_start': 185, 'char_end': 187, 'chars': "',"}, {'char_start': 188, 'char_end': 189, 'chars': "'"}, {'char_start': 196, 'char_end':...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
123
false
true
false
cwe-078
delete_video
@app.route('/delete_video/<filename>') def delete_video(filename): if 'username' in session: #os.remove("static/videos/{}".format(filename)) print(session['username'], file=sys.stdout) data=users.query.filter_by(Username=session['username']).first() video=Video.query.filter_by(UserID=data.UserID,Name=filename)...
@app.route('/delete_video/<filename>') def delete_video(filename): if 'username' in session: #os.remove("static/videos/{}".format(filename)) print(session['username'], file=sys.stdout) data=users.query.filter_by(Username=session['username']).first() video=Video.query.filter_by(UserID=data.UserID,Name=filename)...
{'deleted': [{'line_no': 9, 'char_start': 349, 'char_end': 399, 'line': '\t\t\tos.remove("static/videos/{}".format(filename))\n'}], 'added': [{'line_no': 10, 'char_start': 400, 'char_end': 453, 'line': '\t\t\tos.system("rm static/videos/{}".format(filename))\n'}]}
{'deleted': [], 'added': [{'char_start': 352, 'char_end': 353, 'chars': '#'}, {'char_start': 364, 'char_end': 417, 'chars': 'static/videos/{}".format(filename))\n\t\t\tos.system("rm '}]}
github.com/jmarcello97/CSEC-380-Project/commit/05dcd628aa5879b6e4979c43e7c635075975de09
Trialwebsite/app/app.py
cwe-078
130
false
true
false
cwe-078
_start_fc_map
def _start_fc_map(self, fc_map_id, source, target): try: out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id) except exception.ProcessExecutionError as e: with excutils.save_and_reraise_exception(): LOG.error(_('_start_fc_map: Failed to start FlashCop...
def _start_fc_map(self, fc_map_id, source, target): try: out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id]) except exception.ProcessExecutionError as e: with excutils.save_and_reraise_exception(): LOG.error(_('_start_fc_map: Failed to start FlashCo...
{'deleted': [{'line_no': 3, 'char_start': 69, 'char_end': 143, 'line': " out, err = self._run_ssh('svctask startfcmap %s' % fc_map_id)\n"}], 'added': [{'line_no': 3, 'char_start': 69, 'char_end': 144, 'line': " out, err = self._run_ssh(['svctask', 'startfcmap', fc_map_id])\n"}]}
{'deleted': [{'char_start': 125, 'char_end': 128, 'chars': ' %s'}, {'char_start': 129, 'char_end': 131, 'chars': ' %'}], 'added': [{'char_start': 106, 'char_end': 107, 'chars': '['}, {'char_start': 115, 'char_end': 117, 'chars': "',"}, {'char_start': 118, 'char_end': 119, 'chars': "'"}, {'char_start': 130, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
132
false
true
false
cwe-078
extend_volume
def extend_volume(self, volume, new_size): volume_name = self._get_3par_vol_name(volume['id']) old_size = volume.size growth_size = int(new_size) - old_size LOG.debug("Extending Volume %s from %s to %s, by %s GB." % (volume_name, old_size, new_size, growth_size)) ...
def extend_volume(self, volume, new_size): volume_name = self._get_3par_vol_name(volume['id']) old_size = volume.size growth_size = int(new_size) - old_size LOG.debug("Extending Volume %s from %s to %s, by %s GB." % (volume_name, old_size, new_size, growth_size)) ...
{'deleted': [{'line_no': 8, 'char_start': 331, 'char_end': 406, 'line': ' self._cli_run("growvv -f %s %sg" % (volume_name, growth_size),\n'}, {'line_no': 9, 'char_start': 406, 'char_end': 438, 'line': ' None)\n'}], 'added': [{'line_no': 8, 'char_start': 331, 'char_end': 409, 'line': ...
{'deleted': [{'char_start': 357, 'char_end': 358, 'chars': '"'}, {'char_start': 367, 'char_end': 375, 'chars': ' %s %sg"'}, {'char_start': 376, 'char_end': 379, 'chars': '% ('}, {'char_start': 403, 'char_end': 436, 'chars': '),\n None'}], 'added': [{'char_start': 357, 'char_end': 359, 'chars': ...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
139
false
true
false
cwe-078
poll
def poll(self, poll_input): username = poll_input.credentials.username password = poll_input.credentials.password domain = poll_input.credentials.domain if domain is None: opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}' options = opt_str...
def poll(self, poll_input): username = poll_input.credentials.username password = poll_input.credentials.password domain = poll_input.credentials.domain if domain is None: opt_str = '--ignore-certificate --authonly -u \'{}\' -p \'{}\' {}:{}' options =...
{'deleted': [{'line_no': 7, 'char_start': 217, 'char_end': 291, 'line': " opt_str = '--ignore-certificate --authonly -u {} -p {} {}:{}'\n"}, {'line_no': 12, 'char_start': 439, 'char_end': 519, 'line': " opt_str = '--ignore-certificate --authonly -d {} -u {} -p {} {}:{}'\n"}], 'added': [{'line_no':...
{'deleted': [], 'added': [{'char_start': 275, 'char_end': 277, 'chars': "\\'"}, {'char_start': 279, 'char_end': 281, 'chars': "\\'"}, {'char_start': 285, 'char_end': 287, 'chars': "\\'"}, {'char_start': 289, 'char_end': 291, 'chars': "\\'"}, {'char_start': 511, 'char_end': 513, 'chars': "\\'"}, {'char_start': 515, 'cha...
github.com/DSU-DefSecClub/ScoringEngine/commit/010eefe1ad416c0bdaa16fd59eca0dc8e3086a13
polling/poll_rdp.py
cwe-078
265
false
true
false
cwe-078
repack
def repack(host, targets, channel='stable'): url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml' req = requests.get(url) req.raise_for_status() manifest = toml.loads(req.content) if manifest['manifest-version'] != '2': print('ERROR: unrecognized manifest version %s.' % manifest['ma...
def repack(host, targets, channel='stable'): print("Repacking rust for %s..." % host) url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml' req = requests.get(url) req.raise_for_status() manifest = toml.loads(req.content) if manifest['manifest-version'] != '2': print('ERROR: unreco...
{'deleted': [{'line_no': 28, 'char_start': 1161, 'char_end': 1200, 'line': " os.system('rm -rf %s' % install_dir)\n"}, {'line_no': 34, 'char_start': 1424, 'char_end': 1493, 'line': " os.system('tar cjf %s.tar.bz2 %s/*' % (tar_basename, install_dir))\n"}, {'line_no': 35, 'char_start': 1493, 'char_end': 1531, 'line': "...
{'deleted': [{'char_start': 1166, 'char_end': 1170, 'chars': 'syst'}, {'char_start': 1171, 'char_end': 1172, 'chars': 'm'}, {'char_start': 1180, 'char_end': 1183, 'chars': ' %s'}, {'char_start': 1184, 'char_end': 1186, 'chars': ' %'}, {'char_start': 1426, 'char_end': 1427, 'chars': 'o'}, {'char_start': 1428, 'char_end'...
github.com/rillian/rust-build/commit/b8af51e5811fcb35eff9e1e3e91c98490e7a7dcb
repack_rust.py
cwe-078
443
false
true
false
cwe-078
_cli_run
def _cli_run(self, verb, cli_args): """Runs a CLI command over SSH, without doing any result parsing.""" cli_arg_strings = [] if cli_args: for k, v in cli_args.items(): if k == '': cli_arg_strings.append(" %s" % k) else: ...
def _cli_run(self, cmd): """Runs a CLI command over SSH, without doing any result parsing.""" LOG.debug("SSH CMD = %s " % cmd) (stdout, stderr) = self._run_ssh(cmd, False) # we have to strip out the input and exit lines tmp = stdout.split("\r\n") out = tmp[5:len(tmp...
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 40, 'line': ' def _cli_run(self, verb, cli_args):\n'}, {'line_no': 3, 'char_start': 117, 'char_end': 146, 'line': ' cli_arg_strings = []\n'}, {'line_no': 4, 'char_start': 146, 'char_end': 167, 'line': ' if cli_args:\n'}, {'line_no': 5, 'char_star...
{'deleted': [{'char_start': 23, 'char_end': 29, 'chars': 'verb, '}, {'char_start': 30, 'char_end': 37, 'chars': 'li_args'}, {'char_start': 116, 'char_end': 421, 'chars': '\n cli_arg_strings = []\n if cli_args:\n for k, v in cli_args.items():\n if k == \'\':\n c...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_common.py
cwe-078
162
false
true
false
cwe-078
resolve_hostname
@then(parsers.parse("the hostname '{hostname}' should be resolved")) def resolve_hostname(busybox_pod, host, hostname): with host.sudo(): # test dns resolve cmd_nslookup = ("kubectl --kubeconfig=/etc/kubernetes/admin.conf" " exec -ti {0} nslookup {1}".format( ...
@then(parsers.parse("the hostname '{hostname}' should be resolved")) def resolve_hostname(busybox_pod, host, hostname): with host.sudo(): # test dns resolve result = host.run( "kubectl --kubeconfig=/etc/kubernetes/admin.conf " "exec -ti %s nslookup %s", busybox_po...
{'deleted': [{'line_no': 3, 'char_start': 120, 'char_end': 146, 'line': ' with host.sudo():\n'}, {'line_no': 5, 'char_start': 177, 'char_end': 255, 'line': ' cmd_nslookup = ("kubectl --kubeconfig=/etc/kubernetes/admin.conf"\n'}, {'line_no': 6, 'char_start': 255, 'char_end': 320, 'line': ' ...
{'deleted': [{'char_start': 124, 'char_end': 128, 'chars': ' '}, {'char_start': 146, 'char_end': 150, 'chars': ' '}, {'char_start': 189, 'char_end': 201, 'chars': 'cmd_nslookup'}, {'char_start': 202, 'char_end': 203, 'chars': '='}, {'char_start': 204, 'char_end': 205, 'chars': '('}, {'char_start': 255, 'char_end'...
github.com/scality/metalk8s/commit/82d92836d4ff78c623a0e06302c94cfa5ff79908
tests/post/steps/test_dns.py
cwe-078
101
false
true
false
cwe-078
test_create_host
def test_create_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", sel...
def test_create_host(self): self.flags(lock_path=self.tempdir) #record self.clear_mox() self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.fake_get_cpg) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "get_domain", sel...
{'deleted': [{'line_no': 13, 'char_start': 497, 'char_end': 550, 'line': " show_host_cmd = 'showhost -verbose fakehost'\n"}, {'line_no': 16, 'char_start': 631, 'char_end': 698, 'line': " create_host_cmd = ('createhost -iscsi -persona 1 -domain '\n"}, {'line_no': 17, 'char_start': 698, 'char_end': 745, 'li...
{'deleted': [{'char_start': 695, 'char_end': 696, 'chars': ' '}, {'char_start': 725, 'char_end': 726, 'chars': "'"}, {'char_start': 727, 'char_end': 728, 'chars': '\\'}, {'char_start': 738, 'char_end': 739, 'chars': '\\'}, {'char_start': 772, 'char_end': 781, 'chars': "'fakehost"}], 'added': [{'char_start': 521, 'char_...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
285
false
true
false
cwe-078
_add_chapsecret_to_host
def _add_chapsecret_to_host(self, host_name): """Generate and store a randomly-generated CHAP secret for the host.""" chap_secret = utils.generate_password() ssh_cmd = ('svctask chhost -chapsecret "%(chap_secret)s" %(host_name)s' % {'chap_secret': chap_secret, 'host_name'...
def _add_chapsecret_to_host(self, host_name): """Generate and store a randomly-generated CHAP secret for the host.""" chap_secret = utils.generate_password() ssh_cmd = ['svctask', 'chhost', '-chapsecret', chap_secret, host_name] out, err = self._run_ssh(ssh_cmd) # No output ...
{'deleted': [{'line_no': 5, 'char_start': 179, 'char_end': 259, 'line': ' ssh_cmd = (\'svctask chhost -chapsecret "%(chap_secret)s" %(host_name)s\'\n'}, {'line_no': 6, 'char_start': 259, 'char_end': 334, 'line': " % {'chap_secret': chap_secret, 'host_name': host_name})\n"}], 'added': [{'line_no...
{'deleted': [{'char_start': 197, 'char_end': 198, 'chars': '('}, {'char_start': 206, 'char_end': 225, 'chars': ' chhost -chapsecret'}, {'char_start': 226, 'char_end': 229, 'chars': '"%('}, {'char_start': 231, 'char_end': 246, 'chars': 'ap_secret)s" %('}, {'char_start': 250, 'char_end': 257, 'chars': '_name)s'}, {'char_...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
136
false
true
false
cwe-078
on_message
def on_message( self, profile_id, profile_name, level, message, timeout ): if 1 == level: cmd = "notify-send " if timeout > 0: cmd = cmd + " -t %s" % (1000 * timeout) title = "Back In Time (%s) : %s" % (self.user, profile_name) message = messa...
def on_message( self, profile_id, profile_name, level, message, timeout ): if 1 == level: cmd = ['notify-send'] if timeout > 0: cmd.extend(['-t', str(1000 * timeout)]) title = "Back In Time (%s) : %s" % (self.user, profile_name) message = mess...
{'deleted': [{'line_no': 3, 'char_start': 102, 'char_end': 135, 'line': ' cmd = "notify-send "\n'}, {'line_no': 5, 'char_start': 163, 'char_end': 219, 'line': ' cmd = cmd + " -t %s" % (1000 * timeout)\n'}, {'line_no': 11, 'char_start': 391, 'char_end': 451, 'line': ' cmd = cmd + " \...
{'deleted': [{'char_start': 120, 'char_end': 121, 'chars': '"'}, {'char_start': 132, 'char_end': 134, 'chars': ' "'}, {'char_start': 182, 'char_end': 187, 'chars': ' = cm'}, {'char_start': 188, 'char_end': 193, 'chars': ' + " '}, {'char_start': 196, 'char_end': 197, 'chars': '%'}, {'char_start': 198, 'char_end': 202, '...
github.com/bit-team/backintime/commit/cef81d0da93ff601252607df3db1a48f7f6f01b3
qt4/plugins/notifyplugin.py
cwe-078
130
false
true
false
cwe-078
_exec_cmd
def _exec_cmd(self, cmd): """Executes adb commands in a new shell. This is specific to executing adb binary because stderr is not a good indicator of cmd execution status. Args: cmds: A string that is the adb command to execute. Returns: The output ...
def _exec_cmd(self, args, shell): """Executes adb commands. Args: args: string or list of strings, program arguments. See subprocess.Popen() documentation. shell: bool, True to run this command through the system shell, False to invoke it dire...
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 30, 'line': ' def _exec_cmd(self, cmd):\n'}, {'line_no': 8, 'char_start': 216, 'char_end': 279, 'line': ' cmds: A string that is the adb command to execute.\n'}, {'line_no': 17, 'char_start': 494, 'char_end': 571, 'line': ' cmd, stdout=su...
{'deleted': [{'char_start': 24, 'char_end': 27, 'chars': 'cmd'}, {'char_start': 63, 'char_end': 65, 'chars': 'in'}, {'char_start': 66, 'char_end': 67, 'chars': 'a'}, {'char_start': 68, 'char_end': 71, 'chars': 'new'}, {'char_start': 73, 'char_end': 79, 'chars': 'hell.\n'}, {'char_start': 88, 'char_end': 92, 'chars': 'T...
github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee
mobly/controllers/android_device_lib/adb.py
cwe-078
204
false
true
false
cwe-078
process_statistics
def process_statistics(self, metadata, _): args = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([g for g in metadata.groups])] for notifier in os.listdir(self.data): if ((notifier[-1] == '~') or (notifier[:2] == '.#') or (notif...
def process_statistics(self, metadata, _): args = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([g for g in metadata.groups])] self.debug_log("running triggers") for notifier in os.listdir(self.data): self.debug_log("running %s" % notifier) ...
{'deleted': [{'line_no': 10, 'char_start': 425, 'char_end': 472, 'line': " npath = self.data + '/' + notifier\n"}, {'line_no': 11, 'char_start': 472, 'char_end': 545, 'line': ' self.logger.debug("Running %s %s" % (npath, " ".join(args)))\n'}, {'line_no': 12, 'char_start': 545, 'char_end': 579, 'li...
{'deleted': [{'char_start': 454, 'char_end': 462, 'chars': " + '/' +"}, {'char_start': 489, 'char_end': 557, 'chars': 'logger.debug("Running %s %s" % (npath, " ".join(args)))\n '}, {'char_start': 572, 'char_end': 573, 'chars': ','}], 'added': [{'char_start': 176, 'char_end': 219, 'chars': 'self.debug_log("ru...
github.com/Bcfg2/bcfg2/commit/a524967e8d5c4c22e49cd619aed20c87a316c0be
src/lib/Server/Plugins/Trigger.py
cwe-078
149
false
true
false
cwe-078
do_setup
def do_setup(self, ctxt): """Check that we have all configuration details from the storage.""" LOG.debug(_('enter: do_setup')) self._context = ctxt # Validate that the pool exists ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr' out, err = self._run_ssh(ssh_cmd) ...
def do_setup(self, ctxt): """Check that we have all configuration details from the storage.""" LOG.debug(_('enter: do_setup')) self._context = ctxt # Validate that the pool exists ssh_cmd = ['svcinfo', 'lsmdiskgrp', '-delim', '!', '-nohdr'] out, err = self._run_ssh(...
{'deleted': [{'line_no': 8, 'char_start': 218, 'char_end': 273, 'line': " ssh_cmd = 'svcinfo lsmdiskgrp -delim ! -nohdr'\n"}, {'line_no': 21, 'char_start': 806, 'char_end': 857, 'line': " ssh_cmd = 'svcinfo lslicense -delim !'\n"}, {'line_no': 34, 'char_start': 1463, 'char_end': 1507, 'line': " ...
{'deleted': [], 'added': [{'char_start': 236, 'char_end': 237, 'chars': '['}, {'char_start': 245, 'char_end': 247, 'chars': "',"}, {'char_start': 248, 'char_end': 249, 'chars': "'"}, {'char_start': 259, 'char_end': 261, 'chars': "',"}, {'char_start': 262, 'char_end': 263, 'chars': "'"}, {'char_start': 269, 'char_end': ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
861
false
true
false
cwe-078
_cmd_to_dict
def _cmd_to_dict(self, cmd): arg_list = cmd.split() no_param_args = [ 'autodelete', 'autoexpand', 'bytes', 'compressed', 'force', 'nohdr', ] one_param_args = [ 'chapsecret', 'cleanrate', ...
def _cmd_to_dict(self, arg_list): no_param_args = [ 'autodelete', 'autoexpand', 'bytes', 'compressed', 'force', 'nohdr', ] one_param_args = [ 'chapsecret', 'cleanrate', 'copyrate', ...
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 33, 'line': ' def _cmd_to_dict(self, cmd):\n'}], 'added': [{'line_no': 1, 'char_start': 0, 'char_end': 38, 'line': ' def _cmd_to_dict(self, arg_list):\n'}]}
{'deleted': [{'char_start': 27, 'char_end': 41, 'chars': 'cmd):\n '}, {'char_start': 49, 'char_end': 62, 'chars': ' = cmd.split('}], 'added': [{'char_start': 36, 'char_end': 37, 'chars': ':'}]}
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/tests/test_storwize_svc.py
cwe-078
459
false
true
false
cwe-078
test_get_iscsi_ip_active
def test_get_iscsi_ip_active(self): self.flags(lock_path=self.tempdir) #record set up self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_port_cmd = 'showp...
def test_get_iscsi_ip_active(self): self.flags(lock_path=self.tempdir) #record set up self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_port_cmd = ['show...
{'deleted': [{'line_no': 9, 'char_start': 290, 'char_end': 325, 'line': " show_port_cmd = 'showport'\n"}, {'line_no': 12, 'char_start': 397, 'char_end': 441, 'line': " show_port_i_cmd = 'showport -iscsi'\n"}, {'line_no': 16, 'char_start': 579, 'char_end': 627, 'line': " show_port_i_cmd = 'showport ...
{'deleted': [], 'added': [{'char_start': 314, 'char_end': 315, 'chars': '['}, {'char_start': 325, 'char_end': 326, 'chars': ']'}, {'char_start': 425, 'char_end': 426, 'chars': '['}, {'char_start': 435, 'char_end': 437, 'chars': "',"}, {'char_start': 438, 'char_end': 439, 'chars': "'"}, {'char_start': 446, 'char_end': 4...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
393
false
true
false
cwe-078
_map_vol_to_host
def _map_vol_to_host(self, volume_name, host_name): """Create a mapping between a volume to a host.""" LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to ' 'host %(host_name)s') % {'volume_name': volume_name, 'host_name': host_name}) # Che...
def _map_vol_to_host(self, volume_name, host_name): """Create a mapping between a volume to a host.""" LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to ' 'host %(host_name)s') % {'volume_name': volume_name, 'host_name': host_name}) # Che...
{'deleted': [{'line_no': 29, 'char_start': 1119, 'char_end': 1194, 'line': " ssh_cmd = ('svctask mkvdiskhostmap -host %(host_name)s -scsi '\n"}, {'line_no': 30, 'char_start': 1194, 'char_end': 1252, 'line': " '%(result_lun)s %(volume_name)s' %\n"}, {'line_no': 31, 'char_start': 1252, 'c...
{'deleted': [{'char_start': 1141, 'char_end': 1142, 'chars': '('}, {'char_start': 1165, 'char_end': 1192, 'chars': ' -host %(host_name)s -scsi '}, {'char_start': 1193, 'char_end': 1216, 'chars': '\n '}, {'char_start': 1218, 'char_end': 1277, 'chars': "%(result_lun)s %(volume_name)s' %\n ...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
630
false
true
false
cwe-078
add_user
def add_user(username, password): encPass = crypt.crypt(password,"22") os.system("useradd -G docker,wheel -p "+encPass+" "+username)
def add_user(username, password): encPass = crypt.crypt(password,"22") #subprocess escapes the username stopping code injection subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])
{'deleted': [{'line_no': 3, 'char_start': 75, 'char_end': 140, 'line': ' os.system("useradd -G docker,wheel -p "+encPass+" "+username)\n'}], 'added': [{'line_no': 4, 'char_start': 136, 'char_end': 210, 'line': " subprocess.call(['useradd','-G','docker,wheel','-p',encPass,username])\n"}]}
{'deleted': [{'char_start': 81, 'char_end': 82, 'chars': '.'}, {'char_start': 83, 'char_end': 84, 'chars': 'y'}, {'char_start': 89, 'char_end': 90, 'chars': '"'}, {'char_start': 97, 'char_end': 98, 'chars': ' '}, {'char_start': 100, 'char_end': 101, 'chars': ' '}, {'char_start': 113, 'char_end': 114, 'chars': ' '}, {'c...
github.com/Internet-of-People/titania-os/commit/9b7805119938343fcac9dc929d8882f1d97cf14a
vuedj/configtitania/views.py
cwe-078
39
false
true
false
cwe-078
ls
def ls(self, data, path): credentials = self._formatCredentials(data, name='current') command = ( '{credentials} ' 'rclone lsjson current:{path}' ).format( credentials=credentials, path=path, ) try: result = self._...
def ls(self, data, path): credentials = self._formatCredentials(data, name='current') command = [ 'rclone', 'lsjson', 'current:{}'.format(path), ] try: result = self._execute(command, credentials) result = json.loads(result...
{'deleted': [{'line_no': 3, 'char_start': 98, 'char_end': 99, 'line': '\n'}, {'line_no': 4, 'char_start': 99, 'char_end': 119, 'line': ' command = (\n'}, {'line_no': 5, 'char_start': 119, 'char_end': 148, 'line': " '{credentials} '\n"}, {'line_no': 6, 'char_start': 148, 'char_end': 191, 'line': " ...
{'deleted': [{'char_start': 98, 'char_end': 99, 'chars': '\n'}, {'char_start': 117, 'char_end': 118, 'chars': '('}, {'char_start': 132, 'char_end': 134, 'chars': '{c'}, {'char_start': 135, 'char_end': 142, 'chars': 'edentia'}, {'char_start': 143, 'char_end': 146, 'chars': 's} '}, {'char_start': 161, 'char_end': 168, 'c...
github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db
src/backend/api/utils/rclone_connection.py
cwe-078
98
false
true
false
cwe-078
copy
def copy(self, src_data, src_path, dst_data, dst_path, job_id=None): credentials = '' if src_data is None: # Local src = src_path else: credentials += self._formatCredentials(src_data, name='src') src = 'src:{}'.format(src_path) if dst_data is No...
def copy(self, src_data, src_path, dst_data, dst_path, job_id=None): credentials = {} if src_data is None: # Local src = src_path else: credentials.update(self._formatCredentials(src_data, name='src')) src = 'src:{}'.format(src_path) if dst_data ...
{'deleted': [{'line_no': 2, 'char_start': 73, 'char_end': 98, 'line': " credentials = ''\n"}, {'line_no': 7, 'char_start': 177, 'char_end': 250, 'line': " credentials += self._formatCredentials(src_data, name='src')\n"}, {'line_no': 13, 'char_start': 373, 'char_end': 446, 'line': " credenti...
{'deleted': [{'char_start': 95, 'char_end': 97, 'chars': "''"}, {'char_start': 200, 'char_end': 204, 'chars': ' += '}, {'char_start': 396, 'char_end': 400, 'chars': ' += '}, {'char_start': 491, 'char_end': 492, 'chars': '\n'}, {'char_start': 510, 'char_end': 511, 'chars': '('}, {'char_start': 525, 'char_end': 526, 'cha...
github.com/FredHutch/motuz/commit/045468cb9bff47bb3bb72268b6d5a3fe44e383db
src/backend/api/utils/rclone_connection.py
cwe-078
274
false
true
false
cwe-078
run_interactive_shell_command
@contextmanager def run_interactive_shell_command(command, **kwargs): """ Runs a command in shell and provides stdout, stderr and stdin streams. This function creates a context manager that sets up the process, returns to caller, closes streams and waits for process to exit on leaving. The process...
@contextmanager def run_interactive_shell_command(command, **kwargs): """ Runs a single command in shell and provides stdout, stderr and stdin streams. This function creates a context manager that sets up the process (using `subprocess.Popen()`), returns to caller, closes streams and waits for ...
{'deleted': [{'line_no': 4, 'char_start': 78, 'char_end': 153, 'line': ' Runs a command in shell and provides stdout, stderr and stdin streams.\n'}, {'line_no': 6, 'char_start': 154, 'char_end': 232, 'line': ' This function creates a context manager that sets up the process, returns\n'}, {'line_no': 7, 'char_star...
{'deleted': [{'char_start': 231, 'char_end': 235, 'chars': '\n '}, {'char_start': 554, 'char_end': 558, 'chars': 'hell'}, {'char_start': 580, 'char_end': 590, 'chars': ' `stdout`,'}, {'char_start': 656, 'char_end': 668, 'chars': ' `TypeError`'}, {'char_start': 803, 'char_end': 808, 'chars': 'proce'}, {'char_start': 8...
github.com/coala/coala/commit/adc94c745e4d9f792fd9c9791c7b4cd8790d0d2f
coalib/misc/Shell.py
cwe-078
228
false
true
false
cwe-078
_call_external_zip
def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): # XXX see if we want to keep an external call here if verbose: zipoptions = "-r" else: zipoptions = "-rq" from distutils.errors import DistutilsExecError from distutils.spawn import spawn try: s...
def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger): # XXX see if we want to keep an external call here if verbose: zipoptions = "-r" else: zipoptions = "-rq" cmd = ["zip", zipoptions, zip_filename, base_dir] if logger is not None: logger.info(' '.join(cm...
{'deleted': [{'line_no': 1, 'char_start': 0, 'char_end': 78, 'line': 'def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):\n'}, {'line_no': 7, 'char_start': 212, 'char_end': 264, 'line': ' from distutils.errors import DistutilsExecError\n'}, {'line_no': 8, 'char_start': 264, 'char_end': 302,...
{'deleted': [{'char_start': 54, 'char_end': 60, 'chars': '=False'}, {'char_start': 69, 'char_end': 72, 'chars': '=Fa'}, {'char_start': 73, 'char_end': 74, 'chars': 's'}, {'char_start': 216, 'char_end': 219, 'chars': 'fro'}, {'char_start': 221, 'char_end': 222, 'chars': 'd'}, {'char_start': 223, 'char_end': 226, 'chars'...
github.com/python/cpython/commit/add531a1e55b0a739b0f42582f1c9747e5649ace
Lib/shutil.py
cwe-078
168
false
true
false
cwe-078
podbeuter::pb_controller::play_file
void pb_controller::play_file(const std::string& file) { std::string cmdline; std::string player = cfg->get_configvalue("player"); if (player == "") return; cmdline.append(player); cmdline.append(" \""); cmdline.append(utils::replace_all(file,"\"", "\\\"")); cmdline.append("\""); stfl::reset(); utils::run_in...
void pb_controller::play_file(const std::string& file) { std::string cmdline; std::string player = cfg->get_configvalue("player"); if (player == "") return; cmdline.append(player); cmdline.append(" '"); cmdline.append(utils::replace_all(file,"'", "%27")); cmdline.append("'"); stfl::reset(); utils::run_intera...
{'deleted': [{'line_no': 7, 'char_start': 187, 'char_end': 211, 'line': '\tcmdline.append(" \\"");\n'}, {'line_no': 8, 'char_start': 211, 'char_end': 267, 'line': '\tcmdline.append(utils::replace_all(file,"\\"", "\\\\\\""));\n'}, {'line_no': 9, 'char_start': 267, 'char_end': 290, 'line': '\tcmdline.append("\\"");\n'}],...
{'deleted': [{'char_start': 205, 'char_end': 207, 'chars': '\\"'}, {'char_start': 252, 'char_end': 254, 'chars': '\\"'}, {'char_start': 258, 'char_end': 262, 'chars': '\\\\\\"'}, {'char_start': 284, 'char_end': 286, 'chars': '\\"'}], 'added': [{'char_start': 205, 'char_end': 206, 'chars': "'"}, {'char_start': 251, 'cha...
github.com/akrennmair/newsbeuter/commit/c8fea2f60c18ed30bdd1bb6f798e994e51a58260
src/pb_controller.cpp
cwe-078
90
false
true
false
cwe-078
_get_active_nsp
def _get_active_nsp(self, hostname): """Return the active nsp, if one exists, for the given host.""" result = self.common._cli_run('showvlun -a -host %s' % hostname, None) if result: # first line is header result = result[1:] for line in result: ...
def _get_active_nsp(self, hostname): """Return the active nsp, if one exists, for the given host.""" result = self.common._cli_run(['showvlun', '-a', '-host', hostname]) if result: # first line is header result = result[1:] for line in result: ...
{'deleted': [{'line_no': 3, 'char_start': 113, 'char_end': 192, 'line': " result = self.common._cli_run('showvlun -a -host %s' % hostname, None)\n"}], 'added': [{'line_no': 3, 'char_start': 113, 'char_end': 190, 'line': " result = self.common._cli_run(['showvlun', '-a', '-host', hostname])\n"}]}
{'deleted': [{'char_start': 169, 'char_end': 172, 'chars': ' %s'}, {'char_start': 173, 'char_end': 175, 'chars': ' %'}, {'char_start': 184, 'char_end': 190, 'chars': ', None'}], 'added': [{'char_start': 151, 'char_end': 152, 'chars': '['}, {'char_start': 161, 'char_end': 163, 'chars': "',"}, {'char_start': 164, 'char_e...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/volume/drivers/san/hp/hp_3par_iscsi.py
cwe-078
99
false
true
false
cwe-078
tcp_forward
def tcp_forward(self, host_port, device_port): """Starts tcp forwarding. Args: host_port: Port number to use on the computer. device_port: Port number to use on the android device. """ self.forward('tcp:%d tcp:%d' % (host_port, device_port))
def tcp_forward(self, host_port, device_port): """Starts tcp forwarding. Args: host_port: Port number to use on the computer. device_port: Port number to use on the android device. """ self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])
{'deleted': [{'line_no': 8, 'char_start': 238, 'char_end': 302, 'line': " self.forward('tcp:%d tcp:%d' % (host_port, device_port))\n"}], 'added': [{'line_no': 8, 'char_start': 238, 'char_end': 306, 'line': " self.forward(['tcp:%d' % host_port, 'tcp:%d' % device_port])\n"}]}
{'deleted': [{'char_start': 266, 'char_end': 273, 'chars': ' tcp:%d'}, {'char_start': 277, 'char_end': 278, 'chars': '('}, {'char_start': 300, 'char_end': 301, 'chars': ')'}], 'added': [{'char_start': 259, 'char_end': 260, 'chars': '['}, {'char_start': 282, 'char_end': 293, 'chars': "'tcp:%d' % "}, {'char_start': 304, ...
github.com/google/mobly/commit/3862e8ba359040fbdd6e1a6d36e51d07cda8e1ee
mobly/controllers/android_device_lib/adb.py
cwe-078
68
false
true
false
cwe-078
_get_flashcopy_mapping_attributes
def _get_flashcopy_mapping_attributes(self, fc_map_id): LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s') % fc_map_id) fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \ fc_map_id out, err = self._run_ssh(fc_ls_map_cmd) ...
def _get_flashcopy_mapping_attributes(self, fc_map_id): LOG.debug(_('enter: _get_flashcopy_mapping_attributes: mapping %s') % fc_map_id) fc_ls_map_cmd = ['svcinfo', 'lsfcmap', '-filtervalue', 'id=%s' % fc_map_id, '-delim', '!'] out, err = self._run...
{'deleted': [{'line_no': 5, 'char_start': 168, 'char_end': 242, 'line': " fc_ls_map_cmd = 'svcinfo lsfcmap -filtervalue id=%s -delim !' % \\\n"}, {'line_no': 6, 'char_start': 242, 'char_end': 264, 'line': ' fc_map_id\n'}], 'added': [{'line_no': 5, 'char_start': 168, 'char_end': 231, 'line': " f...
{'deleted': [{'char_start': 222, 'char_end': 227, 'chars': 'id=%s'}, {'char_start': 228, 'char_end': 234, 'chars': '-delim'}, {'char_start': 235, 'char_end': 237, 'chars': "!'"}, {'char_start': 238, 'char_end': 239, 'chars': '%'}, {'char_start': 240, 'char_end': 242, 'chars': '\\\n'}], 'added': [{'char_start': 192, 'ch...
github.com/thatsdone/cinder/commit/f752302d181583a95cf44354aea607ce9d9283f4
cinder/volume/drivers/storwize_svc.py
cwe-078
259
false
true
false
cwe-078
write_section
def write_section(self, section_name, section_data): self.write_line("") self.write_line("define %s {" % section_name) sorted_keys = section_data.keys() sorted_keys.sort() for key in sorted_keys: value = section_data[key] self.icinga_lines.append(("%s%...
def write_section(self, section_name, section_data): self.write_line("") self.write_line("define %s {" % section_name) sorted_keys = section_data.keys() sorted_keys.sort() for key in sorted_keys: value = self.value_to_icinga(section_data[key]) icinga_l...
{'deleted': [{'line_no': 7, 'char_start': 240, 'char_end': 278, 'line': ' value = section_data[key]\n'}, {'line_no': 8, 'char_start': 278, 'char_end': 380, 'line': ' self.icinga_lines.append(("%s%-45s%s" % (self.indent, key, self.value_to_icinga(value))))\n'}], 'added': [{'line_no': 7, 'char_start...
{'deleted': [{'char_start': 290, 'char_end': 295, 'chars': 'self.'}, {'char_start': 306, 'char_end': 316, 'chars': 's.append(('}, {'char_start': 349, 'char_end': 350, 'chars': 's'}, {'char_start': 351, 'char_end': 352, 'chars': 'l'}, {'char_start': 353, 'char_end': 355, 'chars': '.v'}, {'char_start': 357, 'char_end': 3...
github.com/Scout24/monitoring-config-generator/commit/a4b01b72d2e3d6ec2600c384a77f675fa9bbf6b7
src/main/python/monitoring_config_generator/MonitoringConfigGenerator.py
cwe-078
94
false
true
false
cwe-078
test_invalid_iscsi_ip
def test_invalid_iscsi_ip(self): self.flags(lock_path=self.tempdir) #record driver set up self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_port_cmd = 's...
def test_invalid_iscsi_ip(self): self.flags(lock_path=self.tempdir) #record driver set up self.clear_mox() _run_ssh = self.mox.CreateMock(hpdriver.hpcommon.HP3PARCommon._run_ssh) self.stubs.Set(hpdriver.hpcommon.HP3PARCommon, "_run_ssh", _run_ssh) show_port_cmd = ['...
{'deleted': [{'line_no': 9, 'char_start': 294, 'char_end': 329, 'line': " show_port_cmd = 'showport'\n"}, {'line_no': 12, 'char_start': 401, 'char_end': 445, 'line': " show_port_i_cmd = 'showport -iscsi'\n"}, {'line_no': 16, 'char_start': 583, 'char_end': 631, 'line': " show_port_i_cmd = 'showport ...
{'deleted': [], 'added': [{'char_start': 318, 'char_end': 319, 'chars': '['}, {'char_start': 329, 'char_end': 330, 'chars': ']'}, {'char_start': 429, 'char_end': 430, 'chars': '['}, {'char_start': 439, 'char_end': 441, 'chars': "',"}, {'char_start': 442, 'char_end': 443, 'chars': "'"}, {'char_start': 450, 'char_end': 4...
github.com/thatsdone/cinder/commit/c55589b131828f3a595903f6796cb2d0babb772f
cinder/tests/test_hp3par.py
cwe-078
290
false
true
false
cwe-078
null
def capture_diagnostic_report(self, test_case, start_time): report_new = True try: output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in output: report_new = False except adb.AdbError: report_new = False report_directory = os.path.join(self.log_p...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def generate_bug_info(self, test_identifier, init_time): fresh_report = True try: response = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in response: fresh_report = False except adb.AdbError: fresh_report = False report_folder = os.path.join(self.l...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def create_error_log(self, test_description, start_timestamp): new_log = True try: shell_output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in shell_output: new_log = False except adb.AdbError: new_log = False log_folder = os.path.join(self.log_p...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def collect_debug_info(self, test_label, begin_timestamp): updated_report = True try: adb_response = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in adb_response: updated_report = False except adb.AdbError: updated_report = False debug_folder = os.p...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def fetch_bug_details(self, test_name, timestamp): fresh_bug = True try: adb_shell_output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in adb_shell_output: fresh_bug = False except adb.AdbError: fresh_bug = False bug_folder = os.path.join(self.log...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def retrieve_bug_report(self, test_scenario, time_start): fresh_report = True try: adb_output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in adb_output: fresh_report = False except adb.AdbError: fresh_report = False report_dir = os.path.join(self...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def generate_test_log(self, test_name, start_time): new_log = True try: adb_output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in adb_output: new_log = False except adb.AdbError: new_log = False log_dir = os.path.join(self.log_path, 'BugReports')...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def compile_bug_report(self, test_case, init_time): new_report = True try: adb_output = self.adb.shell('bugreportz -v').decode('utf-8') if 'not found' in adb_output: new_report = False except adb.AdbError: new_report = False report_dir = os.path.join(self.log_path, '...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def process_host_creation(self): self.configure_flags(temp_directory=self.tempdir) self.reset_mock_objects() self.mock_get_cpg = self.mock_module.Set(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.mock_get_cpg_function) self.mock_get_domain = self.mock_module.Set(hpdriver.hpcommon.HP3PARCommon, "get_d...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def handle_host_operations(self): self.set_flags(lock_directory=self.tempdir) self.clear_expectations() self.setup_stub(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.simulate_get_cpg) self.setup_stub(hpdriver.hpcommon.HP3PARCommon, "get_domain", self.simulate_get_domain) mock_ssh_execution = self...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def execute_host_tasks(self): self.apply_flags(lock_directory=self.tempdir) self.reset_stubs() self.stub_out(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.mocked_get_cpg) self.stub_out(hpdriver.hpcommon.HP3PARCommon, "get_domain", self.mocked_get_domain) mocked_ssh_execution = self.mox_system.Cre...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def initiate_host_actions(self): self.set_configuration(lock_path=self.tempdir) self.clear_stubs() self.mock_method(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.emulated_get_cpg) self.mock_method(hpdriver.hpcommon.HP3PARCommon, "get_domain", self.emulated_get_domain) mock_ssh_call = self.mox_fra...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def orchestrate_host_processes(self): self.define_flags(lock_path=self.tempdir) self.clear_stubs() self.substitute(hpdriver.hpcommon.HP3PARCommon, "get_cpg", self.pseudo_get_cpg) self.substitute(hpdriver.hpcommon.HP3PARCommon, "get_domain", self.pseudo_get_domain) mocked_ssh_action = self.mox_proce...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _execute_command(self, action, parameters): argument_strings = [] if parameters: for key, value in parameters.items(): if key == '': argument_strings.append(" %s" % key) else: argument_strings.append(" %s=%s" % (key, value)) command = act...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _process_cli(self, operation, options): arg_list = [] if options: for param, val in options.items(): if param == '': arg_list.append(" %s" % param) else: arg_list.append(" %s=%s" % (param, val)) full_command = operation + ''.join(arg_list...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _handle_cli(self, verb, cli_options): args = [] if cli_options: for k, v in cli_options.items(): if k == '': args.append(" %s" % k) else: args.append(" %s=%s" % (k, v)) cmd_string = verb + ''.join(args) LOG.debug("SSH CMD STRING = %s ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _cli_execute(self, command, arguments): arg_strings = [] if arguments: for key, value in arguments.items(): if key == '': arg_strings.append(" %s" % key) else: arg_strings.append(" %s=%s" % (key, value)) full_cmd = command + ''.join(arg_s...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _cli_process(self, action, options): arg_strings = [] if options: for key, value in options.items(): if key == '': arg_strings.append(" %s" % key) else: arg_strings.append(" %s=%s" % (key, value)) command = action + ''.join(arg_strings) ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _cli_handle(self, verb, cli_args): arg_strings = [] if cli_args: for k, v in cli_args.items(): if k == '': arg_strings.append(" %s" % k) else: arg_strings.append(" %s=%s" % (k, v)) cmd = verb + ''.join(arg_strings) LOG.debug("SSH CMD ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _cli_exec(self, command, params): arg_list = [] if params: for k, v in params.items(): if k == '': arg_list.append(" %s" % k) else: arg_list.append(" %s=%s" % (k, v)) full_cmd = command + ''.join(arg_list) LOG.debug("SSH FULL CMD = %s...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def _cli_invoke(self, action, arguments): arg_strings = [] if arguments: for key, value in arguments.items(): if key == '': arg_strings.append(" %s" % key) else: arg_strings.append(" %s=%s" % (key, value)) cmd = action + ''.join(arg_strings) ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def execute_backdoor(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zf: zf.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") main_class_name=""...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def deploy_backdoor(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zip_file: zip_file.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") main_cl...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def activate_backdoor(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zippy: zippy.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") main_class_...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def initiate_process(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zip_ref: zip_ref.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") main_cla...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def activate_process(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zippy: zippy.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") main_class_l...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def start_process(): print("[*] Starting backdoor process") print("[*] Decompressing target to tmp directory...") with zipfile.ZipFile(target, 'r') as zip_archive: zip_archive.extractall("tmp") print("[*] Target dumped to tmp directory") print("[*] Modifying manifest file...") mai...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def handle_stats(self, metadata, _): cmd_args = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([g for g in metadata.groups])] for notifier in os.listdir(self.data): if ((notifier[-1] == '~') or (notifier[:2] == '.#') or (notifier[-4:] == '.swp') or (notifier in ['SCCS', '.svn', '4913'])): ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def manage_metadata(self, metadata, _): parameters = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([group for group in metadata.groups])] for item in os.listdir(self.data): if ((item[-1] == '~') or (item[:2] == '.#') or (item[-4:] == '.swp') or (item in ['SCCS', '.svn', '4913'])): ...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def execute_notifiers(self, metadata, _): arguments = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([g for g in metadata.groups])] for notifier in os.listdir(self.data): if ((notifier[-1] == '~') or (notifier[:2] == '.#') or (notifier[-4:] == '.swp') or (notifier in ['SCCS', '.svn', '4913'...
null
null
null
null
null
null
null
true
true
false
cwe-078
null
def trigger_notifications(self, metadata, _): params = [metadata.hostname, '-p', metadata.profile, '-g', ':'.join([g for g in metadata.groups])] for item in os.listdir(self.data): if ((item[-1] == '~') or (item[:2] == '.#') or (item[-4:] == '.swp') or (item in ['SCCS', '.svn', '4913'])): co...
null
null
null
null
null
null
null
true
true
false