iFurySt commited on
Commit
ef8d53e
·
verified ·
1 Parent(s): c65fbec

Upload AgentBench os-std datasets

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. os_interaction/data/1/stock.json +156 -0
  2. os_interaction/data/2/environment.json +89 -0
  3. os_interaction/data/3/ac.json +100 -0
  4. os_interaction/data/4/N11.json +20 -0
  5. os_interaction/data/4/N225.json +20 -0
  6. os_interaction/data/4/N37.json +18 -0
  7. os_interaction/data/4/N4.json +11 -0
  8. os_interaction/data/4/N41.json +46 -0
  9. os_interaction/data/4/Q09.json +22 -0
  10. os_interaction/data/4/Q19.json +22 -0
  11. os_interaction/data/4/Q30.json +122 -0
  12. os_interaction/data/4/Q47.json +30 -0
  13. os_interaction/data/4/Q49.json +30 -0
  14. os_interaction/data/5/new.json +202 -0
  15. os_interaction/data/6-backup.json +147 -0
  16. os_interaction/data/6/new.json +151 -0
  17. os_interaction/data/7/bootstrap.json +0 -0
  18. os_interaction/data/dev.json +453 -0
  19. os_interaction/scripts/1/check/1.sh +28 -0
  20. os_interaction/scripts/1/check/containing.py +12 -0
  21. os_interaction/scripts/1/check/in.py +12 -0
  22. os_interaction/scripts/1/check/integer-match.py +3 -0
  23. os_interaction/scripts/1/check/size-match.py +26 -0
  24. os_interaction/scripts/1/check/string-match.py +8 -0
  25. os_interaction/scripts/1/example/1.sh +22 -0
  26. os_interaction/scripts/1/init/gen_words.sh +11 -0
  27. os_interaction/scripts/1/init/install_nettools.sh +3 -0
  28. os_interaction/scripts/1/init/nested_folders.sh +27 -0
  29. os_interaction/scripts/1/init/stock-log.sh +18 -0
  30. os_interaction/scripts/2/check/1.sh +28 -0
  31. os_interaction/scripts/2/check/containing.py +12 -0
  32. os_interaction/scripts/2/check/in.py +12 -0
  33. os_interaction/scripts/2/check/integer-match.py +3 -0
  34. os_interaction/scripts/2/check/size-match.py +26 -0
  35. os_interaction/scripts/2/check/string-match.py +8 -0
  36. os_interaction/scripts/2/example/1.sh +22 -0
  37. os_interaction/scripts/2/init/gen_words.sh +11 -0
  38. os_interaction/scripts/2/init/install_nettools.sh +3 -0
  39. os_interaction/scripts/2/init/nested_folders.sh +27 -0
  40. os_interaction/scripts/2/init/stock-log.sh +18 -0
  41. os_interaction/scripts/3/check/1.sh +28 -0
  42. os_interaction/scripts/3/check/containing.py +12 -0
  43. os_interaction/scripts/3/check/in.py +12 -0
  44. os_interaction/scripts/3/check/integer-match.py +3 -0
  45. os_interaction/scripts/3/check/size-match.py +26 -0
  46. os_interaction/scripts/3/check/string-match.py +8 -0
  47. os_interaction/scripts/3/example/1.sh +22 -0
  48. os_interaction/scripts/3/init/gen_words.sh +11 -0
  49. os_interaction/scripts/3/init/install_nettools.sh +3 -0
  50. os_interaction/scripts/3/init/nested_folders.sh +27 -0
