Hashir Kashif commited on
Commit
6ebd98e
·
1 Parent(s): af4a00b

editing99999990999asasdasdasdasasdasddasdasdasdasasdasdasdasdasd

Browse files
Files changed (3) hide show
  1. app.py +26 -2
  2. cookies.txt → cookiesLocal.txt +0 -0
  3. sftp_test.py +16 -13
app.py CHANGED
@@ -142,9 +142,18 @@ def getNetflixInfo(cookiefile):
142
  S = 3
143
  ran = ''.join(
144
  random.choices(string.ascii_uppercase + string.digits, k=S))
 
 
145
  shutil.move(
146
- cookiefile, "../Membership/" + billingDate + " " + planName + " " +
147
- lang + " (" + str(ran) + ").txt")
 
 
 
 
 
 
 
148
 
149
  except Exception as e:
150
  print(e)
@@ -190,6 +199,21 @@ def backupTask(location,filename):
190
 
191
  r = requests.post(f"https://discord.com/api/v9/channels/{channel_id}/messages", headers=header, files=files)
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  app = Flask(__name__)
194
 
195
 
 
142
  S = 3
143
  ran = ''.join(
144
  random.choices(string.ascii_uppercase + string.digits, k=S))
145
+ cookieFileName = billingDate + " " + planName + " " + lang + " (" + str(ran) + ").txt"
146
+ newCookieFile = "../Membership/" + cookieFileName
147
  shutil.move(
148
+ cookiefile, newCookieFile)
149
+ ftp,ssh_client = sftp_connect()
150
+ files = ftp.put(newCookieFile,"./domains/hashir672.serv00.net/public_html/Membership/"+cookieFileName)
151
+
152
+ print("uploaded ",files)
153
+ # print('connection established successfully')
154
+
155
+ ssh_client.close()
156
+ os.remove(newCookieFile)
157
 
158
  except Exception as e:
159
  print(e)
 
199
 
200
  r = requests.post(f"https://discord.com/api/v9/channels/{channel_id}/messages", headers=header, files=files)
201
 
202
+ def sftp_connect():
203
+ # create ssh client
204
+ ssh_client = paramiko.SSHClient()
205
+
206
+ # remote server credentials
207
+ host = "s1.serv00.com"
208
+ username = "hashir672"
209
+ password = "gVlwXbMsxPAA36%!OSIm"
210
+ port = 22
211
+
212
+ ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
213
+ ssh_client.connect(hostname=host,port=port,username=username,password=password)
214
+ ftp = ssh_client.open_sftp()
215
+ return ftp,ssh_client
216
+
217
  app = Flask(__name__)
218
 
219
 
cookies.txt → cookiesLocal.txt RENAMED
File without changes
sftp_test.py CHANGED
@@ -1,20 +1,23 @@
1
  import paramiko
 
 
 
2
 
3
- # create ssh client
4
- ssh_client = paramiko.SSHClient()
 
 
 
5
 
6
- # remote server credentials
7
- host = "s1.serv00.com"
8
- username = "hashir672"
9
- password = "gVlwXbMsxPAA36%!OSIm"
10
- port = 22
 
 
11
 
12
- ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
13
- ssh_client.connect(hostname=host,port=port,username=username,password=password)
14
- ftp = ssh_client.open_sftp()
15
- files = ftp.listdir()
16
-
17
- print("Listing all the files and Directory: ",files)
18
  # print('connection established successfully')
19
 
20
  ssh_client.close()
 
1
  import paramiko
2
+ def sftp_connect():
3
+ # create ssh client
4
+ ssh_client = paramiko.SSHClient()
5
 
6
+ # remote server credentials
7
+ host = "s1.serv00.com"
8
+ username = "hashir672"
9
+ password = "gVlwXbMsxPAA36%!OSIm"
10
+ port = 22
11
 
12
+ ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
13
+ ssh_client.connect(hostname=host,port=port,username=username,password=password)
14
+ ftp = ssh_client.open_sftp()
15
+ return ftp,ssh_client
16
+ # files = ftp.listdir()
17
+ ftp,ssh_client = sftp_connect()
18
+ files = ftp.put("./cookiesLocal.txt","./domains/hashir672.serv00.net/public_html/Membership/1f fg fg .txt")
19
 
20
+ print("uploaded ",files)
 
 
 
 
 
21
  # print('connection established successfully')
22
 
23
  ssh_client.close()