예제 #1
0
	def SSLLocalCertPath(self, remoteServerHost, remoteServerPort):
		return configFile.makeConfigFilePathName("%s-%d.pem" % (remoteServerHost, remoteServerPort))
예제 #2
0
	def getConfigfileFilePath(self):
		return configFile.makeConfigFilePathName("pacDomainConfig.json")
예제 #3
0
			self.server.addCallback(symmetryConnectServerHandler._setConnect,self, sock, address)
		except:
			log.log(3)
			self.server.addCallback(self.onClose)
	def getSymmetryConnect(self, symmetryConnectId):
		symmetryConnect = symmetryConnectServerHandler.getSymmetryConnect(self, symmetryConnectId)
		if not symmetryConnect and self.authPass:
			symmetryConnect = realServerConnect(self.server)
			self.addSymmetryConnect(symmetryConnect, symmetryConnectId)
		return symmetryConnect
		
	def onServerToServerMessage(self, serverMessage):
		opt = serverMessage["opt"]
		if opt == "auth":
			timenum = serverMessage["time"]
			if time.time()-1800 < timenum and time.time()+1800 > timenum and self.authMake(remoteAuth, timenum)["password"] == serverMessage["password"]:
				self.authPass = True
				self.sendData(symmetryConnectServerHandler.serverToServerJsonMessageConnectId, json.dumps({"opt":"auth","status":"ok"}))
			else:
				log.log(2,"auth failed",serverMessage,self.authMake(remoteAuth, timenum))
				self.close()
	def onClose(self):
		symmetryConnectServerHandler.onClose(self)
SSLCertPath = configFile.makeConfigFilePathName("dddproxy.remote.cert")
SSLKeyPath = configFile.makeConfigFilePathName("dddproxy.remote.key")
def createSSLCert():
	if not os.path.exists(SSLCertPath) or not os.path.exists(SSLCertPath):
		shell = "openssl req -new -newkey rsa:1024 -days 3650 -nodes -x509 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=ddd\" -keyout %s  -out %s"%(
																							SSLKeyPath,SSLCertPath)
		os.system(shell)
	
예제 #4
0
 def getConfigfileFilePath(self):
     return configFile.makeConfigFilePathName("setting.json")
예제 #5
0
                self.authPass = True
                self.sendData(
                    symmetryConnectServerHandler.
                    serverToServerJsonMessageConnectId,
                    json.dumps({
                        "opt": "auth",
                        "status": "ok"
                    }))
                self.sendPingSpeedResponse()
            else:
                log.log(2, "auth failed", serverMessage,
                        self.authMake(remoteAuth, timenum))
                self.close()
        else:
            symmetryConnectServerHandler.onServerToServerMessage(
                self, serverMessage)

    def onClose(self):
        symmetryConnectServerHandler.onClose(self)


SSLCertPath = configFile.makeConfigFilePathName("dddproxy.remote.cert")
SSLKeyPath = configFile.makeConfigFilePathName("dddproxy.remote.key")


def createSSLCert():
    if not os.path.exists(SSLCertPath) or not os.path.exists(SSLCertPath):
        shell = "openssl req -new -newkey rsa:1024 -days 3650 -nodes -x509 -subj \"/C=US/ST=Denial/L=Springfield/O=Dis/CN=ddd\" -keyout %s  -out %s" % (
            SSLKeyPath, SSLCertPath)
        os.system(shell)
예제 #6
0
	def SSLLocalCertPath(self, remoteServerHost, remoteServerPort):
		return configFile.makeConfigFilePathName("%s-%d.pem" % (remoteServerHost, remoteServerPort))
예제 #7
0
	def getConfigfileFilePath(self):
		return configFile.makeConfigFilePathName("pacDomainConfig.json")
예제 #8
0
	def getConfigfileFilePath(self):
		return configFile.makeConfigFilePathName("setting.json")
예제 #9
0
		site = self.get(fromIp,domain,timeMark)
		setattr(site, type, getattr(site, type)+val)
		site.lastTime = time.time()
		site.mergeTimes+=1
	def pop(self):
		minSite = None
		minTime = 0;
		current = time.time() - 10
		for s in self.siteList:
			if (minSite is None or minTime>s.lastTime) and s.lastTime < current:
				minSite = s
				minTime = s.lastTime
		if minSite:
			self.siteList.remove(minSite)
		return minSite;
domainAnalysisConfig = configFile.makeConfigFilePathName("domainAnalysisConfig.json")
class domainAnalysisType:
	connect = "connect"
	incoming = "incoming"
	outgoing = "outgoing"
	

class domainAnalysis():
	def __init__(self):
		self.domainAnalysisCache = analysisSiteList()
		self.domainAnalysis = autoDataObject()
		try:
			fp = file(domainAnalysisConfig,"r")
			data = json.load(fp,object_hook = autoDataObject)
			for k,v in data.items():
				self.domainAnalysis[int(k)] = v
예제 #10
0
		site = self.get(fromIp,domain,timeMark)
		setattr(site, type, getattr(site, type)+val)
		site.lastTime = time.time()
		site.mergeTimes+=1
	def pop(self):
		minSite = None
		minTime = 0;
		current = time.time() - 10
		for s in self.siteList:
			if (minSite is None or minTime>s.lastTime) and s.lastTime < current:
				minSite = s
				minTime = s.lastTime
		if minSite:
			self.siteList.remove(minSite)
		return minSite;
domainAnalysisConfig = configFile.makeConfigFilePathName("domainAnalysisConfig.json")
class domainAnalysisType:
	connect = "connect"
	incoming = "incoming"
	outgoing = "outgoing"
	

class domainAnalysis():
	def __init__(self):
		self.domainAnalysisCache = analysisSiteList()
		self.domainAnalysis = autoDataObject()
		try:
			fp = file(domainAnalysisConfig,"r")
			data = json.load(fp,object_hook = autoDataObject)
			for k,v in data.items():
				self.domainAnalysis[int(k)] = v