@@ -33,10 +33,11 @@ def __init__(self, user_id):
3333 self .agent_file = "iast-agent.jar"
3434 self .original_agent_path = f'/tmp/iast_cache/package'
3535 self .original_agent_file = f'/tmp/iast_cache/package/{ self .agent_file } '
36- self .target_path = f'/tmp/{ os .getpid ()} -{ t .ident } -{ user_id } '
36+ self .user_target_path = f'/tmp/{ os .getpid ()} -{ t .ident } -{ user_id } '
37+ self .target_path = f'/tmp/{ os .getpid ()} -{ t .ident } -{ user_id } /iast_cache/package'
3738 self .remote_agent_file = BUCKET_NAME_BASE_URL + 'java/iast-agent.jar'
38- if not os .path .exists (f"{ self .target_path } /iast_cache/package " ):
39- os .makedirs (f"{ self .target_path } /iast_cache/package " )
39+ if not os .path .exists (f"{ self .target_path } " ):
40+ os .makedirs (f"{ self .target_path } " )
4041 if not os .path .exists (self .original_agent_path ):
4142 os .makedirs (self .original_agent_path )
4243
@@ -50,12 +51,12 @@ def download_agent(self):
5051
5152 def create_config (self , base_url , agent_token , auth_token , project_name ):
5253 try :
53- user_file = f"{ self .target_path } /iast_cache/package/ { self .agent_file } "
54+ user_file = f"{ self .target_path } /{ self .agent_file } "
5455 if not os .path .exists (user_file ):
5556 shutil .copyfile (self .original_agent_file , user_file )
5657
5758 data = "iast.response.name=DongTai Iast\n iast.server.url={url}\n iast.server.token={token}\n iast.allhook.enable=false\n iast.dump.class.enable=false\n iast.dump.class.path=/tmp/iast-class-dump/\n iast.service.report.interval=30000\n app.name=DongTai\n engine.status=start\n engine.name={agent_token}\n jdk.version={jdk_level}\n project.name={project_name}\n iast.proxy.enable=false\n iast.proxy.host=\n iast.proxy.port=\n iast.server.mode=local\n "
58- with open (f'{ self .target_path } /iast.properties' , 'w' ) as config_file :
59+ with open (f'{ self .user_target_path } /iast.properties' , 'w' ) as config_file :
5960 config_file .write (
6061 data .format (url = base_url , token = auth_token , agent_token = agent_token , jdk_level = 1 ,
6162 project_name = project_name )
@@ -66,10 +67,10 @@ def create_config(self, base_url, agent_token, auth_token, project_name):
6667 return False
6768
6869 def replace_config (self ):
69- user_file = f"{ self .target_path } /iast_cache/package/ { self .agent_file } "
70+ user_file = f"{ self .target_path } /{ self .agent_file } "
7071 # 执行jar -uvf {JavaAgentDownload.LOCAL_AGENT_FILE} iast.properties更新jar包的文件
7172 import os
72- os .system (f'cd { self .target_path } ;jar -uvf { user_file } iast.properties' )
73+ os .system (f'cd { self .user_target_path } ;jar -uvf { user_file } iast.properties' )
7374
7475
7576class PythonAgentDownload ():
0 commit comments