os_interaction/data/1/stock.json ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Tell me how many times Alice sold a stock.",
4
+ "create": {
5
+ "local": "default",
6
+ "init": {
7
+ "file": "init/stock-log.sh"
8
+ }
9
+ },
10
+ "evaluation": {
11
+ "check": [
12
+ null,
13
+ {
14
+ "language": "python",
15
+ "file": "check/integer-match.py"
16
+ }
17
+ ],
18
+ "example": {
19
+ "code": "grep \"Alice | Sell\" /usr/stock.log | wc -l"
20
+ }
21
+ },
22
+ "labels": ["log", "file"]
23
+ },
24
+ {
25
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Tell me how many times Bob bought a stock.",
26
+ "create": {
27
+ "local": "default",
28
+ "init": {
29
+ "file": "init/stock-log.sh"
30
+ }
31
+ },
32
+ "evaluation": {
33
+ "check": [
34
+ null,
35
+ {
36
+ "language": "python",
37
+ "file": "check/integer-match.py"
38
+ }
39
+ ],
40
+ "example": {
41
+ "code": "grep \"Bob | Purchase\" /usr/stock.log | wc -l"
42
+ }
43
+ },
44
+ "labels": ["log", "file"]
45
+ },
46
+ {
47
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please count the total number of stocks that Alice bought, and tell me the number.",
48
+ "create": {
49
+ "local": "default",
50
+ "init": {
51
+ "file": "init/stock-log.sh"
52
+ }
53
+ },
54
+ "evaluation": {
55
+ "check": [
56
+ null,
57
+ {
58
+ "language": "python",
59
+ "file": "check/integer-match.py"
60
+ }
61
+ ],
62
+ "example": {
63
+ "code": "grep \"Alice | Purchase\" /usr/stock.log | awk -F '|' '{sum += $NF} END {print sum}'"
64
+ }
65
+ },
66
+ "labels": ["log", "file"]
67
+ },
68
+ {
69
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please determine the number of types of stocks Bob sold. And tell me the answer.",
70
+ "create": {
71
+ "local": "default",
72
+ "init": {
73
+ "file": "init/stock-log.sh"
74
+ }
75
+ },
76
+ "evaluation": {
77
+ "check": [
78
+ null,
79
+ {
80
+ "language": "python",
81
+ "file": "check/integer-match.py"
82
+ }
83
+ ],
84
+ "example": {
85
+ "code": "grep \"Bob | Sell\" /usr/stock.log | awk -F '|' '{print $3}' | sort -u | wc -l"
86
+ }
87
+ },
88
+ "labels": ["log", "file"]
89
+ },
90
+ {
91
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please count the number of types of stocks that Bob sold but never bought. And tell me the answer.",
92
+ "create": {
93
+ "local": "default",
94
+ "init": {
95
+ "file": "init/stock-log.sh"
96
+ }
97
+ },
98
+ "evaluation": {
99
+ "check": [
100
+ null,
101
+ {
102
+ "language": "python",
103
+ "file": "check/integer-match.py"
104
+ }
105
+ ],
106
+ "example": {
107
+ "code": "grep \"Bob | Sell\" /usr/stock.log | awk -F '|' '{print $3}' | sort | uniq > bob_sold.txt; grep \"Bob | Purchase\" /usr/stock.log | awk -F '|' '{print $3}' | sort | uniq > bob_bought.txt; comm -23 bob_sold.txt bob_bought.txt | wc -l; rm bob_sold.txt bob_bought.txt"
108
+ }
109
+ },
110
+ "labels": ["log", "file"]
111
+ },
112
+ {
113
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Identify the most active traders (buyers/sellers) based on the count of their transactions.",
114
+ "create": {
115
+ "local": "default",
116
+ "init": {
117
+ "file": "init/stock-log.sh"
118
+ }
119
+ },
120
+ "evaluation": {
121
+ "check": [
122
+ null,
123
+ {
124
+ "language": "python",
125
+ "file": "check/string-match.py"
126
+ }
127
+ ],
128
+ "example": {
129
+ "code": "awk -F '|' '{print $1}' /usr/stock.log | sort | uniq -c | sort -nr | head -n 1 | awk '{print $2}'"
130
+ }
131
+ },
132
+ "labels": ["log", "file"]
133
+ },
134
+ {
135
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Find the stock index with the highest count of transactions (combined purchases and sales).",
136
+ "create": {
137
+ "local": "default",
138
+ "init": {
139
+ "file": "init/stock-log.sh"
140
+ }
141
+ },
142
+ "evaluation": {
143
+ "check": [
144
+ null,
145
+ {
146
+ "language": "python",
147
+ "file": "check/string-match.py"
148
+ }
149
+ ],
150
+ "example": {
151
+ "code": "awk -F '|' '{a[$3]++} END {max=0; for (stock in a) {if (a[stock] > max) {max = a[stock]; stockIndex = stock}} print stockIndex}' /usr/stock.log"
152
+ }
153
+ },
154
+ "labels": ["log", "file"]
155
+ }
156
+ ]
os_interaction/data/2/environment.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "Tell me how many files can be executed in PATH.",
4
+ "evaluation": {
5
+ "check": [
6
+ null,
7
+ {
8
+ "language": "python",
9
+ "file": "check/integer-match.py"
10
+ }
11
+ ],
12
+ "example": "find $(echo $PATH | tr ':' ' ') -type f -executable | wc -l"
13
+ },
14
+ "labels": ["environment"]
15
+ },
16
+ {
17
+ "description": "Tell me how many files can be executed directly no matter where my work dir is.",
18
+ "evaluation": {
19
+ "check": [
20
+ null,
21
+ {
22
+ "language": "python",
23
+ "file": "check/integer-match.py"
24
+ }
25
+ ],
26
+ "example": "find $(echo $PATH | tr ':' ' ') -type f -executable | wc -l"
27
+ },
28
+ "labels": ["environment"]
29
+ },
30
+ {
31
+ "description": "I remember I had a directory for executables, and there was an executable echo-love in there. But I forgot the path of this directory. Can you tell me the full path of this directory?",
32
+ "create": {
33
+ "local": "default",
34
+ "init": {
35
+ "file": "init/nested_folders.sh"
36
+ }
37
+ },
38
+ "evaluation": {
39
+ "check": [
40
+ null,
41
+ {
42
+ "language": "python",
43
+ "file": "check/string-match.py"
44
+ }
45
+ ],
46
+ "example": "find \"$(pwd)\" -type f -name \"echo-love\" -perm /u=x -exec dirname {} \\;"
47
+ },
48
+ "labels": ["environment"]
49
+ },
50
+ {
51
+ "description": "I remember I had a directory for executables, and there was an executable echo-love in there. But I forgot the path of this directory. Can you tell me the full path of this executable?",
52
+ "create": {
53
+ "local": "default",
54
+ "init": {
55
+ "file": "init/nested_folders.sh"
56
+ }
57
+ },
58
+ "evaluation": {
59
+ "check": [
60
+ null,
61
+ {
62
+ "language": "python",
63
+ "file": "check/string-match.py"
64
+ }
65
+ ],
66
+ "example": "find \"$(pwd)\" -type f -name \"echo-love\" -perm /u=x"
67
+ },
68
+ "labels": ["environment"]
69
+ },
70
+ {
71
+ "description": "I remember I had a directory for executables, and there was an executable echo-love in there. But I forgot the path of this directory. Can you add the folder into PATH so that I can call it in the future?",
72
+ "create": {
73
+ "local": "default",
74
+ "init": [
75
+ {
76
+ "file": "init/nested_folders.sh"
77
+ },
78
+ "echo '' > ~/.bashrc"
79
+ ]
80
+ },
81
+ "evaluation": {
82
+ "check": [
83
+ "source ~/.bashrc && x=$(echo-love) && [ \"$x\" == \"I love myself.\" ] && exit 0"
84
+ ],
85
+ "example": "new_path=$(find \"$(pwd)\" -type f -name \"echo-love\" -perm /u=x -exec dirname {} \\;) && echo export PATH='$PATH':$new_path > ~/.bashrc"
86
+ },
87
+ "labels": ["environment"]
88
+ }
89
+ ]
os_interaction/data/3/ac.json ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "Tell me the number of CPUs.",
4
+ "evaluation": {
5
+ "check": [
6
+ null,
7
+ {
8
+ "language": "python",
9
+ "file": "check/integer-match.py"
10
+ }
11
+ ],
12
+ "example": "nproc"
13
+ },
14
+ "labels": [
15
+ "command",
16
+ "CPU",
17
+ "device",
18
+ "hardware",
19
+ "processor",
20
+ "system"
21
+ ]
22
+ },
23
+ {
24
+ "description": "How many groups are in this UNIX system?",
25
+ "evaluation": {
26
+ "check": [
27
+ null,
28
+ {
29
+ "language": "python",
30
+ "file": "check/integer-match.py"
31
+ }
32
+ ],
33
+ "example": "getent group | wc -l"
34
+ },
35
+ "labels": ["command", "system"]
36
+ },
37
+ {
38
+ "description": "Recursively Find how many files have the extension .tep",
39
+ "create": {
40
+ "local": "default",
41
+ "init": "echo 123>/root/.tmp\necho 123>/root/.tmp2\necho 123>/root/1.tep\necho 123>/root/.tep\necho 123>/root/.u\necho 123>/root/.k\n"
42
+ },
43
+ "evaluation": {
44
+ "check": [
45
+ null,
46
+ {
47
+ "language": "python",
48
+ "file": "check/integer-match.py"
49
+ }
50
+ ],
51
+ "example": "find . -type f -name \"*.tep\" | wc -l"
52
+ },
53
+ "labels": ["command", "file"]
54
+ },
55
+ {
56
+ "description": "Tell me whether npm is installed or not. If it is installed, return 'yes'. If it is not installed, return 'no'",
57
+ "evaluation": {
58
+ "check": [
59
+ null,
60
+ {
61
+ "language": "python",
62
+ "file": "check/string-match.py"
63
+ }
64
+ ],
65
+ "example": "[ -x \"$(command -v npm)\" ] && echo 'yes' || echo 'no'"
66
+ },
67
+ "labels": ["command", "packages"]
68
+ },
69
+ {
70
+ "description": "Tell me whether npm is installed or not. If it is installed, return 'yes'. If it is not installed, return 'no'",
71
+ "create": {
72
+ "local": "packages"
73
+ },
74
+ "evaluation": {
75
+ "check": [
76
+ null,
77
+ {
78
+ "language": "python",
79
+ "file": "check/string-match.py"
80
+ }
81
+ ],
82
+ "example": "[ -x \"$(command -v npm)\" ] && echo 'yes' || echo 'no'"
83
+ },
84
+ "labels": ["command", "packages"]
85
+ },
86
+ {
87
+ "description": "Tell me the max number of threads in Linux.",
88
+ "evaluation": {
89
+ "check": [
90
+ null,
91
+ {
92
+ "language": "python",
93
+ "file": "check/string-match.py"
94
+ }
95
+ ],
96
+ "example": "cat /proc/sys/kernel/threads-max"
97
+ },
98
+ "labels": ["command", "file"]
99
+ }
100
+ ]
os_interaction/data/4/N11.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "How many hidden files, which do not contain the character u, are in /usr? (not recursively)",
3
+ "create": {
4
+ "local": "default",
5
+ "init": "echo 123>/usr/.tmp\necho 123>/usr/tmp2\necho 123>/usr/.tm12p\necho 123>/usr/.f\necho 123>/usr/.u\necho 123>/usr/k\n"
6
+ },
7
+ "evaluation": {
8
+ "check": [
9
+ null,
10
+ {
11
+ "language": "python",
12
+ "file": "check/integer-match.py"
13
+ }
14
+ ],
15
+ "example": {
16
+ "code": "find /usr -type f -name \".*\" -not -name \"*k*\" | wc -l"
17
+ }
18
+ },
19
+ "labels": ["file"]
20
+ }
os_interaction/data/4/N225.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "Get the name of most recent file in /usr. (not recursively)",
3
+ "create": {
4
+ "local": "default",
5
+ "init": "i=1; while [ $i -lt 100 ]; do echo \"Content: $((i * 2 % 3))\" > \"/usr/$(( (i+50)%100 )).log\"; i=$((i+1)); done"
6
+ },
7
+ "evaluation": {
8
+ "check": [
9
+ null,
10
+ {
11
+ "language": "python",
12
+ "file": "check/string-match.py"
13
+ }
14
+ ],
15
+ "example": {
16
+ "code": "ls -lt /usr | head -n 2 | tail -n 1 | awk '{print $9}'"
17
+ }
18
+ },
19
+ "labels": ["file"]
20
+ }
os_interaction/data/4/N37.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "What's the full path of a file \"TOOLS\"?",
3
+ "create": {
4
+ "local": "default",
5
+ "init": "echo 123>/usr/TOOLS"
6
+ },
7
+ "evaluation": {
8
+ "check": [
9
+ null,
10
+ {
11
+ "language": "python",
12
+ "file": "check/string-match.py"
13
+ }
14
+ ],
15
+ "example": "find / -name TOOLS"
16
+ },
17
+ "labels": ["path", "file"]
18
+ }
os_interaction/data/4/N4.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "execute ~/test and get the output.",
3
+ "start": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo love' > test && chmod 000 test && chown jack test && su - jack",
4
+ "evaluation": {
5
+ "match": "love",
6
+ "example": {
7
+ "code": "chmod 777 test && ~/test"
8
+ }
9
+ },
10
+ "labels": ["permission", "user"]
11
+ }
os_interaction/data/4/N41.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "If a regular file named \"workspace\" exists in /working (recursively)? If so, output \"yes\", otherwise output \"no\" (with out quotes).",
4
+ "create": {
5
+ "local": "default",
6
+ "init": "rm -rf /working; mkdir /working && echo 123>/working/.tmp && echo 123>/working/.tm12p && echo 123>/working/.f && mkdir /working/OS && echo 'OS' > /working/OS/.theme"
7
+ },
8
+ "evaluation": {
9
+ "match": "no"
10
+ },
11
+ "labels": ["file"]
12
+ },
13
+ {
14
+ "description": "If a regular file named \"workspace\" exists in /working (recursively)? If so, output \"yes\", otherwise output \"no\" (with out quotes).",
15
+ "create": {
16
+ "local": "default",
17
+ "init": "rm -rf /working; mkdir /working && echo 123>/working/.tmp && echo 123>/working/.tm12p && echo 123>/working/.f && mkdir /working/OS && echo 'OS' > /working/OS/.theme && mkdir /working/OS/workspace"
18
+ },
19
+ "evaluation": {
20
+ "match": "no"
21
+ },
22
+ "labels": ["file"]
23
+ },
24
+ {
25
+ "description": "If a regular file named \"workspace\" exists in /working (recursively)? If so, output \"yes\", otherwise output \"no\" (with out quotes).",
26
+ "create": {
27
+ "local": "default",
28
+ "init": "rm -rf /working; mkdir /working && echo 123>/working/.tmp && echo 123>/working/.tm12p && echo 123>/working/.f && mkdir /working/OS && echo 'OS' > /working/OS/.theme && touch /working/OS/workspace"
29
+ },
30
+ "evaluation": {
31
+ "match": "yes"
32
+ },
33
+ "labels": ["file"]
34
+ },
35
+ {
36
+ "description": "If a regular file named \"workspace\" exists in /working (recursively)? If so, output \"yes\", otherwise output \"no\" (with out quotes).",
37
+ "create": {
38
+ "local": "default",
39
+ "init": "rm -rf /working; mkdir /working && echo 123>/working/.tmp && echo 123>/working/.tm12p && echo 123>/working/.f && mkdir /working/OS && echo 'OS' > /working/OS/.theme && touch /working/workspace"
40
+ },
41
+ "evaluation": {
42
+ "match": "yes"
43
+ },
44
+ "labels": ["file"]
45
+ }
46
+ ]
os_interaction/data/4/Q09.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "What is the total number of files in the /var directory? (recursively)",
4
+ "create": {
5
+ "local": "default",
6
+ "init": "echo 123321>/var/tmp.log && echo 123321>/var/dsdd && echo 123321>/var/ppoo && echo 123321>/var/gdss && echo 123321>/var/itcs && echo 123321>/var/ksmx"
7
+ },
8
+ "evaluation": {
9
+ "check": [
10
+ null,
11
+ {
12
+ "language": "python",
13
+ "file": "check/integer-match.py"
14
+ }
15
+ ],
16
+ "example": {
17
+ "code": "find /var -type f | wc -l"
18
+ }
19
+ },
20
+ "labels": ["command", "file"]
21
+ }
22
+ ]
os_interaction/data/4/Q19.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "How many lines are there in /root/matrix.txt",
4
+ "create": {
5
+ "local": "default",
6
+ "init":"echo \"1 2 3\n4 5 6\n7 8 9\" > /root/matrix.txt"
7
+ },
8
+ "evaluation": {
9
+ "check": [
10
+ null,
11
+ {
12
+ "language": "python",
13
+ "file": "check/integer-match.py"
14
+ }
15
+ ],
16
+ "example": {
17
+ "code": "cat /root/matrix.txt | wc -l"
18
+ }
19
+ },
20
+ "labels": ["command","file"]
21
+ }
22
+ ]
os_interaction/data/4/Q30.json ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "How many default paths are looked for when I execute an executable on this computer? (Regardless of whether the path exists or not.)",
4
+ "create": {
5
+ "local": "default",
6
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc"
7
+ },
8
+ "evaluation": {
9
+ "check": [
10
+ null,
11
+ {
12
+ "language": "python",
13
+ "file": "check/integer-match.py"
14
+ }
15
+ ],
16
+ "example": {
17
+ "code": "source ~/.bashrc; echo $PATH | tr ':' '\\n' | wc -l"
18
+ }
19
+ },
20
+ "labels": ["command", "variables"]
21
+ },
22
+ {
23
+ "description": "How many default paths are looked for when I execute an executable on this computer? (Only existing and valid directories)",
24
+ "create": {
25
+ "local": "default",
26
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc && mkdir /var/k"
27
+ },
28
+ "evaluation": {
29
+ "check": [
30
+ null,
31
+ {
32
+ "language": "python",
33
+ "file": "check/integer-match.py"
34
+ }
35
+ ],
36
+ "example": {
37
+ "code": "source ~/.bashrc; count=0; IFS=:; for path in $PATH; do [ -d \"$path\" ] && ((count++)); done; echo $count"
38
+ }
39
+ },
40
+ "labels": ["command", "variables"]
41
+ },
42
+ {
43
+ "description": "How many default paths are looked for when I execute an executable on this computer? (Only existing and valid directories)",
44
+ "create": {
45
+ "local": "default",
46
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc && mkdir /var/k && touch /var/l"
47
+ },
48
+ "evaluation": {
49
+ "check": [
50
+ null,
51
+ {
52
+ "language": "python",
53
+ "file": "check/integer-match.py"
54
+ }
55
+ ],
56
+ "example": {
57
+ "code": "source ~/.bashrc; count=0; IFS=:; for path in $PATH; do [ -d \"$path\" ] && ((count++)); done; echo $count"
58
+ }
59
+ },
60
+ "labels": ["command", "variables"]
61
+ },
62
+ {
63
+ "description": "How many paths are in $PATH? (Regardless of whether the path exists or not.)",
64
+ "create": {
65
+ "local": "default",
66
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc"
67
+ },
68
+ "evaluation": {
69
+ "check": [
70
+ null,
71
+ {
72
+ "language": "python",
73
+ "file": "check/integer-match.py"
74
+ }
75
+ ],
76
+ "example": {
77
+ "code": "source ~/.bashrc; echo $PATH | tr ':' '\\n' | wc -l"
78
+ }
79
+ },
80
+ "labels": ["command", "variables"]
81
+ },
82
+ {
83
+ "description": "How many existing directories are in $PATH?",
84
+ "create": {
85
+ "local": "default",
86
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc && mkdir /var/k"
87
+ },
88
+ "evaluation": {
89
+ "check": [
90
+ null,
91
+ {
92
+ "language": "python",
93
+ "file": "check/integer-match.py"
94
+ }
95
+ ],
96
+ "example": {
97
+ "code": "source ~/.bashrc; count=0; IFS=:; for path in $PATH; do [ -d \"$path\" ] && ((count++)); done; echo $count"
98
+ }
99
+ },
100
+ "labels": ["command", "variables"]
101
+ },
102
+ {
103
+ "description": "How many existing directories are in $PATH?",
104
+ "create": {
105
+ "local": "default",
106
+ "init": "echo 'export PATH=$PATH:/var/k && export PATH=$PATH:/var/l && export PATH=$PATH:/var/p' > ~/.bashrc && mkdir /var/k && touch /var/l"
107
+ },
108
+ "evaluation": {
109
+ "check": [
110
+ null,
111
+ {
112
+ "language": "python",
113
+ "file": "check/integer-match.py"
114
+ }
115
+ ],
116
+ "example": {
117
+ "code": "source ~/.bashrc; count=0; IFS=:; for path in $PATH; do [ -d \"$path\" ] && ((count++)); done; echo $count"
118
+ }
119
+ },
120
+ "labels": ["command", "variables"]
121
+ }
122
+ ]
os_interaction/data/4/Q47.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "Move the file MyPersonalComputer.config to current directory. And tell me the path of the file before copying.",
4
+ "create": {
5
+ "local": "default",
6
+ "init": "mkdir /home/user1 && mkdir /home/user1/os && mkdir /home/user1/os/linux && mkdir /home/user1/os/linux/commands && echo 'Linux-Ubuntu-20.04?' > /home/user1/os/linux/commands/MyPersonalComputer.config"
7
+ },
8
+ "start": "mkdir /home/user2 && cd /home/user2",
9
+ "evaluation": {
10
+ "check": [
11
+ {
12
+ "language": "python",
13
+ "code": "from sys import argv\nassert argv[1].strip()=='/home/user1/os/linux/commands/MyPersonalComputer.config'"
14
+ },
15
+ {
16
+ "language": "bash",
17
+ "code": "find /home/user1/os/linux/commands/MyPersonalComputer.config >/dev/null 2>/dev/null && exit 1 || exit 0"
18
+ },
19
+ {
20
+ "language": "bash",
21
+ "code": "find /home/user2/MyPersonalComputer.config >/dev/null 2>/dev/null && exit 0 || exit 1"
22
+ }
23
+ ],
24
+ "example": {
25
+ "code": "mv /home/user1/os/linux/commands/MyPersonalComputer.config /home/user2/ && echo /home/user1/os/linux/commands/MyPersonalComputer.config"
26
+ }
27
+ },
28
+ "labels": ["path", "files"]
29
+ }
30
+ ]
os_interaction/data/4/Q49.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "Test if variable var is an integer? If so, tell me \"yes\", otherwise tell me \"no\". (Without quotes)",
4
+ "create": {
5
+ "local": "default"
6
+ },
7
+ "start": "var=3.14",
8
+ "evaluation": {
9
+ "match": "no",
10
+ "example": {
11
+ "code": "test \"$var\" -eq \"$var\" 2>/dev/null && echo \"yes\" || echo \"no\""
12
+ }
13
+ },
14
+ "labels": ["command", "variables"]
15
+ },
16
+ {
17
+ "description": "Test if variable var is an integer? If so, tell me \"yes\", otherwise tell me \"no\". (Without quotes)",
18
+ "create": {
19
+ "local": "default"
20
+ },
21
+ "start": "var=10",
22
+ "evaluation": {
23
+ "match": "yes",
24
+ "example": {
25
+ "code": "test \"$var\" -eq \"$var\" 2>/dev/null && echo \"yes\" || echo \"no\""
26
+ }
27
+ },
28
+ "labels": ["command", "variables"]
29
+ }
30
+ ]
os_interaction/data/5/new.json ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "I would like to implement the following function: entering the \"calc\" command will enable the calculation of an expression. The expression can include addition, subtraction, multiplication, division, and parentheses. If the absolute error between the calculated answer and the expected answer is less than 1e-5, it will be considered correct. For example, I can calculate the result by entering \"calc 6 * (9 / 3) + 7\", and the output will be 25.",
4
+ "create": {
5
+ "local": "default"
6
+ },
7
+ "evaluation": {
8
+ "check": {
9
+ "file": "checking/0.sh"
10
+ },
11
+ "example": {
12
+ "file": "example/0.sh"
13
+ }
14
+ },
15
+ "labels": ["command"]
16
+ },
17
+ {
18
+ "description": "I would like to implement the following function: entering the \"count\" command will counts the number of regular files in a directory and its subdirectories(recursively), and displays the total count. If there is a link or something, count it separately. For example, I can enter \"count /usr/local\" to get the number of regular files in /usr/local recursively. If there are 5 regular files in that, the output is \"5\".",
19
+ "create": {
20
+ "local": "default"
21
+ },
22
+ "evaluation": {
23
+ "check": {
24
+ "file": "checking/1.sh"
25
+ },
26
+ "example": {
27
+ "file": "example/1.sh"
28
+ }
29
+ },
30
+ "labels": ["command", "file"]
31
+ },
32
+ {
33
+ "description": "I would like to implement a command line tool called \"date-format\" that can format a given date string based on the provided format string. For example, if I enter command date-format 2023-5-1 '%Y/%m/%d', the output will be 2023/05/01.",
34
+ "create": {
35
+ "local": "default"
36
+ },
37
+ "evaluation": {
38
+ "check": {
39
+ "file": "checking/2.sh"
40
+ },
41
+ "example": {
42
+ "file": "example/2.sh"
43
+ }
44
+ },
45
+ "labels": ["command"]
46
+ },
47
+ {
48
+ "description": "How many hidden files are in /usr?",
49
+ "create": {
50
+ "local": "default",
51
+ "init": {
52
+ "code": "echo 123>/usr/.tmp\necho 123>/usr/.tmp2\necho 123>/usr/.tm12p\necho 123>/usr/.f\necho 123>/usr/.u\necho 123>/usr/.k\n"
53
+ }
54
+ },
55
+ "evaluation": {
56
+ "check": [
57
+ null,
58
+ {
59
+ "language": "python",
60
+ "file": "check/integer-match.py"
61
+ }
62
+ ],
63
+ "example": {
64
+ "code": "ls -a /usr | grep \"^\\.\" | wc -l"
65
+ }
66
+ },
67
+ "labels": ["file"]
68
+ },
69
+ {
70
+ "description": "How many files whose name starts with letter exist in /usr?",
71
+ "create": {
72
+ "local": "default",
73
+ "init": {
74
+ "code": "echo 123>/usr/tmp\necho abcd>/usr/.tmp2\necho abcdabcd>/usr/.tm12p\necho abcdabcdabcdabcd>/usr/f\necho abcdabcdabcdabcdabcdabcdabcdabcd>/usr/.u\necho abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd>/usr/.k\n"
75
+ }
76
+ },
77
+ "evaluation": {
78
+ "check": [
79
+ null,
80
+ {
81
+ "language": "python",
82
+ "file": "check/integer-match.py"
83
+ }
84
+ ],
85
+ "example": {
86
+ "code": "ls -1 | grep \"^[[:alpha:]]\" | wc -l"
87
+ }
88
+ },
89
+ "labels": ["file"]
90
+ },
91
+ {
92
+ "description": "How much disk space is being used by /usr and all of its contents? Tell me in human-readable format.",
93
+ "create": {
94
+ "local": "default",
95
+ "init": {
96
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/usr/OSbench\n"
97
+ }
98
+ },
99
+ "evaluation": {
100
+ "check": [
101
+ null,
102
+ {
103
+ "language": "python",
104
+ "file": "check/size-match.py"
105
+ }
106
+ ],
107
+ "example": {
108
+ "code": "du -sh /usr | awk '{print $1}'"
109
+ }
110
+ },
111
+ "labels": ["file"]
112
+ },
113
+ {
114
+ "description": "How many empty files are there in /usr and all of its content?",
115
+ "create": {
116
+ "local": "default",
117
+ "init": {
118
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/usr/OSbench\ntouch /usr/tmpfile\nmkdir /usr/tmpdir\ntouch /usr/tmpdir/inner"
119
+ }
120
+ },
121
+ "evaluation": {
122
+ "check": [
123
+ null,
124
+ {
125
+ "language": "python",
126
+ "file": "check/integer-match.py"
127
+ }
128
+ ],
129
+ "example": {
130
+ "code": "find /usr -type f -size 0 | wc -l"
131
+ }
132
+ },
133
+ "labels": ["file"]
134
+ },
135
+ {
136
+ "description": "How many directories are in the root dir (excluding hidden directories)?",
137
+ "create": [
138
+ null,
139
+ {
140
+ "language": "python",
141
+ "file": "check/integer-match.py"
142
+ }
143
+ ],
144
+ "evaluation": {
145
+ "check": [
146
+ null,
147
+ {
148
+ "language": "python",
149
+ "file": "check/integer-match.py"
150
+ }
151
+ ],
152
+ "example": {
153
+ "code": "ls -l / | grep \"^d\" | grep -v \"^d.*\\.\" | wc -l"
154
+ }
155
+ },
156
+ "labels": ["file"]
157
+ },
158
+ {
159
+ "description": "How many directories (recursively) are in the /usr directory?",
160
+ "create": {
161
+ "local": "default",
162
+ "init": {
163
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/usr/OSbench\ntouch /usr/tmpfile\nmkdir /usr/tmpdir\ntouch /usr/tmpdir/inner"
164
+ }
165
+ },
166
+ "evaluation": {
167
+ "check": [
168
+ null,
169
+ {
170
+ "language": "python",
171
+ "file": "check/integer-match.py"
172
+ }
173
+ ],
174
+ "example": {
175
+ "code": "find /usr -type d | wc -l"
176
+ }
177
+ },
178
+ "labels": ["file"]
179
+ },
180
+ {
181
+ "description": "How many files in /usr (recursively) were modified in the last 24 hours?",
182
+ "create": {
183
+ "local": "default",
184
+ "init": {
185
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/usr/OSbench\ntouch /usr/tmpfile\nmkdir /usr/tmpdir\ntouch /usr/tmpdir/inner"
186
+ }
187
+ },
188
+ "evaluation": {
189
+ "check": [
190
+ null,
191
+ {
192
+ "language": "python",
193
+ "file": "check/integer-match.py"
194
+ }
195
+ ],
196
+ "example": {
197
+ "code": "find /usr -type f -mtime -1 | wc -l"
198
+ }
199
+ },
200
+ "labels": ["file"]
201
+ }
202
+ ]
os_interaction/data/6-backup.json ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "execute ~/test and get the output",
4
+ "create": {
5
+ "init": {
6
+ "code": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo a3b0c7' > test && chmod 000 test && chown jack test &&su - jack"
7
+ }
8
+ },
9
+ "evaluation": {
10
+ "match": "a3b0c7"
11
+ },
12
+ "example": {
13
+ "code": "chmod 777 test && ~/test"
14
+ },
15
+ "labels": ["permission", "user"]
16
+ },
17
+ {
18
+ "description": "What will be the output if I execute ~/test?",
19
+ "create": {
20
+ "init": {
21
+ "code": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo a3b0c7' > test && chmod 000 test && chown jack test &&su - jack"
22
+ }
23
+ },
24
+ "evaluation": {
25
+ "match": "a3b0c7"
26
+ },
27
+ "example": {
28
+ "code": "chmod 777 test && ~/test"
29
+ },
30
+ "labels": ["permission", "user"]
31
+ },
32
+ {
33
+ "description": "make /testfile readable to jack, bill and tom, but not george",
34
+ "create": {
35
+ "init": {
36
+ "code": "echo 'test' > /testfile && useradd -s /bin/bash -d /home/jack -m jack && useradd -s /bin/bash -d /home/bill -m bill && useradd -s /bin/bash -d /home/tom -m tom && useradd -s /bin/bash -d /home/george -m george"
37
+ }
38
+ },
39
+ "evaluation": {
40
+ "check": {
41
+ "code": "(runuser -l jack -c 'cat /testfile' && runuser -l bill -c 'cat /testfile' && runuser -l tom -c 'cat /testfile' && runuser -l george -c 'cat /testfile') | if [ \"$(cat -)\" = \"test\"$'\\n'\"test\"$'\\n'\"test\" ]; then exit 0; else exit 1; fi"
42
+ },
43
+ "example": {
44
+ "code": "groupadd tmp && usermod -a -G tmp jack && usermod -a -G tmp bill && usermod -a -G tmp tom && chmod 640 /testfile && chgrp tmp /testfile"
45
+ }
46
+ },
47
+ "labels": ["permission", "user"]
48
+ },
49
+ {
50
+ "description": "Why can't I use enter my home dir? Help me fix it.",
51
+ "start": "useradd -s /bin/bash -d /home/hansen -m hansen && chmod -x /home/hansen && exec su - hansen",
52
+ "evaluation": {
53
+ "check": {
54
+ "code": "cd ~ && exit 0 || exit 1"
55
+ },
56
+ "example": {
57
+ "code": "chmod 750 ~"
58
+ }
59
+ },
60
+ "labels": ["permission", "user"]
61
+ },
62
+ {
63
+ "description": "There's a vulnerability in the system (Hint: related to SUID). Find it and fix it.",
64
+ "create": {
65
+ "init": {
66
+ "code": "chmod u+s /usr/bin/find"
67
+ }
68
+ },
69
+ "evaluation": {
70
+ "check": {
71
+ "code": "ls -l /usr/bin/find | awk '{if ($1~/^-..s/) { exit 1; } else { exit 0; }}'"
72
+ },
73
+ "example": {
74
+ "code": "chmod u-s /usr/bin/find"
75
+ }
76
+ },
77
+ "labels": ["permission"]
78
+ },
79
+ {
80
+ "description": "set all files in ~/videos to be 660, and all directories(include ~/videos) to be 750",
81
+ "create": {
82
+ "init": {
83
+ "code": "cd ~ && mkdir videos && cd videos && mkdir old && mkdir new && touch vid1 && touch vid2 && touch new/a && touch new/b && touch old/c"
84
+ }
85
+ },
86
+ "evaluation": {
87
+ "check": {
88
+ "code": "(find ~/videos -type f ! -perm 660 -ls && find ~/videos -type d ! -perm 750 -ls) | if [ \"$(cat -)\" = \"\" ]; then exit 0; else exit 1; fi"
89
+ },
90
+ "example": {
91
+ "code": "find ~/videos -type f -exec chmod 660 {} + && find ~/videos -type d -exec chmod 750 {} +"
92
+ }
93
+ },
94
+ "labels": ["permission"]
95
+ },
96
+ {
97
+ "description": "ahh! Why can't I use sudo??? Is it because the WiFi I'm using? fix it!!!",
98
+ "create": {
99
+ "init": {
100
+ "code": "apt update && apt install sudo -y && echo '' > /etc/sudoers"
101
+ }
102
+ },
103
+ "evaluation": {
104
+ "check": {
105
+ "code": "sudo whoami | if [ \"$(cat -)\" = \"root\" ]; then exit 0; else exit 1; fi"
106
+ },
107
+ "example": {
108
+ "code": "echo 'Defaults env_reset\nDefaults mail_badpass\nDefaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\"\nroot ALL=(ALL:ALL) ALL\n%admin ALL=(ALL) ALL\n%sudo ALL=(ALL:ALL) ALL' > /etc/sudoers"
109
+ }
110
+ },
111
+ "labels": ["permission"]
112
+ },
113
+ {
114
+ "description": "Suppose you have a directory called /data that contains sensitive files that should only be accessible to members of the group \"dataaccess\". Ensure that new files and directories created in this directory inherit the group ownership, and that users can only delete files and directories that they own",
115
+ "create": {
116
+ "init": {
117
+ "code": "mkdir /data"
118
+ }
119
+ },
120
+ "evaluation": {
121
+ "check": {
122
+ "code": "ls -l / | grep data | awk '{if ($1~/^d.....s..t/) { exit 0; } else { exit 1; } }'"
123
+ },
124
+ "example": {
125
+ "code": "chmod g+s /data && chmod +t /data"
126
+ }
127
+ },
128
+ "labels": ["permission"]
129
+ },
130
+ {
131
+ "description": "Why can't I use sudo?? fix it.",
132
+ "create": {
133
+ "init": {
134
+ "code": "apt remove sudo"
135
+ }
136
+ },
137
+ "evaluation": {
138
+ "check": {
139
+ "code": "sudo whoami | if [ \"$(cat -)\" = \"root\" ]; then exit 0; else exit 1; fi"
140
+ },
141
+ "example": {
142
+ "code": "apt update && apt install sudo -y"
143
+ }
144
+ },
145
+ "labels": ["permission"]
146
+ }
147
+ ]
os_interaction/data/6/new.json ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "execute ~/test and get the output",
4
+ "create": {
5
+ "init": {
6
+ "code": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo a3b0c7' > test && chmod 000 test && chown jack test &&su - jack"
7
+ }
8
+ },
9
+ "evaluation": {
10
+ "match": "a3b0c7"
11
+ },
12
+ "example": {
13
+ "code": "chmod 777 test && ~/test"
14
+ },
15
+ "labels": ["permission", "user"]
16
+ },
17
+ {
18
+ "description": "What will be the output if I execute ~/test?",
19
+ "create": {
20
+ "init": {
21
+ "code": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo a3b0c7' > test && chmod 000 test && chown jack test &&su - jack"
22
+ }
23
+ },
24
+ "evaluation": {
25
+ "match": "a3b0c7"
26
+ },
27
+ "example": {
28
+ "code": "chmod 777 test && ~/test"
29
+ },
30
+ "labels": ["permission", "user"]
31
+ },
32
+ {
33
+ "description": "make /testfile readable to jack, bill and tom, but not george",
34
+ "create": {
35
+ "init": {
36
+ "code": "echo 'test' > /testfile && useradd -s /bin/bash -d /home/jack -m jack && useradd -s /bin/bash -d /home/bill -m bill && useradd -s /bin/bash -d /home/tom -m tom && useradd -s /bin/bash -d /home/george -m george"
37
+ }
38
+ },
39
+ "evaluation": {
40
+ "check": {
41
+ "code": "(runuser -l jack -c 'cat /testfile' && runuser -l bill -c 'cat /testfile' && runuser -l tom -c 'cat /testfile' && runuser -l george -c 'cat /testfile') | if [ \"$(cat -)\" = \"test\"$'\\n'\"test\"$'\\n'\"test\" ]; then exit 0; else exit 1; fi"
42
+ },
43
+ "example": {
44
+ "code": "groupadd tmp && usermod -a -G tmp jack && usermod -a -G tmp bill && usermod -a -G tmp tom && chmod 640 /testfile && chgrp tmp /testfile"
45
+ }
46
+ },
47
+ "labels": ["permission", "user"]
48
+ },
49
+ {
50
+ "description": "There's a vulnerability in the system (Hint: related to SUID). Find it and fix it.",
51
+ "create": {
52
+ "init": {
53
+ "code": "chmod u+s /usr/bin/find"
54
+ }
55
+ },
56
+ "evaluation": {
57
+ "check": {
58
+ "code": "ls -l /usr/bin/find | awk '{if ($1~/^-..s/) { exit 1; } else { exit 0; }}'"
59
+ },
60
+ "example": {
61
+ "code": "chmod u-s /usr/bin/find"
62
+ }
63
+ },
64
+ "labels": ["permission"]
65
+ },
66
+ {
67
+ "description": "set all files in ~/videos to be 660, and all directories(include ~/videos) to be 750",
68
+ "create": {
69
+ "init": {
70
+ "code": "cd ~ && mkdir videos && cd videos && mkdir old && mkdir new && touch vid1 && touch vid2 && touch new/a && touch new/b && touch old/c"
71
+ }
72
+ },
73
+ "evaluation": {
74
+ "check": {
75
+ "code": "(find ~/videos -type f ! -perm 660 -ls && find ~/videos -type d ! -perm 750 -ls) | if [ \"$(cat -)\" = \"\" ]; then exit 0; else exit 1; fi"
76
+ },
77
+ "example": {
78
+ "code": "find ~/videos -type f -exec chmod 660 {} + && find ~/videos -type d -exec chmod 750 {} +"
79
+ }
80
+ },
81
+ "labels": ["permission"]
82
+ },
83
+ {
84
+ "description": "ahh! Why can't I use sudo??? Is it because the WiFi I'm using? fix it!!!",
85
+ "create": {
86
+ "init": {
87
+ "code": "apt update && apt install sudo -y && echo '' > /etc/sudoers"
88
+ }
89
+ },
90
+ "evaluation": {
91
+ "check": {
92
+ "code": "sudo whoami | if [ \"$(cat -)\" = \"root\" ]; then exit 0; else exit 1; fi"
93
+ },
94
+ "example": {
95
+ "code": "echo 'Defaults env_reset\nDefaults mail_badpass\nDefaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\"\nroot ALL=(ALL:ALL) ALL\n%admin ALL=(ALL) ALL\n%sudo ALL=(ALL:ALL) ALL' > /etc/sudoers"
96
+ }
97
+ },
98
+ "labels": ["permission"]
99
+ },
100
+ {
101
+ "description": "Why can't I use sudo? Help me fix it.",
102
+ "create": {
103
+ "init": {
104
+ "code": "apt update && apt install sudo -y && echo '' > /etc/sudoers"
105
+ }
106
+ },
107
+ "evaluation": {
108
+ "check": {
109
+ "code": "sudo whoami | if [ \"$(cat -)\" = \"root\" ]; then exit 0; else exit 1; fi"
110
+ },
111
+ "example": {
112
+ "code": "echo 'Defaults env_reset\nDefaults mail_badpass\nDefaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\"\nroot ALL=(ALL:ALL) ALL\n%admin ALL=(ALL) ALL\n%sudo ALL=(ALL:ALL) ALL' > /etc/sudoers"
113
+ }
114
+ },
115
+ "labels": ["permission"]
116
+ },
117
+ {
118
+ "description": "Suppose you have a directory called /data that contains sensitive files that should only be accessible to members of the group \"dataaccess\". Ensure that new files and directories created in this directory inherit the group ownership, and that users can only delete files and directories that they own",
119
+ "create": {
120
+ "init": {
121
+ "code": "mkdir /data"
122
+ }
123
+ },
124
+ "evaluation": {
125
+ "check": {
126
+ "code": "ls -l / | grep data | awk '{if ($1~/^d.....s..t/) { exit 0; } else { exit 1; } }'"
127
+ },
128
+ "example": {
129
+ "code": "chmod g+s /data && chmod +t /data"
130
+ }
131
+ },
132
+ "labels": ["permission"]
133
+ },
134
+ {
135
+ "description": "Why can't I use sudo?? fix it.",
136
+ "create": {
137
+ "init": {
138
+ "code": "apt remove sudo"
139
+ }
140
+ },
141
+ "evaluation": {
142
+ "check": {
143
+ "code": "sudo whoami | if [ \"$(cat -)\" = \"root\" ]; then exit 0; else exit 1; fi"
144
+ },
145
+ "example": {
146
+ "code": "apt update && apt install sudo -y"
147
+ }
148
+ },
149
+ "labels": ["permission"]
150
+ }
151
+ ]
os_interaction/data/7/bootstrap.json ADDED
The diff for this file is too large to render. See raw diff
 
