| 214 | return False |
| 215 | |
| 216 | def makeOnionAndKey(self): |
| 217 | res = self.request("ADD_ONION NEW:RSA1024 port=%s" % self.fileserver_port) |
| 218 | match = re.search("ServiceID=([A-Za-z0-9]+).*PrivateKey=RSA1024:(.*?)[\r\n]", res, re.DOTALL) |
| 219 | if match: |
| 220 | onion_address, onion_privatekey = match.groups() |
| 221 | return (onion_address, onion_privatekey) |
| 222 | else: |
| 223 | self.setStatus("AddOnion error (%s)" % res) |
| 224 | self.log.error("Tor addOnion error: %s" % res) |
| 225 | return False |
| 226 | |
| 227 | def delOnion(self, address): |
| 228 | res = self.request("DEL_ONION %s" % address) |