mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add --tftp-pr
to specify portrange instead of ephemerals
This commit is contained in:
parent
d636316a19
commit
8796c09f56
|
@ -1020,6 +1020,7 @@ def add_tftp(ap):
|
||||||
ap2.add_argument("--tftpv", action="store_true", help="verbose")
|
ap2.add_argument("--tftpv", action="store_true", help="verbose")
|
||||||
ap2.add_argument("--tftpvv", action="store_true", help="verboser")
|
ap2.add_argument("--tftpvv", action="store_true", help="verboser")
|
||||||
ap2.add_argument("--tftp-ipa", metavar="PFX", type=u, default="", help="only accept connections from IP-addresses starting with \033[33mPFX\033[0m; specify [\033[32many\033[0m] to disable inheriting \033[33m--ipa\033[0m. Example: [\033[32m127., 10.89., 192.168.\033[0m]")
|
ap2.add_argument("--tftp-ipa", metavar="PFX", type=u, default="", help="only accept connections from IP-addresses starting with \033[33mPFX\033[0m; specify [\033[32many\033[0m] to disable inheriting \033[33m--ipa\033[0m. Example: [\033[32m127., 10.89., 192.168.\033[0m]")
|
||||||
|
ap2.add_argument("--tftp-pr", metavar="P-P", type=u, help="the range of UDP ports to use for data transfer, for example \033[32m12000-13000")
|
||||||
|
|
||||||
|
|
||||||
def add_smb(ap):
|
def add_smb(ap):
|
||||||
|
|
|
@ -103,10 +103,12 @@ class Tftpd(object):
|
||||||
self.srv = TftpServer.TftpServer("/", self._ls)
|
self.srv = TftpServer.TftpServer("/", self._ls)
|
||||||
self.stop = self.srv.stop
|
self.stop = self.srv.stop
|
||||||
|
|
||||||
Daemon(self.srv.listen, "tftp", [self.ip, self.port])
|
ports = []
|
||||||
|
if self.args.tftp_pr:
|
||||||
|
p1, p2 = [int(x) for x in self.args.tftp_pr.split("-")]
|
||||||
|
ports = list(range(p1, p2 + 1))
|
||||||
|
|
||||||
# XXX TODO hook TftpContextServer.start;
|
Daemon(self.srv.listen, "tftp", [self.ip, self.port], ka={"ports": ports})
|
||||||
# append tftp-ipa check at bottom and throw TftpException if not match
|
|
||||||
|
|
||||||
def nlog(self, msg: str, c: Union[int, str] = 0) -> None:
|
def nlog(self, msg: str, c: Union[int, str] = 0) -> None:
|
||||||
self.log("tftp", msg, c)
|
self.log("tftp", msg, c)
|
||||||
|
@ -122,7 +124,7 @@ class Tftpd(object):
|
||||||
vfs, rem = self.asrv.vfs.get(vpath, "*", *perms)
|
vfs, rem = self.asrv.vfs.get(vpath, "*", *perms)
|
||||||
return vfs, vfs.canonical(rem)
|
return vfs, vfs.canonical(rem)
|
||||||
|
|
||||||
def _ls(self, vpath: str) -> Any:
|
def _ls(self, vpath: str, raddress: str, rport: int) -> Any:
|
||||||
# generate file listing if vpath is dir.txt and return as file object
|
# generate file listing if vpath is dir.txt and return as file object
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ thumbnails2 = ["pyvips"]
|
||||||
audiotags = ["mutagen"]
|
audiotags = ["mutagen"]
|
||||||
ftpd = ["pyftpdlib"]
|
ftpd = ["pyftpdlib"]
|
||||||
ftps = ["pyftpdlib", "pyopenssl"]
|
ftps = ["pyftpdlib", "pyopenssl"]
|
||||||
tftpd = ["partftpy"]
|
tftpd = ["partftpy>=0.2.0"]
|
||||||
pwhash = ["argon2-cffi"]
|
pwhash = ["argon2-cffi"]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
|
|
@ -225,9 +225,9 @@ necho() {
|
||||||
mv pyftpdlib ftp/
|
mv pyftpdlib ftp/
|
||||||
|
|
||||||
necho collecting partftpy
|
necho collecting partftpy
|
||||||
f="../build/partftpy-0.1.0.tar.gz"
|
f="../build/partftpy-0.2.0.tar.gz"
|
||||||
[ -e "$f" ] ||
|
[ -e "$f" ] ||
|
||||||
(url=https://files.pythonhosted.org/packages/55/25/e043193fb3d941b91fc84a55e0560b1c248f3f04d73747eb4f35f5e2776e/partftpy-0.1.0.tar.gz;
|
(url=https://files.pythonhosted.org/packages/64/4a/360dde1e7277758a4ccb0d6434ec661042d9d745aa6c3baa9ec0699df3e9/partftpy-0.2.0.tar.gz;
|
||||||
wget -O$f "$url" || curl -L "$url" >$f)
|
wget -O$f "$url" || curl -L "$url" >$f)
|
||||||
|
|
||||||
tar -zxf $f
|
tar -zxf $f
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -140,7 +140,7 @@ args = {
|
||||||
"audiotags": ["mutagen"],
|
"audiotags": ["mutagen"],
|
||||||
"ftpd": ["pyftpdlib"],
|
"ftpd": ["pyftpdlib"],
|
||||||
"ftps": ["pyftpdlib", "pyopenssl"],
|
"ftps": ["pyftpdlib", "pyopenssl"],
|
||||||
"tftpd": ["partftpy"],
|
"tftpd": ["partftpy>=0.2.0"],
|
||||||
"pwhash": ["argon2-cffi"],
|
"pwhash": ["argon2-cffi"],
|
||||||
},
|
},
|
||||||
"entry_points": {"console_scripts": ["copyparty = copyparty.__main__:main"]},
|
"entry_points": {"console_scripts": ["copyparty = copyparty.__main__:main"]},
|
||||||
|
|
Loading…
Reference in a new issue