PikoAi 0.1.10__py3-none-any.whl → 0.1.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Env/python_executor.py +1 -1
- Env/shell.py +20 -9
- Tools/tool_manager.py +3 -3
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/METADATA +1 -1
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/RECORD +9 -9
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/WHEEL +0 -0
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/entry_points.txt +0 -0
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/licenses/LICENSE +0 -0
- {pikoai-0.1.10.dist-info → pikoai-0.1.12.dist-info}/top_level.txt +0 -0
Env/python_executor.py
CHANGED
Env/shell.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import subprocess
|
2
2
|
import time
|
3
3
|
import sys
|
4
|
-
from
|
4
|
+
from .base_env import BaseEnv
|
5
5
|
import re
|
6
6
|
|
7
7
|
class ShellExecutor(BaseEnv):
|
@@ -78,15 +78,26 @@ class ShellExecutor(BaseEnv):
|
|
78
78
|
'output': 'Blocked potentially harmful command.',
|
79
79
|
'error': f'Command matches forbidden pattern: {pattern}'
|
80
80
|
}
|
81
|
-
#
|
81
|
+
# Improved check for sensitive directory access
|
82
82
|
for sensitive_dir in sensitive_dirs:
|
83
|
-
# Only block if the command is trying to directly
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
# Only block if the command is trying to directly operate on the sensitive dir itself (not subpaths)
|
84
|
+
# For '/', block only if the command is exactly '/' or has a space and then '/'
|
85
|
+
if sensitive_dir == '/':
|
86
|
+
if re.search(r'(\s|^)/($|\s)', code_or_command):
|
87
|
+
return {
|
88
|
+
'success': False,
|
89
|
+
'output': f'Blocked access to sensitive directory: {sensitive_dir}',
|
90
|
+
'error': f'Attempted access to sensitive directory: {sensitive_dir}'
|
91
|
+
}
|
92
|
+
else:
|
93
|
+
# Block if the command is operating on the directory itself, not a subpath (e.g., 'ls /root' but not 'ls /root/somefile')
|
94
|
+
pattern = rf'(\s|^)({re.escape(sensitive_dir)})(\s|$)'
|
95
|
+
if re.search(pattern, code_or_command, re.IGNORECASE):
|
96
|
+
return {
|
97
|
+
'success': False,
|
98
|
+
'output': f'Blocked access to sensitive directory: {sensitive_dir}',
|
99
|
+
'error': f'Attempted access to sensitive directory: {sensitive_dir}'
|
100
|
+
}
|
90
101
|
|
91
102
|
# Execute the command in a subprocess
|
92
103
|
self.process = subprocess.Popen(
|
Tools/tool_manager.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import sys
|
2
2
|
import os
|
3
3
|
import json
|
4
|
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '
|
4
|
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
|
5
5
|
from Tools.web_loader import load_data
|
6
6
|
from Tools.web_search import web_search
|
7
7
|
from Tools.file_task import file_reader, file_maker, file_writer, directory_maker
|
8
8
|
from Tools.system_details import get_os_details, get_datetime, get_memory_usage, get_cpu_info
|
9
9
|
from Tools.userinp import get_user_input
|
10
|
-
from
|
11
|
-
from
|
10
|
+
from Env.python_executor import PythonExecutor
|
11
|
+
from Env.shell import ShellExecutor
|
12
12
|
|
13
13
|
#need to transform it into map of dictionary
|
14
14
|
#name : [function : xyz,description : blah bah]
|
@@ -9,8 +9,8 @@ Env/base_env.py,sha256=K4PoWwPXn3pKeu7_-JOlUuyNbyYQ9itMhQybFOm-3K4,1563
|
|
9
9
|
Env/base_executor.py,sha256=awTwJ44CKWV4JO2KUHfHDX0p1Ujw55hlaL5oNYTEW9M,893
|
10
10
|
Env/env.py,sha256=I3lOoyBJR5QNq3tWk_HVH6ncRx1vnilRYmj7b7h4jic,114
|
11
11
|
Env/js_executor.py,sha256=tEAg5ho8Pa8LzxUbS1Idau8XuJWZZqPiNlvFPDwGkgc,2690
|
12
|
-
Env/python_executor.py,sha256=
|
13
|
-
Env/shell.py,sha256=
|
12
|
+
Env/python_executor.py,sha256=1PIWL3Q8cgkQ4tvarf3d75dUTZoMF_dx_HoDho_zPEQ,4811
|
13
|
+
Env/shell.py,sha256=kcWwaJwA2rbKqViAkRPTHaCKIGht9Yhjf2p4S57dHTs,8060
|
14
14
|
Env/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
Env/tests/test_python_executor.py,sha256=5kfs0cOf-RgWTOers_1wB0yvYSF-HrHPsraJ-PxgR50,3156
|
16
16
|
Env/tests/test_shell_executor.py,sha256=-RcCdSUMoRAXHISIh0IR5MCutco80fX2S3sQBcinc_Q,1034
|
@@ -18,7 +18,7 @@ Tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
Tools/file_task.py,sha256=VUhWq_G-SWvGahQo8PG7TOpElHUW3BGLUabrTdJS89o,12151
|
19
19
|
Tools/system_details.py,sha256=7-mTm3CG4NoatHcvcosalEgEcpWlNsCsZ7kuS3y_EmY,2262
|
20
20
|
Tools/tool_dir.json,sha256=pEqI-1rKud-VEWHYLF2Pbv6xwQZWy62HUF_1hjcdhCY,3128
|
21
|
-
Tools/tool_manager.py,sha256=
|
21
|
+
Tools/tool_manager.py,sha256=86qwREw5an12dweIGCS1NNgINwHikyTxUpbjPWoLbt0,4118
|
22
22
|
Tools/userinp.py,sha256=vUhEj3y1W1_ZFHqo2xQwvqDyeOg3VsisSKTI0EurUH8,1205
|
23
23
|
Tools/web_loader.py,sha256=PyZk2g7WngZT0tCLs9Danx20dYspnaZwy4rlVE9Sx_4,5054
|
24
24
|
Tools/web_search.py,sha256=4EGq1VZqfDgG-_yXTd4_Ha1iEUcR-szdlgRV7oFPru4,1259
|
@@ -27,9 +27,9 @@ Utils/executor_utils.py,sha256=WwK3TKgw_hG_crg7ijRaqfidYnnNXYbbs37vKZRYK-0,491
|
|
27
27
|
Utils/ter_interface.py,sha256=Zay9mwyAyKYTNQAKOWXHAa3upo9TWprSf26STiHXk0g,6255
|
28
28
|
llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
llm_interface/llm.py,sha256=tI_KDOW14QLWowA7bB3GPe2qjlk0sjS5fBavs9XD1fo,5185
|
30
|
-
pikoai-0.1.
|
31
|
-
pikoai-0.1.
|
32
|
-
pikoai-0.1.
|
33
|
-
pikoai-0.1.
|
34
|
-
pikoai-0.1.
|
35
|
-
pikoai-0.1.
|
30
|
+
pikoai-0.1.12.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
|
31
|
+
pikoai-0.1.12.dist-info/METADATA,sha256=4wGQkBNIjYCR9di2BrQ4Jwj1k8lQogqnE8JPmua-uCo,2962
|
32
|
+
pikoai-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
33
|
+
pikoai-0.1.12.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
|
34
|
+
pikoai-0.1.12.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
|
35
|
+
pikoai-0.1.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|