blob: b18c1d1f0bd5ac3345cde9ec95b4a2a0d1e9d0ec (
plain)
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
|
FTP Share with Python on Windows
################################
:date: 2012-03-06 14:34
:tags: ftp,python,windows
Installation of dependencies
============================
.. code-block:: bat
#! cmd.exe
wget http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi
msiexec python-2.7.2.msi
# get easy_install
wget
http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe
.\setuptools-0.6.c11.win32-py2.7.exe
cd c:\Python27\Scripts
easy_install pywin32
easy_install pyftpdlib
anon_serv.py
============
in addition to serve anonymous ftp, the current hostname is copied to the
clipboard share it via instant-messenger.
.. code-block:: python
#!/usr/bin/python
import socket
fullhn=socket.getfqdn()
print ("My Hostname: %s" % fullhn )
import win32clipboard as w
import win32con
w.OpenClipboard()
w.EmptyClipboard()
w.SetClipboardData(win32con.CF_TEXT,fullhn)
w.CloseClipboard()
from pyftpdlib import ftpserver
authorizer = ftpserver.DummyAuthorizer()
authorizer.add_anonymous("C:\\\\ftp",perm="elradfmw")
handler = ftpserver.FTPHandler
handler.authorizer = authorizer
address = ("0.0.0.0", 21)
ftpd = ftpserver.FTPServer(address, handler)
ftpd.serve_forever()
|