os_interaction/data/dev.json ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "description": "There's a program that writes 'succeed' into /root/log periodically. I only know the interval is 1 second, 2 seconds, or 3 seconds. Please find out the interval. Answer me only the integer number of seconds. (e.g. 1, 2, or 3)",
4
+ "create": {
5
+ "local": "default"
6
+ },
7
+ "start": "python3 -c 'import time\nwhile True:\n\twith open(\"/root/log\", \"a+\") as f:\n\t\tf.write(\"succeed\")\n\ttime.sleep(1)' &",
8
+ "evaluation": {
9
+ "match": "1"
10
+ },
11
+ "labels": ["file", "process", "background"]
12
+ },
13
+ {
14
+ "description": "There's a program that writes something into /root every 1 second. I want to know what is the file. tell me the filename please. (without its directory)",
15
+ "create": {
16
+ "local": "default",
17
+ "init": {
18
+ "code": "mkdir /root/r1 && mkdir /root/r2 && touch /root/a.log && touch /root/b.log && touch /root/log && touch /root/loga && touch /root/log.jsonl"
19
+ }
20
+ },
21
+ "start": "python3 -c 'import time\nwhile True:\n\twith open(\"/root/log\", \"a+\") as f:\n\t\tf.write(\"succeed\")\n\ttime.sleep(1)' &",
22
+ "evaluation": {
23
+ "match": "log"
24
+ },
25
+ "labels": ["file", "process", "background"]
26
+ },
27
+ {
28
+ "description": "There's a program that writes something into /root every 1 second. I want to know what is the file. tell me the filename please. (without its directory)",
29
+ "create": {
30
+ "local": "default",
31
+ "init": {
32
+ "code": "mkdir /root/r1 && mkdir /root/r2 && touch /root/a.log && touch /root/b.log && touch /root/log && touch /root/loga && touch /root/log.jsonl && touch /root/r1/.plain.log"
33
+ }
34
+ },
35
+ "start": "python3 -c 'import time\nwhile True:\n\twith open(\"/root/r1/.plain.log\", \"a+\") as f:\n\t\tf.write(\"succeed\")\n\ttime.sleep(1)' &",
36
+ "evaluation": {
37
+ "match": ".plain.log"
38
+ },
39
+ "labels": ["file", "process", "background"]
40
+ },
41
+ {
42
+ "description": "I would like to implement the following function: entering the \"calc\" command will enable the calculation of an expression. The expression can include addition, subtraction, multiplication, division, and parentheses. If the absolute error between the calculated answer and the expected answer is less than 1e-5, it will be considered correct. For example, I can calculate the result by entering \"calc 2 * (9 / 3)\", and the output will be 6.",
43
+ "create": {
44
+ "local": "default"
45
+ },
46
+ "evaluation": {
47
+ "check": {
48
+ "file": "check/0.sh"
49
+ },
50
+ "example": {
51
+ "file": "example/0.sh"
52
+ }
53
+ },
54
+ "labels": ["command"]
55
+ },
56
+ {
57
+ "description": "There's a program that writes 'succeed' into /root/log periodically. I only know the interval is 1 second, 2 seconds, or 3 seconds. Please find out the interval. Answer me only the integer number of seconds. (e.g. 1, 2, or 3)",
58
+ "create": {
59
+ "local": "default"
60
+ },
61
+ "start": "python3 -c 'import time\nwhile True:\n\twith open(\"/root/log\", \"a+\") as f:\n\t\tf.write(\"succeed\")\n\ttime.sleep(3)' &",
62
+ "evaluation": {
63
+ "match": "3"
64
+ },
65
+ "labels": ["file", "process", "background"]
66
+ },
67
+ {
68
+ "description": "I would like to implement the following function: entering the \"calc\" command will enable the calculation of an expression. The expression can include addition, subtraction, multiplication, division, and parentheses. If the absolute error between the calculated answer and the expected answer is less than 1e-5, it will be considered correct. For example, I can calculate the result by entering \"calc 2 * 1\", and the output will be 2.",
69
+ "create": {
70
+ "local": "default"
71
+ },
72
+ "evaluation": {
73
+ "check": {
74
+ "file": "check/0.sh"
75
+ },
76
+ "example": {
77
+ "file": "example/0.sh"
78
+ }
79
+ },
80
+ "labels": ["command"]
81
+ },
82
+ {
83
+ "description": "How many hidden files are in /home? (not including subdirectories)",
84
+ "create": {
85
+ "local": "default",
86
+ "init": {
87
+ "code": "mkdir -p /home\necho 123>/home/.tmp\necho 123>/home/.tmp2\necho 123>/home/.tm12p\necho 123>/home/.f\necho 123>/home/.u\necho 123>/home/.k\n"
88
+ }
89
+ },
90
+ "evaluation": {
91
+ "check": [
92
+ null,
93
+ {
94
+ "language": "python",
95
+ "file": "check/integer-match.py"
96
+ }
97
+ ],
98
+ "example": {
99
+ "code": "ls -a /home | grep \"^\\.\" | wc -l"
100
+ }
101
+ },
102
+ "labels": ["file"]
103
+ },
104
+ {
105
+ "description": "How many files whose name starts with letter exist in /root?",
106
+ "create": {
107
+ "local": "default",
108
+ "init": {
109
+ "code": "echo 123>/root/tmp\necho abcd>/root/.tmp2\necho abcdabcd>/root/.tm12p\necho abcdabcdabcdabcd>/root/f\necho abcdabcdabcdabcdabcdabcdabcdabcd>/root/.u\necho abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd>/root/.k\n"
110
+ }
111
+ },
112
+ "evaluation": {
113
+ "check": [
114
+ null,
115
+ {
116
+ "language": "python",
117
+ "file": "check/integer-match.py"
118
+ }
119
+ ],
120
+ "example": {
121
+ "code": "ls -1 /root | grep \"^[[:alpha:]]\" | wc -l"
122
+ }
123
+ },
124
+ "labels": ["file"]
125
+ },
126
+ {
127
+ "description": "How much disk space is being used by /home and all of its contents? Tell me in human-readable format.",
128
+ "create": {
129
+ "local": "default",
130
+ "init": {
131
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/home/OSbench\n"
132
+ }
133
+ },
134
+ "evaluation": {
135
+ "check": [
136
+ null,
137
+ {
138
+ "language": "python",
139
+ "file": "check/size-match.py"
140
+ }
141
+ ],
142
+ "example": {
143
+ "code": "du -sh /home | awk '{print $1}'"
144
+ }
145
+ },
146
+ "labels": ["file"]
147
+ },
148
+ {
149
+ "description": "How many empty files are there in /home and all of its content?",
150
+ "create": {
151
+ "local": "default",
152
+ "init": {
153
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/home/OSbench\ntouch /home/tmpfile\nmkdir /home/tmpdir\ntouch /home/tmpdir/inner"
154
+ }
155
+ },
156
+ "evaluation": {
157
+ "check": [
158
+ null,
159
+ {
160
+ "language": "python",
161
+ "file": "check/integer-match.py"
162
+ }
163
+ ],
164
+ "example": {
165
+ "code": "find /home -type f -size 0 | wc -l"
166
+ }
167
+ },
168
+ "labels": ["file"]
169
+ },
170
+ {
171
+ "description": "How many directories are in the root dir (excluding hidden directories)?",
172
+ "create": [
173
+ null,
174
+ {
175
+ "language": "python",
176
+ "file": "check/integer-match.py"
177
+ }
178
+ ],
179
+ "evaluation": {
180
+ "check": [
181
+ null,
182
+ {
183
+ "language": "python",
184
+ "file": "check/integer-match.py"
185
+ }
186
+ ],
187
+ "example": {
188
+ "code": "ls -l / | grep \"^d\" | grep -v \"^d.*\\.\" | wc -l"
189
+ }
190
+ },
191
+ "labels": ["file"]
192
+ },
193
+ {
194
+ "description": "How many directories (recursively) are in the /home directory?",
195
+ "create": {
196
+ "local": "default",
197
+ "init": {
198
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/home/OSbench\ntouch /home/tmpfile\nmkdir /home/tmpdir\ntouch /home/tmpdir/inner"
199
+ }
200
+ },
201
+ "evaluation": {
202
+ "check": [
203
+ null,
204
+ {
205
+ "language": "python",
206
+ "file": "check/integer-match.py"
207
+ }
208
+ ],
209
+ "example": {
210
+ "code": "find /home -type d | wc -l"
211
+ }
212
+ },
213
+ "labels": ["file"]
214
+ },
215
+ {
216
+ "description": "How many files in /home (recursively) were modified in the last 24 hours?",
217
+ "create": {
218
+ "local": "default",
219
+ "init": {
220
+ "code": "echo \"This is a random string: wuafjva-niqt12r-j9asd19-afj12-sdmxai\">/home/OSbench\ntouch /home/tmpfile\nmkdir /home/tmpdir\ntouch /home/tmpdir/inner"
221
+ }
222
+ },
223
+ "evaluation": {
224
+ "check": [
225
+ null,
226
+ {
227
+ "language": "python",
228
+ "file": "check/integer-match.py"
229
+ }
230
+ ],
231
+ "example": {
232
+ "code": "find /home -type f -mtime -1 | wc -l"
233
+ }
234
+ },
235
+ "labels": ["file"]
236
+ },
237
+ {
238
+ "description": "What's the count of my CPUs?",
239
+ "evaluation": {
240
+ "check": [
241
+ null,
242
+ {
243
+ "language": "python",
244
+ "file": "check/integer-match.py"
245
+ }
246
+ ],
247
+ "example": "nproc"
248
+ },
249
+ "labels": [
250
+ "device",
251
+ "system"
252
+ ]
253
+ },
254
+ {
255
+ "description": "How many groups are in my system?",
256
+ "evaluation": {
257
+ "check": [
258
+ null,
259
+ {
260
+ "language": "python",
261
+ "file": "check/integer-match.py"
262
+ }
263
+ ],
264
+ "example": "getent group | wc -l"
265
+ },
266
+ "labels": ["user"]
267
+ },
268
+ {
269
+ "description": "Find out how many groups with an index greater than 50.",
270
+ "evaluation": {
271
+ "check": [
272
+ null,
273
+ {
274
+ "language": "python",
275
+ "file": "check/integer-match.py"
276
+ }
277
+ ],
278
+ "example": "getent group | awk -F: '$3 > 50 {count++} END {print count}'"
279
+ },
280
+ "labels": ["user"]
281
+ },
282
+ {
283
+ "description": "Find out how many groups with an index not greater than 70.",
284
+ "evaluation": {
285
+ "check": [
286
+ null,
287
+ {
288
+ "language": "python",
289
+ "file": "check/integer-match.py"
290
+ }
291
+ ],
292
+ "example": "getent group | awk -F: '$3 <= 70 {count++} END {print count}'"
293
+ },
294
+ "labels": ["user"]
295
+ },
296
+ {
297
+ "description": "Find out count of users.",
298
+ "evaluation": {
299
+ "check": [
300
+ null,
301
+ {
302
+ "language": "python",
303
+ "file": "check/integer-match.py"
304
+ }
305
+ ],
306
+ "example": "getent passwd | wc -l"
307
+ },
308
+ "labels": ["user"]
309
+ },
310
+ {
311
+ "description": "Find out count of users.",
312
+ "create": {
313
+ "local": "default",
314
+ "init": {
315
+ "code": "useradd -m -s /bin/bash -G root user1 && useradd -m -s /bin/bash -G root user2"
316
+ }
317
+ },
318
+ "evaluation": {
319
+ "check": [
320
+ null,
321
+ {
322
+ "language": "python",
323
+ "file": "check/integer-match.py"
324
+ }
325
+ ],
326
+ "example": "getent passwd | wc -l"
327
+ },
328
+ "labels": ["user"]
329
+ },
330
+ {
331
+ "description": "Find out count of users who belong to at least 2 groups.",
332
+ "create": {
333
+ "local": "default",
334
+ "init": {
335
+ "code": "useradd -m -s /bin/bash -G root,sudo user1 && useradd -m -s /bin/bash -G root user2"
336
+ }
337
+ },
338
+ "evaluation": {
339
+ "check": [
340
+ null,
341
+ {
342
+ "language": "python",
343
+ "file": "check/integer-match.py"
344
+ }
345
+ ],
346
+ "example": "getent passwd | cut -d: -f1 | while read user; do groups $user | cut -d ':' -f 2 | tr -s ' ' | sed 's/^ *//;s/ *$//' | grep -q ' ' && echo $user; done | wc -l"
347
+ },
348
+ "labels": ["user"]
349
+ },
350
+ {
351
+ "description": "Find out count of users who belong to at least 4 groups.",
352
+ "create": {
353
+ "local": "default",
354
+ "init": {
355
+ "code": "useradd -m -s /bin/bash -G root,sudo,daemon,bin,sys user1 && useradd -m -s /bin/bash -G root,sudo,daemon,bin,sys user2 && useradd -m -s /bin/bash -G root user3"
356
+ }
357
+ },
358
+ "evaluation": {
359
+ "check": [
360
+ null,
361
+ {
362
+ "language": "python",
363
+ "file": "check/integer-match.py"
364
+ }
365
+ ],
366
+ "example": "getent passwd | cut -d: -f1 | while read user; do groups $user | cut -d ':' -f 2 | tr -s ' ' | sed 's/^ *//;s/ *$//' | tr ' ' '\\n' | grep -v '^$' | wc -l | grep -q -w '4' && echo $user; done | wc -l"
367
+ },
368
+ "labels": ["user"]
369
+ },
370
+ {
371
+ "description": "Recursively Find how many files have the extension .helloworld",
372
+ "create": {
373
+ "local": "default",
374
+ "init": "echo 123>/root/.tmp\necho 123>/root/.tmp2\necho 123>/root/1.helloworld\necho 123>/root/.helloworld\necho 123>/root/.u\necho 123>/root/2.helloworld\n"
375
+ },
376
+ "evaluation": {
377
+ "check": [
378
+ null,
379
+ {
380
+ "language": "python",
381
+ "file": "check/integer-match.py"
382
+ }
383
+ ],
384
+ "example": "find . -type f -name \"*.helloworld\" | wc -l"
385
+ },
386
+ "labels": ["command", "file"]
387
+ },
388
+ {
389
+ "description": "Tell me whether npm is installed or not. If so, return 'installed'. If not, return 'not-yet'",
390
+ "evaluation": {
391
+ "check": [
392
+ null,
393
+ {
394
+ "language": "python",
395
+ "file": "check/string-match.py"
396
+ }
397
+ ],
398
+ "example": "[ -x \"$(command -v npm)\" ] && echo 'installed' || echo 'not-yet'"
399
+ },
400
+ "labels": ["command", "packages"]
401
+ },
402
+ {
403
+ "description": "Tell me the max number of threads in my computer.",
404
+ "evaluation": {
405
+ "check": [
406
+ null,
407
+ {
408
+ "language": "python",
409
+ "file": "check/integer-match.py"
410
+ }
411
+ ],
412
+ "example": "cat /proc/sys/kernel/threads-max"
413
+ },
414
+ "labels": ["command", "file"]
415
+ },
416
+ {
417
+ "description": "what is the output if i execute ~/test?",
418
+ "create": {
419
+ "init": {
420
+ "code": "useradd -s /bin/bash -d /home/jack -m jack && cd /home/jack && echo 'echo Awesome-AgentBench' > test && chmod 000 test && chown jack test && su - jack"
421
+ }
422
+ },
423
+ "evaluation": {
424
+ "match": "Awesome-AgentBench"
425
+ },
426
+ "example": {
427
+ "code": "chmod 777 test && ~/test"
428
+ },
429
+ "labels": ["permission", "user"]
430
+ },
431
+ {
432
+ "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count respectively. Tell me how many times Bob sold a stock.",
433
+ "create": {
434
+ "local": "default",
435
+ "init": {
436
+ "file": "init/stock-log.sh"
437
+ }
438
+ },
439
+ "evaluation": {
440
+ "check": [
441
+ null,
442
+ {
443
+ "language": "python",
444
+ "file": "check/integer-match.py"
445
+ }
446
+ ],
447
+ "example": {
448
+ "code": "grep \"Bob | Sell\" /usr/stock.log | wc -l"
449
+ }
450
+ },
451
+ "labels": ["log", "file"]
452
+ }
453
+ ]
os_interaction/scripts/1/check/1.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ count_files() {
4
+ # echo $1 >> tmp.log
5
+ local dir=$1
6
+ local count=0
7
+
8
+ for file in "$dir"/*; do
9
+ if [ -f "$file" ]; then
10
+ count=$((count + 1))
11
+ elif [ -d "$file" ]; then
12
+ count_sub=$(count_files "$file")
13
+ count=$((count + count_sub))
14
+ fi
15
+ done
16
+
17
+ echo "$count"
18
+ }
19
+
20
+ # echo `count_files "/usr/local/bin"`, `count "/usr/local/bin"`
21
+
22
+ [ `count_files "/usr/local/bin"`x != `count "/usr/local/bin"`x ] && exit 1
23
+ [ `count_files "/root"`x != `count "/root"`x ] && exit 1
24
+ [ `count_files "/bin"`x != `count "/bin"`x ] && exit 1
25
+ [ `count_files "/lib"`x != `count "/lib"`x ] && exit 1
26
+ [ `count_files "/dev"`x != `count "/dev"`x ] && exit 1
27
+ [ `count_files "/usr/include"`x != `count "/usr/include"`x ] && exit 1
28
+ exit 0
os_interaction/scripts/1/check/containing.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v2 in v1:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/1/check/in.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v1 in v2:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/1/check/integer-match.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from sys import argv
2
+ if int(argv[1]) == int(argv[2]): exit(0)
3
+ exit(1)
os_interaction/scripts/1/check/size-match.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def analysis_size(size_str):
4
+ size_str = size_str.strip()
5
+ availables = {
6
+ "B": 1,
7
+ "Byte": 1,
8
+ "K": 1024,
9
+ "KB": 1024,
10
+ "M": 1024*1024,
11
+ "MB": 1024*1024,
12
+ "G": 1024*1024*1024,
13
+ "GB": 1024*1024*1024,
14
+ "T": 1024*1024*1024*1024,
15
+ "TB": 1024*1024*1024*1024,
16
+ "P": 1024*1024*1024*1024*1024,
17
+ "PB": 1024*1024*1024*1024*1024,
18
+ }
19
+ for size_unit in availables:
20
+ if size_str.endswith(size_unit):
21
+ return int(size_str[:-len(size_unit)]) * availables[size_unit]
22
+ return int(size_str)
23
+
24
+ if analysis_size(argv[1]) == analysis_size(argv[2]):
25
+ exit(0)
26
+ exit(1)
os_interaction/scripts/1/check/string-match.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ if norm_newline(argv[1]).strip() == norm_newline(argv[2]).strip():
7
+ exit(0)
8
+ exit(1)
os_interaction/scripts/1/example/1.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ echo '#!/bin/bash
2
+
3
+ count_files() {
4
+ local dir=$1
5
+ local count=0
6
+
7
+ for file in "$dir"/*; do
8
+ if [ -f "$file" ]; then
9
+ count=$((count + 1))
10
+ elif [ -d "$file" ]; then
11
+ count_sub=$(count_files "$file")
12
+ count=$((count + count_sub))
13
+ fi
14
+ done
15
+
16
+ echo "$count"
17
+ }
18
+
19
+ directory="$1"
20
+ total_count=$(count_files "$directory")
21
+ echo "$total_count"' > /usr/local/bin/count
22
+ chmod +x /usr/local/bin/count
os_interaction/scripts/1/init/gen_words.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ declare -a vocab=('aa' 'aaa' 'ab' 'abc' 'able' 'abut' 'ace' 'ache' 'act' 'acm')
4
+ declare -a sep=(' ' ' ' ' ' ' ')
5
+
6
+ out='/usr/words.txt'
7
+
8
+ echo -n "${vocab[RANDOM % 10]}" > "${out}"
9
+ for i in {1..99}; do
10
+ echo -n "${sep[RANDOM % 4]}${vocab[RANDOM % 10]}" >> "${out}"
11
+ done
os_interaction/scripts/1/init/install_nettools.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ apt-get update && apt-get install -y net-tools iproute2 lsof
os_interaction/scripts/1/init/nested_folders.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ create_nested_folders() {
4
+ local depth=$1 # Current depth
5
+ local max_depth=$2 # Max depth
6
+
7
+
8
+ mkdir "folder$depth"
9
+ cd "folder$depth"
10
+
11
+ touch "echo-love"
12
+
13
+ if [ $depth -eq 5 ]; then
14
+ echo "echo \"I love myself.\"" > "echo-love"
15
+ chmod +x "echo-love"
16
+ fi
17
+
18
+ if [ $depth -lt $max_depth ]; then
19
+ create_nested_folders $((depth + 1)) $max_depth
20
+ fi
21
+
22
+ cd ..
23
+ }
24
+
25
+ max_depth=10
26
+
27
+ create_nested_folders 1 $max_depth
os_interaction/scripts/1/init/stock-log.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Define the possible values for each field
4
+ names=("Alice" "Bob")
5
+ actions=("Purchase" "Sell")
6
+
7
+ # Generate 400 random lines
8
+ for ((i=1; i<=401; i++))
9
+ do
10
+ # Randomly select values for each field
11
+ name=${names[$RANDOM % ${#names[@]}]}
12
+ action=${actions[$RANDOM % ${#actions[@]}]}
13
+ stock_index=$((RANDOM % 100))
14
+ count=$((RANDOM % 1000))
15
+
16
+ # Write the line to the file
17
+ echo "$name | $action | $stock_index | $count" >> /usr/stock.log
18
+ done
os_interaction/scripts/2/check/1.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ count_files() {
4
+ # echo $1 >> tmp.log
5
+ local dir=$1
6
+ local count=0
7
+
8
+ for file in "$dir"/*; do
9
+ if [ -f "$file" ]; then
10
+ count=$((count + 1))
11
+ elif [ -d "$file" ]; then
12
+ count_sub=$(count_files "$file")
13
+ count=$((count + count_sub))
14
+ fi
15
+ done
16
+
17
+ echo "$count"
18
+ }
19
+
20
+ # echo `count_files "/usr/local/bin"`, `count "/usr/local/bin"`
21
+
22
+ [ `count_files "/usr/local/bin"`x != `count "/usr/local/bin"`x ] && exit 1
23
+ [ `count_files "/root"`x != `count "/root"`x ] && exit 1
24
+ [ `count_files "/bin"`x != `count "/bin"`x ] && exit 1
25
+ [ `count_files "/lib"`x != `count "/lib"`x ] && exit 1
26
+ [ `count_files "/dev"`x != `count "/dev"`x ] && exit 1
27
+ [ `count_files "/usr/include"`x != `count "/usr/include"`x ] && exit 1
28
+ exit 0
os_interaction/scripts/2/check/containing.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v2 in v1:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/2/check/in.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v1 in v2:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/2/check/integer-match.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from sys import argv
2
+ if int(argv[1]) == int(argv[2]): exit(0)
3
+ exit(1)
os_interaction/scripts/2/check/size-match.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def analysis_size(size_str):
4
+ size_str = size_str.strip()
5
+ availables = {
6
+ "B": 1,
7
+ "Byte": 1,
8
+ "K": 1024,
9
+ "KB": 1024,
10
+ "M": 1024*1024,
11
+ "MB": 1024*1024,
12
+ "G": 1024*1024*1024,
13
+ "GB": 1024*1024*1024,
14
+ "T": 1024*1024*1024*1024,
15
+ "TB": 1024*1024*1024*1024,
16
+ "P": 1024*1024*1024*1024*1024,
17
+ "PB": 1024*1024*1024*1024*1024,
18
+ }
19
+ for size_unit in availables:
20
+ if size_str.endswith(size_unit):
21
+ return int(size_str[:-len(size_unit)]) * availables[size_unit]
22
+ return int(size_str)
23
+
24
+ if analysis_size(argv[1]) == analysis_size(argv[2]):
25
+ exit(0)
26
+ exit(1)
os_interaction/scripts/2/check/string-match.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ if norm_newline(argv[1]).strip() == norm_newline(argv[2]).strip():
7
+ exit(0)
8
+ exit(1)
os_interaction/scripts/2/example/1.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ echo '#!/bin/bash
2
+
3
+ count_files() {
4
+ local dir=$1
5
+ local count=0
6
+
7
+ for file in "$dir"/*; do
8
+ if [ -f "$file" ]; then
9
+ count=$((count + 1))
10
+ elif [ -d "$file" ]; then
11
+ count_sub=$(count_files "$file")
12
+ count=$((count + count_sub))
13
+ fi
14
+ done
15
+
16
+ echo "$count"
17
+ }
18
+
19
+ directory="$1"
20
+ total_count=$(count_files "$directory")
21
+ echo "$total_count"' > /usr/local/bin/count
22
+ chmod +x /usr/local/bin/count
os_interaction/scripts/2/init/gen_words.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ declare -a vocab=('aa' 'aaa' 'ab' 'abc' 'able' 'abut' 'ace' 'ache' 'act' 'acm')
4
+ declare -a sep=(' ' ' ' ' ' ' ')
5
+
6
+ out='/usr/words.txt'
7
+
8
+ echo -n "${vocab[RANDOM % 10]}" > "${out}"
9
+ for i in {1..99}; do
10
+ echo -n "${sep[RANDOM % 4]}${vocab[RANDOM % 10]}" >> "${out}"
11
+ done
os_interaction/scripts/2/init/install_nettools.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ apt-get update && apt-get install -y net-tools iproute2 lsof
os_interaction/scripts/2/init/nested_folders.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ create_nested_folders() {
4
+ local depth=$1 # Current depth
5
+ local max_depth=$2 # Max depth
6
+
7
+
8
+ mkdir "folder$depth"
9
+ cd "folder$depth"
10
+
11
+ touch "echo-love"
12
+
13
+ if [ $depth -eq 5 ]; then
14
+ echo "echo \"I love myself.\"" > "echo-love"
15
+ chmod +x "echo-love"
16
+ fi
17
+
18
+ if [ $depth -lt $max_depth ]; then
19
+ create_nested_folders $((depth + 1)) $max_depth
20
+ fi
21
+
22
+ cd ..
23
+ }
24
+
25
+ max_depth=10
26
+
27
+ create_nested_folders 1 $max_depth
os_interaction/scripts/2/init/stock-log.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Define the possible values for each field
4
+ names=("Alice" "Bob")
5
+ actions=("Purchase" "Sell")
6
+
7
+ # Generate 400 random lines
8
+ for ((i=1; i<=401; i++))
9
+ do
10
+ # Randomly select values for each field
11
+ name=${names[$RANDOM % ${#names[@]}]}
12
+ action=${actions[$RANDOM % ${#actions[@]}]}
13
+ stock_index=$((RANDOM % 100))
14
+ count=$((RANDOM % 1000))
15
+
16
+ # Write the line to the file
17
+ echo "$name | $action | $stock_index | $count" >> /usr/stock.log
18
+ done
os_interaction/scripts/3/check/1.sh ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ count_files() {
4
+ # echo $1 >> tmp.log
5
+ local dir=$1
6
+ local count=0
7
+
8
+ for file in "$dir"/*; do
9
+ if [ -f "$file" ]; then
10
+ count=$((count + 1))
11
+ elif [ -d "$file" ]; then
12
+ count_sub=$(count_files "$file")
13
+ count=$((count + count_sub))
14
+ fi
15
+ done
16
+
17
+ echo "$count"
18
+ }
19
+
20
+ # echo `count_files "/usr/local/bin"`, `count "/usr/local/bin"`
21
+
22
+ [ `count_files "/usr/local/bin"`x != `count "/usr/local/bin"`x ] && exit 1
23
+ [ `count_files "/root"`x != `count "/root"`x ] && exit 1
24
+ [ `count_files "/bin"`x != `count "/bin"`x ] && exit 1
25
+ [ `count_files "/lib"`x != `count "/lib"`x ] && exit 1
26
+ [ `count_files "/dev"`x != `count "/dev"`x ] && exit 1
27
+ [ `count_files "/usr/include"`x != `count "/usr/include"`x ] && exit 1
28
+ exit 0
os_interaction/scripts/3/check/containing.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v2 in v1:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/3/check/in.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ v1 = norm_newline(argv[1]).strip()
7
+ v2 = norm_newline(argv[2]).strip()
8
+
9
+ if v1 in v2:
10
+ exit(0)
11
+ else:
12
+ exit(1)
os_interaction/scripts/3/check/integer-match.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from sys import argv
2
+ if int(argv[1]) == int(argv[2]): exit(0)
3
+ exit(1)
os_interaction/scripts/3/check/size-match.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def analysis_size(size_str):
4
+ size_str = size_str.strip()
5
+ availables = {
6
+ "B": 1,
7
+ "Byte": 1,
8
+ "K": 1024,
9
+ "KB": 1024,
10
+ "M": 1024*1024,
11
+ "MB": 1024*1024,
12
+ "G": 1024*1024*1024,
13
+ "GB": 1024*1024*1024,
14
+ "T": 1024*1024*1024*1024,
15
+ "TB": 1024*1024*1024*1024,
16
+ "P": 1024*1024*1024*1024*1024,
17
+ "PB": 1024*1024*1024*1024*1024,
18
+ }
19
+ for size_unit in availables:
20
+ if size_str.endswith(size_unit):
21
+ return int(size_str[:-len(size_unit)]) * availables[size_unit]
22
+ return int(size_str)
23
+
24
+ if analysis_size(argv[1]) == analysis_size(argv[2]):
25
+ exit(0)
26
+ exit(1)
os_interaction/scripts/3/check/string-match.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from sys import argv
2
+
3
+ def norm_newline(s):
4
+ return s.replace("\r\n", "\n").replace("\r", "\n")
5
+
6
+ if norm_newline(argv[1]).strip() == norm_newline(argv[2]).strip():
7
+ exit(0)
8
+ exit(1)
os_interaction/scripts/3/example/1.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ echo '#!/bin/bash
2
+
3
+ count_files() {
4
+ local dir=$1
5
+ local count=0
6
+
7
+ for file in "$dir"/*; do
8
+ if [ -f "$file" ]; then
9
+ count=$((count + 1))
10
+ elif [ -d "$file" ]; then
11
+ count_sub=$(count_files "$file")
12
+ count=$((count + count_sub))
13
+ fi
14
+ done
15
+
16
+ echo "$count"
17
+ }
18
+
19
+ directory="$1"
20
+ total_count=$(count_files "$directory")
21
+ echo "$total_count"' > /usr/local/bin/count
22
+ chmod +x /usr/local/bin/count
os_interaction/scripts/3/init/gen_words.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ declare -a vocab=('aa' 'aaa' 'ab' 'abc' 'able' 'abut' 'ace' 'ache' 'act' 'acm')
4
+ declare -a sep=(' ' ' ' ' ' ' ')
5
+
6
+ out='/usr/words.txt'
7
+
8
+ echo -n "${vocab[RANDOM % 10]}" > "${out}"
9
+ for i in {1..99}; do
10
+ echo -n "${sep[RANDOM % 4]}${vocab[RANDOM % 10]}" >> "${out}"
11
+ done
os_interaction/scripts/3/init/install_nettools.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ apt-get update && apt-get install -y net-tools iproute2 lsof
os_interaction/scripts/3/init/nested_folders.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ create_nested_folders() {
4
+ local depth=$1 # Current depth
5
+ local max_depth=$2 # Max depth
6
+
7
+
8
+ mkdir "folder$depth"
9
+ cd "folder$depth"
10
+
11
+ touch "echo-love"
12
+
13
+ if [ $depth -eq 5 ]; then
14
+ echo "echo \"I love myself.\"" > "echo-love"
15
+ chmod +x "echo-love"
16
+ fi
17
+
18
+ if [ $depth -lt $max_depth ]; then
19
+ create_nested_folders $((depth + 1)) $max_depth
20
+ fi
21
+
22
+ cd ..
23
+ }
24
+
25
+ max_depth=10
26
+
27
+ create_nested_folders 1 $max_depth