mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 03:52:17 +03:00
addded scopy from remote
This commit is contained in:
parent
998cf89f52
commit
502f5495e6
1 changed files with 10 additions and 0 deletions
|
@ -154,6 +154,16 @@ class Util:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return 1, 'Could not execute command: {0}. Error Message: {1}'.format(command, str(e)), ''
|
return 1, 'Could not execute command: {0}. Error Message: {1}'.format(command, str(e)), ''
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def scopy_from_remote(source_path, destination_path, ip):
|
||||||
|
command = 'scp -r root@' + ip + ':' + source_path + ' ' + destination_path
|
||||||
|
process = subprocess.Popen(command, stderr=subprocess.PIPE,stdout=subprocess.PIPE, shell=True)
|
||||||
|
result_code = process.wait()
|
||||||
|
p_out = process.stdout.read().decode("unicode_escape")
|
||||||
|
p_err = process.stderr.read().decode("unicode_escape")
|
||||||
|
|
||||||
|
return result_code, p_out, p_err
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def execute_script(script_path, parameters=None):
|
def execute_script(script_path, parameters=None):
|
||||||
command = []
|
command = []
|
||||||
|
|
Loading…
Reference in a new issue