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("--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-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): | ||||
|  | ||||
| @ -103,10 +103,12 @@ class Tftpd(object): | ||||
|         self.srv = TftpServer.TftpServer("/", self._ls) | ||||
|         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; | ||||
|         # append tftp-ipa check at bottom and throw TftpException if not match | ||||
|         Daemon(self.srv.listen, "tftp", [self.ip, self.port], ka={"ports": ports}) | ||||
| 
 | ||||
|     def nlog(self, msg: str, c: Union[int, str] = 0) -> None: | ||||
|         self.log("tftp", msg, c) | ||||
| @ -122,7 +124,7 @@ class Tftpd(object): | ||||
|         vfs, rem = self.asrv.vfs.get(vpath, "*", *perms) | ||||
|         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 | ||||
|         return None | ||||
| 
 | ||||
|  | ||||
| @ -48,7 +48,7 @@ thumbnails2 = ["pyvips"] | ||||
| audiotags = ["mutagen"] | ||||
| ftpd = ["pyftpdlib"] | ||||
| ftps = ["pyftpdlib", "pyopenssl"] | ||||
| tftpd = ["partftpy"] | ||||
| tftpd = ["partftpy>=0.2.0"] | ||||
| pwhash = ["argon2-cffi"] | ||||
| 
 | ||||
| [project.scripts] | ||||
|  | ||||
| @ -225,9 +225,9 @@ necho() { | ||||
| 	mv pyftpdlib ftp/ | ||||
| 
 | ||||
| 	necho collecting partftpy | ||||
| 	f="../build/partftpy-0.1.0.tar.gz" | ||||
| 	f="../build/partftpy-0.2.0.tar.gz" | ||||
| 	[ -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) | ||||
| 
 | ||||
| 	tar -zxf $f | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ed
						ed