-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpatchupload.py
56 lines (45 loc) · 1.73 KB
/
patchupload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import paramiko
from config import CONFIG
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(CONFIG.server, username=CONFIG.username)
# ssh.connect(CONFIG.server, username='root', password='threatquotientthreatquotient')
# use shell for running the script to make-object-set
channel = ssh.invoke_shell()
# patch = 'tqAdversaryReader-3.1.2-py2-none-any.whl'
# patch = 'solr.patch'
# patch = 'tie-threatq_backup_4.9.0_2018-09-22.tgz'
# patch = 'LdapTest.php'
# patch = 'RepairTrimmedAttributes.php'
# patch = 'object-attribute-dedup.patch'
# patch = 'te-18233-01.patch'
# patch = 'te-18588-int-to-bigint-01.diff'
# ptach = 'AddObjectRelations.php'
# php artisan threatq:add-object-relations in /var/api/src/Console/Command/Utilities/
# patch = 'te-18588-01.diff'
# patch = '0001-TE-18533-DEV-remove-relational_ids_json-field.patch'
# patch = 'te-18588-solr-ids-long-fix-01.patch'
# patch = 'te-19309-tq_op_active_directory-1.0.0-py3-none-any.whl'
# patch = 'threatq.min.js'
# patch = 'notificationGenerator.py'
# patch = 'te-21020.patch'
# patch = "0001_TE-21154_DEV_add_ldap_logging.patch"
# patch = 'TE-21254_object_audit_artisan_command_and_script.patch'
patch = 'STE_duplicate_indicator_audit.patch'
tmp = '/tmp/%s' % patch
remotepath = '/var/www/api/%s' % patch
localfile = './files/patch/%s' % patch
def install_patch():
# copy files up to server
ftp_client = ssh.open_sftp()
ftp_client.put(localfile, tmp)
ftp_client.close()
# copy file to dir
tmpfile = '/tmp/%s' % patch
cmd = 'sudo cp %s %s' % (tmpfile, remotepath)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd)
print (cmd)
print (' ')
ftp_client.close()
install_patch()