File Download to Server Remotely Ubuntu (16)
Yes, I have prepared a few scripts for downloading remote files to the server, but we will only use ubuntu 16 for the time being.
In this system, we will install the server for the client at first, then we will download or delete the file to the server by running our code from our phone or computer. And the latest server IP address by going to the browser we want to download the file with simple injection Server (SIS).
Setup :
Connect to the server from the terminal and give the following command:
1 | wget http://gecemor.qpython.club/oto-kur-dl.py |
and run
1 | python oto-kur-dl.py |
The code will ask you for a port number to communicate with the server, you will specify a port in your head, and then the installation is completed immediately.
Download or Delete Files:
After completing the first steps, you will run the following script from your device, but don’t forget to write the IP number of your server and the port number you set in the installation!
When you run the code you will see 2 options 1 – download, 2 – Delete…
If you want to download files, you must have copied the direct link you want to download before you run the script. If you want to delete the files already installed on the server will be listed and you will be able to delete them by choosing from.
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #-*-coding:utf8;-*- import socket import platform import sys server_host = '123.456.789.101' server_port = 8080 url = "http://nfhost.net/~qpython/test.rar" if __name__ == '__main__' : server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) soru = raw_input(" 1- Download\n" " 2- Delete\n" " 0- Exit\n" "Opensourceprojects.org Choose: ") if soru == "1": if sys.platform.startswith('linux'): import androidhelper droid=androidhelper.Android() pano=droid.getClipboard().result else: from Tkinter import * import ttk root=Tk() root.title("URL Please") root.resizable(width=FALSE, height=FALSE) pgen = 500 pyuks = 100 ekrangen = root.winfo_screenwidth() x = (ekrangen - pgen) / 2 root.geometry("%dx%d+%d+%d"%(pgen, pyuks, x, 200)) def clp(event=None): global pano pano = entry.get() root.destroy() entry = Entry(root, width=80) entry.pack(pady=15) ttk.Style().configure("prk.TButton", padding=6, relief="flat", background="#EBE6E6", foreground="#347D2B", font=("DejaVuSans", 11, "bold")) tara = ttk.Button(root, text="Tamam", style='prk.TButton', command=clp, width=22) tara.pack() entry.insert(0, root.clipboard_get()) root.bind("<Return>", clp) mainloop() raw_input("Link:\n"+pano+" Enter for continue…") try : server.connect((server_host, server_port)) server.sendall('dl '+pano) print 'please wait..' exitValue = server.recv(8192) if (exitValue == '0') : print 'Done.' else : print 'Nope, didnt work.' except Exception as e: print e server.close() elif soru == "2": try : server.connect((server_host, server_port)) server.sendall('delete') print server.recv(8192) secim = raw_input("choose: ") server.sendall(choose) print server.recv(8192) except Exception as e: print e server.close() else: pass |
I also want to appear, downloading to the server does not require any Internet package. Whether or not it is…