rubber-ducky 1.2 → 1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e33895842564956ec6d310e0156ba990d7ce9c94a04fab1a063f07e568b93285
4
- data.tar.gz: a17db862e94f055747348e885d11da32ba19fef13efce0603bc10d8c2aeeef3c
3
+ metadata.gz: 455228bb92e303419712f5822167864f3a267948c99d5268e15828a8976b74ee
4
+ data.tar.gz: 3cf3c94d7fe77a10dd6e84113b2b9bf5a2b7932211f2f176a55ccf3940b76b91
5
5
  SHA512:
6
- metadata.gz: b55a40cd32ea0b1f3122e9c3c10cfeb2b0bfb523d5738953b199990180a998f003c692184a6bd70cc4a81a6a8363cc4b8f5ab3bc57a1b4e0240d589a8ab449e9
7
- data.tar.gz: 39bd00893af0105f5d68b50a487cd53d60e4bb266df72a48f5a915ac3ee55aa7dfb6735625b7c69c9e00999a25610474bfc100b7f89425f9561270d10e17b4f0
6
+ metadata.gz: c01ac49bd08f1e2df98d72d59a24cd21d2716ae2afd0fed09af8d516ad8d065145516ee904a498d15b9b1143d070498def376d3e1550e836c5bdfe3659c1f331
7
+ data.tar.gz: '048357cddb9874b82bdcdbee303640c9c73af71a8fbed5ae9207ecc205cd3b46f942421d360e35955e1d09f51eeb82da9d5794e964f384d3c02d13d3927dd2f9'
@@ -16,31 +16,30 @@ jobs:
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v4
19
-
20
- - name: Set up Ruby 2.6.10
19
+
20
+ - name: Set up Ruby
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
- ruby-version: 2.6.10
24
-
25
- - name: Publish to GPR
26
- run: |
27
- mkdir -p $HOME/.gem
28
- touch $HOME/.gem/credentials
29
- chmod 0600 $HOME/.gem/credentials
30
- printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
31
- gem build *.gemspec
32
- gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
33
- env:
34
- GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
35
- OWNER: ${{ github.repository_owner }}
36
-
37
- - name: Publish to RubyGems
38
- run: |
39
- mkdir -p $HOME/.gem
40
- touch $HOME/.gem/credentials
41
- chmod 0600 $HOME/.gem/credentials
42
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
43
- gem build *.gemspec
44
- gem push *.gem
23
+ ruby-version: 3.1.0
24
+
25
+
26
+
27
+ - name: Check Ruby version
28
+ run: ruby --version
29
+
30
+ - name: Check gem version
31
+ run: gem --version
32
+
33
+ - name: Install Bundler with verbose output
34
+ run: gem install bundler --no-document --verbose
35
+
36
+ - name: Verify Bundler installation
37
+ run: bundler --version
38
+
39
+ - name: Build the gem
40
+ run: gem build *.gemspec
41
+
42
+ - name: Push to RubyGems
43
+ run: gem push *.gem
45
44
  env:
46
45
  GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
- source "https://rubygems.org"
2
-
3
- group :development, :test do
1
+ # Gemfile
2
+ group :test do
4
3
  gem 'rspec'
5
4
  end
data/README.md CHANGED
@@ -175,3 +175,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
175
175
 
176
176
  Whether you're automating tasks with a Rubber Ducky or exploring new ways to interact with devices, the `rubber-ducky` Ruby library offers a powerful and flexible toolset to get the job done. Happy coding!
177
177
  # rubber-ducky
178
+ # rubber-ducky
data/examples/example1.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'rubber-ducky'
1
+ require 'rubber-ducky'
2
2
 
3
3
  # لتشفير المحتوى من ملف وكتابته إلى ملف
4
4
  encode = Rubber::Ducky.encode('payload.txt', output: 'inject.bin', language: 'us') # or without language to set by default
@@ -0,0 +1,182 @@
1
+ {
2
+ "__comment":"ducktoolkit/languages/ar.json",
3
+ "__comment":"All numbers here are in hex format and 0x is ignored.",
4
+ "__comment":" ",
5
+ "__comment":"This list is in ascending order of 3rd byte (HID Usage ID).",
6
+ "__comment":" See section 10 Keyboard/Keypad Page (0x07)",
7
+ "__comment":" of document USB HID Usage Tables Version 1.12.",
8
+ "__comment":" ",
9
+ "__comment":"Definition of these 3 bytes can be found",
10
+ "__comment":" in section B.1 Protocol 1 (Keyboard)",
11
+ "__comment":" of document Device Class Definition for HID Version 1.11",
12
+ "__comment":" ",
13
+ "__comment":" - byte 1: Modifier keys",
14
+ "__comment":" - byte 2: Reserved",
15
+ "__comment":" - byte 3: Keycode 1",
16
+ "__comment":" ",
17
+ "__comment":"Both documents can be obtained from link here",
18
+ "__comment":" http://www.usb.org/developers/hidpage/",
19
+ "__comment":" ",
20
+ "__comment":"A = LeftShift + a, { = LeftShift + [",
21
+ "__comment":" ",
22
+ "a":"00,00,04",
23
+ "b":"00,00,05",
24
+ "c":"00,00,06",
25
+ "d":"00,00,07",
26
+ "e":"00,00,08",
27
+ "f":"00,00,09",
28
+ "g":"00,00,0a",
29
+ "h":"00,00,0b",
30
+ "i":"00,00,0c",
31
+ "j":"00,00,0d",
32
+ "k":"00,00,0e",
33
+ "l":"00,00,0f",
34
+ "m":"00,00,10",
35
+ "n":"00,00,11",
36
+ "o":"00,00,12",
37
+ "p":"00,00,13",
38
+ "q":"00,00,14",
39
+ "r":"00,00,15",
40
+ "s":"00,00,16",
41
+ "t":"00,00,17",
42
+ "u":"00,00,18",
43
+ "v":"00,00,19",
44
+ "w":"00,00,1a",
45
+ "x":"00,00,1b",
46
+ "y":"00,00,1c",
47
+ "z":"00,00,1d",
48
+ "1":"00,00,1e",
49
+ "2":"00,00,1f",
50
+ "3":"00,00,20",
51
+ "4":"00,00,21",
52
+ "5":"00,00,22",
53
+ "6":"00,00,23",
54
+ "7":"00,00,24",
55
+ "8":"00,00,25",
56
+ "9":"00,00,26",
57
+ "0":"00,00,27",
58
+ "ENTER":"00,00,28",
59
+ "ESC":"00,00,29",
60
+ "ESCAPE":"00,00,29",
61
+ "TAB":"00,00,2b",
62
+ " ":"00,00,2c",
63
+ "SPACE":"00,00,2c",
64
+ "-":"00,00,2d",
65
+ "=":"00,00,2e",
66
+ "[":"00,00,2f",
67
+ "]":"00,00,30",
68
+ "\\":"00,00,31",
69
+ ";":"00,00,33",
70
+ "'":"00,00,34",
71
+ "`":"00,00,35",
72
+ ",":"00,00,36",
73
+ ".":"00,00,37",
74
+ "/":"00,00,38",
75
+ "CAPSLOCK":"00,00,39",
76
+ "F1":"00,00,3a",
77
+ "F2":"00,00,3b",
78
+ "F3":"00,00,3c",
79
+ "F4":"00,00,3d",
80
+ "F5":"00,00,3e",
81
+ "F6":"00,00,3f",
82
+ "F7":"00,00,40",
83
+ "F8":"00,00,41",
84
+ "F9":"00,00,42",
85
+ "F10":"00,00,43",
86
+ "F11":"00,00,44",
87
+ "F12":"00,00,45",
88
+ "PRINTSCREEN":"00,00,46",
89
+ "SCROLLLOCK":"00,00,47",
90
+ "BREAK":"00,00,48",
91
+ "PAUSE":"00,00,48",
92
+ "INSERT":"00,00,49",
93
+ "HOME":"00,00,4a",
94
+ "PAGEUP":"00,00,4b",
95
+ "DEL":"00,00,4c",
96
+ "DELETE":"00,00,4c",
97
+ "END":"00,00,4d",
98
+ "PAGEDOWN":"00,00,4e",
99
+ "RIGHT":"00,00,4f",
100
+ "RIGHTARROW":"00,00,4f",
101
+ "LEFT":"00,00,50",
102
+ "LEFTARROW":"00,00,50",
103
+ "DOWN":"00,00,51",
104
+ "DOWNARROW":"00,00,51",
105
+ "UP":"00,00,52",
106
+ "UPARROW":"00,00,52",
107
+ "APP":"00,00,65",
108
+ "MENU":"00,00,65",
109
+ "ALT-TAB":"00,00,71",
110
+ "CONTROL":"01,00,00",
111
+ "CTRL":"01,00,00",
112
+ "SHIFT":"02,00,00",
113
+ "A":"02,00,04",
114
+ "B":"02,00,05",
115
+ "C":"02,00,06",
116
+ "D":"02,00,07",
117
+ "E":"02,00,08",
118
+ "F":"02,00,09",
119
+ "G":"02,00,0a",
120
+ "H":"02,00,0b",
121
+ "I":"02,00,0c",
122
+ "J":"02,00,0d",
123
+ "K":"02,00,0e",
124
+ "L":"02,00,0f",
125
+ "M":"02,00,10",
126
+ "N":"02,00,11",
127
+ "O":"02,00,12",
128
+ "P":"02,00,13",
129
+ "Q":"02,00,14",
130
+ "R":"02,00,15",
131
+ "S":"02,00,16",
132
+ "T":"02,00,17",
133
+ "U":"02,00,18",
134
+ "V":"02,00,19",
135
+ "W":"02,00,1a",
136
+ "X":"02,00,1b",
137
+ "Y":"02,00,1c",
138
+ "Z":"02,00,1d",
139
+ "!":"02,00,1e",
140
+ "@":"02,00,1f",
141
+ "#":"02,00,20",
142
+ "$":"02,00,21",
143
+ "%":"02,00,22",
144
+ "^":"02,00,23",
145
+ "&":"02,00,24",
146
+ "*":"02,00,25",
147
+ "(":"02,00,26",
148
+ ")":"02,00,27",
149
+ "_":"02,00,2d",
150
+ "+":"02,00,2e",
151
+ "{":"02,00,2f",
152
+ "}":"02,00,30",
153
+ "|":"02,00,31",
154
+ ":":"02,00,33",
155
+ "\"":"02,00,34",
156
+ "~":"02,00,35",
157
+ "<":"02,00,36",
158
+ ">":"02,00,37",
159
+ "?":"02,00,38",
160
+ "CTRL-SHIFT":"03,00,00",
161
+ "ALT":"04,00,00",
162
+ "CTRL-ALT":"05,00,00",
163
+ "ALT-SHIFT":"06,00,00",
164
+ "COMMAND":"08,00,00",
165
+ "GUI":"08,00,00",
166
+ "WINDOWS":"08,00,00",
167
+ "COMMAND-OPTION":"12,00,00",
168
+ "COMMAND-CTRL-SHIFT":"12,00,00",
169
+ "COMMAND-CTRL":"12,00,00",
170
+ "GUI R": "08,00,15",
171
+ "GUI D": "08,00,07",
172
+ "CTRL S": "01,00,16",
173
+ "CTRL V": "01,00,19",
174
+ "CTRL X": "01,00,1B",
175
+ "CTRL Z": "01,00,1D",
176
+ "CTRL C": "01,00,06",
177
+ "ALT F4": "04,00,3D",
178
+ "WAKE": "00,00,83",
179
+ "SLEEP": "00,00,82",
180
+ "STOP": "00,00,78",
181
+ "POWER": "00,00,66"
182
+ }
@@ -59,11 +59,17 @@
59
59
  "TAB":"00,00,2b",
60
60
  " ":"00,00,2c",
61
61
  "SPACE":"00,00,2c",
62
- "+":"00,00,2d",
63
- "'":"00,00,31",
62
+ "-":"00,00,2d",
63
+ "=":"00,00,2e",
64
+ "[":"00,00,2f",
65
+ "]":"00,00,30",
66
+ "\\":"00,00,31",
67
+ ";":"00,00,33",
68
+ "'":"00,00,34",
69
+ "`":"00,00,35",
64
70
  ",":"00,00,36",
65
71
  ".":"00,00,37",
66
- "-":"00,00,38",
72
+ "/":"00,00,38",
67
73
  "CAPSLOCK":"00,00,39",
68
74
  "F1":"00,00,3a",
69
75
  "F2":"00,00,3b",
@@ -96,7 +102,6 @@
96
102
  "DOWNARROW":"00,00,51",
97
103
  "UP":"00,00,52",
98
104
  "UPARROW":"00,00,52",
99
- "<":"00,00,64",
100
105
  "APP":"00,00,65",
101
106
  "MENU":"00,00,65",
102
107
  "ALT-TAB":"00,00,71",
@@ -130,23 +135,26 @@
130
135
  "Y":"02,00,1c",
131
136
  "Z":"02,00,1d",
132
137
  "!":"02,00,1e",
133
- "\"":"02,00,1f",
138
+ "@":"02,00,1f",
134
139
  "#":"02,00,20",
135
- "~":"02,00,20",
140
+ "$":"02,00,21",
136
141
  "%":"02,00,22",
137
- "&":"02,00,23",
138
- "/":"02,00,24",
139
- "(":"02,00,25",
140
- ")":"02,00,26",
141
- "=":"02,00,27",
142
- "?":"02,00,2d",
143
- "`":"02,00,2e",
144
- "^":"02,00,30",
145
- "*":"02,00,31",
146
- ";":"02,00,36",
147
- ":":"02,00,37",
148
- "_":"02,00,38",
149
- ">":"02,00,64",
142
+ "^":"02,00,23",
143
+ "&":"02,00,24",
144
+ "*":"02,00,25",
145
+ "(":"02,00,26",
146
+ ")":"02,00,27",
147
+ "_":"02,00,2d",
148
+ "+":"02,00,2e",
149
+ "{":"02,00,2f",
150
+ "}":"02,00,30",
151
+ "|":"02,00,31",
152
+ ":":"02,00,33",
153
+ "\"":"02,00,34",
154
+ "~":"02,00,35",
155
+ "<":"02,00,36",
156
+ ">":"02,00,37",
157
+ "?":"02,00,38",
150
158
  "CTRL-SHIFT":"03,00,00",
151
159
  "ALT":"04,00,00",
152
160
  "CTRL-ALT":"05,00,00",
@@ -155,15 +163,18 @@
155
163
  "GUI":"08,00,00",
156
164
  "WINDOWS":"08,00,00",
157
165
  "COMMAND-OPTION":"12,00,00",
158
- "@":"40,00,1f",
159
- "$":"40,00,21",
160
- "{":"40,00,24",
161
- "[":"40,00,25",
162
- "]":"40,00,26",
163
- "}":"40,00,27",
164
- "\\":"40,00,2d",
165
- "|":"40,00,64",
166
- "COMMAND-CTRL-SHIFT":"40,00,64",
167
- "COMMAND-CTRL":"40,00,64",
168
- "COMMAND-OPTION-SHIFT'":"40,00,64"
166
+ "COMMAND-CTRL-SHIFT":"12,00,00",
167
+ "COMMAND-CTRL":"12,00,00",
168
+ "GUI R": "08,00,15",
169
+ "GUI D": "08,00,07",
170
+ "CTRL S": "01,00,16",
171
+ "CTRL V": "01,00,19",
172
+ "CTRL X": "01,00,1B",
173
+ "CTRL Z": "01,00,1D",
174
+ "CTRL C": "01,00,06",
175
+ "ALT F4": "04,00,3D",
176
+ "WAKE": "00,00,83",
177
+ "SLEEP": "00,00,82",
178
+ "STOP": "00,00,78",
179
+ "POWER": "00,00,66"
169
180
  }
@@ -41,8 +41,8 @@
41
41
  "v":"00,00,19",
42
42
  "w":"00,00,1a",
43
43
  "x":"00,00,1b",
44
- "z":"00,00,1c",
45
- "y":"00,00,1d",
44
+ "y":"00,00,1c",
45
+ "z":"00,00,1d",
46
46
  "1":"00,00,1e",
47
47
  "2":"00,00,1f",
48
48
  "3":"00,00,20",
@@ -59,11 +59,17 @@
59
59
  "TAB":"00,00,2b",
60
60
  " ":"00,00,2c",
61
61
  "SPACE":"00,00,2c",
62
- "'":"00,00,2d",
63
- "+":"00,00,2e",
62
+ "-":"00,00,2d",
63
+ "=":"00,00,2e",
64
+ "[":"00,00,2f",
65
+ "]":"00,00,30",
66
+ "\\":"00,00,31",
67
+ ";":"00,00,33",
68
+ "'":"00,00,34",
69
+ "`":"00,00,35",
64
70
  ",":"00,00,36",
65
71
  ".":"00,00,37",
66
- "-":"00,00,38",
72
+ "/":"00,00,38",
67
73
  "CAPSLOCK":"00,00,39",
68
74
  "F1":"00,00,3a",
69
75
  "F2":"00,00,3b",
@@ -96,7 +102,6 @@
96
102
  "DOWNARROW":"00,00,51",
97
103
  "UP":"00,00,52",
98
104
  "UPARROW":"00,00,52",
99
- "<":"00,00,64",
100
105
  "APP":"00,00,65",
101
106
  "MENU":"00,00,65",
102
107
  "ALT-TAB":"00,00,71",
@@ -127,24 +132,29 @@
127
132
  "V":"02,00,19",
128
133
  "W":"02,00,1a",
129
134
  "X":"02,00,1b",
130
- "Z":"02,00,1c",
131
- "Y":"02,00,1d",
135
+ "Y":"02,00,1c",
136
+ "Z":"02,00,1d",
132
137
  "!":"02,00,1e",
133
- "\"":"02,00,1f",
138
+ "@":"02,00,1f",
134
139
  "#":"02,00,20",
135
140
  "$":"02,00,21",
136
141
  "%":"02,00,22",
137
- "&":"02,00,23",
138
- "/":"02,00,24",
139
- "(":"02,00,25",
140
- ")":"02,00,26",
141
- "=":"02,00,27",
142
- "?":"02,00,2d",
143
- "*":"02,00,2e",
144
- ";":"02,00,36",
145
- ":":"02,00,37",
146
- "_":"02,00,38",
147
- ">":"02,00,64",
142
+ "^":"02,00,23",
143
+ "&":"02,00,24",
144
+ "*":"02,00,25",
145
+ "(":"02,00,26",
146
+ ")":"02,00,27",
147
+ "_":"02,00,2d",
148
+ "+":"02,00,2e",
149
+ "{":"02,00,2f",
150
+ "}":"02,00,30",
151
+ "|":"02,00,31",
152
+ ":":"02,00,33",
153
+ "\"":"02,00,34",
154
+ "~":"02,00,35",
155
+ "<":"02,00,36",
156
+ ">":"02,00,37",
157
+ "?":"02,00,38",
148
158
  "CTRL-SHIFT":"03,00,00",
149
159
  "ALT":"04,00,00",
150
160
  "CTRL-ALT":"05,00,00",
@@ -153,17 +163,18 @@
153
163
  "GUI":"08,00,00",
154
164
  "WINDOWS":"08,00,00",
155
165
  "COMMAND-OPTION":"12,00,00",
156
- "{":"40,00,05",
157
- "[":"40,00,09",
158
- "]":"40,00,0a",
159
- "}":"40,00,11",
160
- "\\":"40,00,14",
161
- "@":"40,00,19",
162
- "|":"40,00,1a",
163
- "~":"40,00,1e",
164
- "^":"40,00,20",
165
- "`":"40,00,24",
166
- "COMMAND-CTRL-SHIFT":"40,00,24",
167
- "COMMAND-CTRL":"40,00,24",
168
- "COMMAND-OPTION-SHIFT'":"40,00,24"
166
+ "COMMAND-CTRL-SHIFT":"12,00,00",
167
+ "COMMAND-CTRL":"12,00,00",
168
+ "GUI R": "08,00,15",
169
+ "GUI D": "08,00,07",
170
+ "CTRL S": "01,00,16",
171
+ "CTRL V": "01,00,19",
172
+ "CTRL X": "01,00,1B",
173
+ "CTRL Z": "01,00,1D",
174
+ "CTRL C": "01,00,06",
175
+ "ALT F4": "04,00,3D",
176
+ "WAKE": "00,00,83",
177
+ "SLEEP": "00,00,82",
178
+ "STOP": "00,00,78",
179
+ "POWER": "00,00,66"
169
180
  }
@@ -42,21 +42,35 @@
42
42
  "v":"00,00,19",
43
43
  "w":"00,00,1a",
44
44
  "x":"00,00,1b",
45
- "z":"00,00,1c",
46
- "y":"00,00,1d",
47
- "+":"00,00,1e",
45
+ "y":"00,00,1c",
46
+ "z":"00,00,1d",
47
+ "1":"00,00,1e",
48
+ "2":"00,00,1f",
49
+ "3":"00,00,20",
50
+ "4":"00,00,21",
51
+ "5":"00,00,22",
52
+ "6":"00,00,23",
53
+ "7":"00,00,24",
54
+ "8":"00,00,25",
55
+ "9":"00,00,26",
56
+ "0":"00,00,27",
48
57
  "ENTER":"00,00,28",
49
58
  "ESC":"00,00,29",
50
59
  "ESCAPE":"00,00,29",
51
60
  "TAB":"00,00,2b",
52
61
  " ":"00,00,2c",
53
62
  "SPACE":"00,00,2c",
54
- "CTRL-ALT":"05,00,00",
55
- "=":"00,00,2d",
56
- ";":"00,00,35",
63
+ "-":"00,00,2d",
64
+ "=":"00,00,2e",
65
+ "[":"00,00,2f",
66
+ "]":"00,00,30",
67
+ "\\":"00,00,31",
68
+ ";":"00,00,33",
69
+ "'":"00,00,34",
70
+ "`":"00,00,35",
57
71
  ",":"00,00,36",
58
72
  ".":"00,00,37",
59
- "-":"00,00,38",
73
+ "/":"00,00,38",
60
74
  "CAPSLOCK":"00,00,39",
61
75
  "F1":"00,00,3a",
62
76
  "F2":"00,00,3b",
@@ -119,45 +133,32 @@
119
133
  "V":"02,00,19",
120
134
  "W":"02,00,1a",
121
135
  "X":"02,00,1b",
122
- "Z":"02,00,1c",
123
- "Y":"02,00,1d",
124
- "1":"02,00,1e",
125
- "2":"02,00,1f",
126
- "3":"02,00,20",
127
- "4":"02,00,21",
128
- "5":"02,00,22",
129
- "6":"02,00,23",
130
- "7":"02,00,24",
131
- "8":"02,00,25",
132
- "9":"02,00,26",
133
- "0":"02,00,27",
134
- "\\":"05,00,14",
135
- "%":"02,00,2d",
136
- "/":"02,00,2f",
137
- "(":"02,00,30",
138
- "'":"05,00,13",
139
- ")":"02,00,31",
140
- "\"":"02,00,33",
141
- "!":"02,00,34",
142
- "?":"02,00,36",
143
- ":":"02,00,37",
144
- "_":"02,00,38",
145
- "|":"05,00,1a",
146
- "#":"05,00,1b",
147
- "&":"05,00,06",
148
- "@":"05,00,19",
149
- "$":"05,00,33",
150
- "*":"05,00,38",
151
- "{":"05,00,05",
152
- "}":"05,00,11",
153
- "[":"05,00,09",
154
- "]":"05,00,0a",
155
- "~":"05,00,1e",
156
- "^":"05,00,20",
157
- "<":"05,00,36",
158
- ">":"05,00,37",
136
+ "Y":"02,00,1c",
137
+ "Z":"02,00,1d",
138
+ "!":"02,00,1e",
139
+ "@":"02,00,1f",
140
+ "#":"02,00,20",
141
+ "$":"02,00,21",
142
+ "%":"02,00,22",
143
+ "^":"02,00,23",
144
+ "&":"02,00,24",
145
+ "*":"02,00,25",
146
+ "(":"02,00,26",
147
+ ")":"02,00,27",
148
+ "_":"02,00,2d",
149
+ "+":"02,00,2e",
150
+ "{":"02,00,2f",
151
+ "}":"02,00,30",
152
+ "|":"02,00,31",
153
+ ":":"02,00,33",
154
+ "\"":"02,00,34",
155
+ "~":"02,00,35",
156
+ "<":"02,00,36",
157
+ ">":"02,00,37",
158
+ "?":"02,00,38",
159
159
  "CTRL-SHIFT":"03,00,00",
160
160
  "ALT":"04,00,00",
161
+ "CTRL-ALT":"05,00,00",
161
162
  "ALT-SHIFT":"06,00,00",
162
163
  "COMMAND":"08,00,00",
163
164
  "GUI":"08,00,00",
@@ -165,5 +166,16 @@
165
166
  "COMMAND-OPTION":"12,00,00",
166
167
  "COMMAND-CTRL-SHIFT":"12,00,00",
167
168
  "COMMAND-CTRL":"12,00,00",
168
- "COMMAND-OPTION-SHIFT'":"12,00,00"
169
+ "GUI R": "08,00,15",
170
+ "GUI D": "08,00,07",
171
+ "CTRL S": "01,00,16",
172
+ "CTRL V": "01,00,19",
173
+ "CTRL X": "01,00,1B",
174
+ "CTRL Z": "01,00,1D",
175
+ "CTRL C": "01,00,06",
176
+ "ALT F4": "04,00,3D",
177
+ "WAKE": "00,00,83",
178
+ "SLEEP": "00,00,82",
179
+ "STOP": "00,00,78",
180
+ "POWER": "00,00,66"
169
181
  }
@@ -9,6 +9,7 @@
9
9
  "__comment":"Definition of these 3 bytes can be found",
10
10
  "__comment":" in section B.1 Protocol 1 (Keyboard)",
11
11
  "__comment":" of document Device Class Definition for HID Version 1.11",
12
+ "__comment":" ",
12
13
  "__comment":" - byte 1: Modifier keys",
13
14
  "__comment":" - byte 2: Reserved",
14
15
  "__comment":" - byte 3: Keycode 1",
@@ -166,5 +167,110 @@
166
167
  "COMMAND-OPTION":"12,00,00",
167
168
  "COMMAND-CTRL-SHIFT":"12,00,00",
168
169
  "COMMAND-CTRL":"12,00,00",
169
- "COMMAND-OPTION-SHIFT'":"12,00,00"
170
+ "GUI R": "08,00,15",
171
+ "GUI D": "08,00,07",
172
+ "CTRL S": "01,00,16",
173
+ "CTRL V": "01,00,19",
174
+ "CTRL X": "01,00,1B",
175
+ "CTRL Z": "01,00,1D",
176
+ "CTRL C": "01,00,06",
177
+ "ALT F4": "04,00,3D",
178
+ "WAKE": "00,00,83",
179
+ "SLEEP": "00,00,82",
180
+ "STOP": "00,00,78",
181
+ "POWER": "00,00,66",
182
+ "GUI R": "08,00,15",
183
+ "GUI D": "08,00,07",
184
+ "GUI E": "08,00,08",
185
+ "GUI L": "08,00,0F",
186
+ "GUI X": "08,00,1B",
187
+ "GUI I": "08,00,0C",
188
+ "GUI V": "08,00,19",
189
+ "GUI TAB": "08,00,2B",
190
+ "GUI SPACE": "08,00,2C",
191
+ "GUI DOT": "08,00,37",
192
+ "GUI PRINTSCREEN": "08,00,46",
193
+ "COMMAND SPACE": "08,00,2C",
194
+ "COMMAND TAB": "08,00,2B",
195
+ "COMMAND Q": "08,00,14",
196
+ "COMMAND W": "08,00,1A",
197
+ "COMMAND N": "08,00,11",
198
+ "COMMAND C": "08,00,06",
199
+ "COMMAND V": "08,00,19",
200
+ "COMMAND X": "08,00,1B",
201
+ "COMMAND Z": "08,00,1D",
202
+ "COMMAND SHIFT 3": "0A,00,20",
203
+ "COMMAND SHIFT 4": "0A,00,21",
204
+ "CTRL S": "01,00,16",
205
+ "CTRL O": "01,00,12",
206
+ "CTRL N": "01,00,11",
207
+ "CTRL P": "01,00,13",
208
+ "CTRL F": "01,00,09",
209
+ "CTRL H": "01,00,0B",
210
+ "CTRL A": "01,00,04",
211
+ "CTRL C": "01,00,06",
212
+ "CTRL V": "01,00,19",
213
+ "CTRL X": "01,00,1B",
214
+ "CTRL Z": "01,00,1D",
215
+ "CTRL Y": "01,00,1C",
216
+ "CTRL ESC": "01,00,29",
217
+ "CTRL ALT T": "05,00,17",
218
+ "CTRL ALT DEL": "05,00,4C",
219
+ "ALT F4": "04,00,3D",
220
+ "ALT TAB": "04,00,2B",
221
+ "ALT SPACE": "04,00,2C",
222
+ "ALT ENTER": "04,00,28",
223
+ "F1": "00,00,3A",
224
+ "F2": "00,00,3B",
225
+ "F3": "00,00,3C",
226
+ "F4": "00,00,3D",
227
+ "F5": "00,00,3E",
228
+ "F6": "00,00,3F",
229
+ "F11": "00,00,44",
230
+ "F12": "00,00,45",
231
+ "POWER": "00,00,66",
232
+ "SLEEP": "00,00,82",
233
+ "WAKE": "00,00,83",
234
+ "STOP": "00,00,78",
235
+ "VOLUMEUP": "00,00,80",
236
+ "VOLUMEDOWN": "00,00,81",
237
+ "MUTE": "00,00,7F",
238
+ "PLAYPAUSE": "00,00,7C",
239
+ "NEXTTRACK": "00,00,7D",
240
+ "PREVTRACK": "00,00,7E",
241
+ "HOME": "00,00,4A",
242
+ "MENU": "00,00,65",
243
+ "APP_SWITCH": "00,00,71",
244
+ "SEARCH": "00,00,70",
245
+ "CTRL SHIFT": "03,00,00",
246
+ "GUI SHIFT": "0A,00,00",
247
+ "CTRL ALT": "05,00,00",
248
+ "CTRL GUI": "09,00,00",
249
+ "ALT GUI": "0C,00,00",
250
+ "BRIGHTNESSUP": "00,00,6F",
251
+ "BRIGHTNESSDOWN": "00,00,70",
252
+ "EJECT": "00,00,68",
253
+ "CALCULATOR": "00,00,67",
254
+ "BROWSER_BACK": "00,00,8A",
255
+ "BROWSER_FWD": "00,00,8B",
256
+ "BROWSER_REF": "00,00,8C",
257
+ "BROWSER_HOME": "00,00,8D",
258
+ "F13": "00,00,68",
259
+ "F14": "00,00,69",
260
+ "F15": "00,00,6A",
261
+ "F16": "00,00,6B",
262
+ "F17": "00,00,6C",
263
+ "F18": "00,00,6D",
264
+ "F19": "00,00,6E",
265
+ "SYSTEM_POWER": "00,00,66",
266
+ "SYSTEM_SLEEP": "00,00,82",
267
+ "SYSTEM_WAKE": "00,00,83",
268
+ "cmdDELAY": "00,00,00",
269
+ "netsh": "00,00,01",
270
+ "advfirewall": "00,00,02",
271
+ "set": "00,00,03",
272
+ "allprofiles": "00,00,04",
273
+ "state": "00,00,05",
274
+ "offENTER": "00,00,06"
275
+
170
276
  }
@@ -1,5 +1,6 @@
1
+ # lib/rubber-ducky/decoder.rb
2
+
1
3
  require 'json'
2
- require 'base64'
3
4
  require_relative 'common'
4
5
 
5
6
  module Rubber
@@ -7,45 +8,88 @@ module Rubber
7
8
  module Decoder
8
9
  def self.decode(content, language)
9
10
  lang_file = Common.load_language(language)
10
- ducky_hex = content.unpack1('H*')
11
+ ducky_hex = content.unpack1('H*').upcase
11
12
  decoded_bin = ""
12
- duck_decoded = ""
13
+ current_string = ""
14
+ i = 0
13
15
 
14
- (0...ducky_hex.length).step(4) do |i|
15
- decoded_key = ""
16
- last_key = duck_decoded
16
+ while i < ducky_hex.length
17
+ decoded_key = nil
17
18
  duck_decoded = ducky_hex[i, 4]
18
19
 
20
+ if duck_decoded == "00FF"
21
+ delay_value = 0
22
+ while duck_decoded == "00FF"
23
+ delay_value += 255
24
+ i += 4
25
+ duck_decoded = ducky_hex[i, 4] || "0000"
26
+ end
27
+ if duck_decoded[0, 2] == "00"
28
+ delay_byte = duck_decoded[2, 2]
29
+ delay_value += delay_byte.to_i(16)
30
+ i += 4
31
+ end
32
+ if current_string != ""
33
+ decoded_bin += "STRING #{current_string}\n"
34
+ current_string = ""
35
+ end
36
+ decoded_bin += "DELAY #{delay_value}\n"
37
+ next
38
+ end
39
+
19
40
  lang_file.each do |key, value|
20
41
  begin
21
42
  new_value = value.split(',')
22
43
  if new_value.length == 3
23
44
  value = "#{new_value[2]}#{new_value[0]}"
24
45
  end
25
- rescue => e
46
+ rescue
26
47
  next
27
48
  end
28
49
 
29
- if duck_decoded == "2c00"
50
+ value = value.upcase
51
+
52
+ if duck_decoded == "2C00"
30
53
  decoded_key = " "
31
- elsif duck_decoded == "00ff" && last_key != "00ff"
32
- decoded_key = "DELAY"
54
+ break
33
55
  elsif duck_decoded == value
34
56
  decoded_key = key
35
- else
36
- if duck_decoded[-2, 2] == "00"
37
- if duck_decoded[0, 2] == value
38
- decoded_key = key إذا كان طول المفتاح يساوي 1
39
- end
40
- end
57
+ break
58
+ elsif duck_decoded[-2, 2] == "00" && value[-2,2] == "00" && duck_decoded[0,2] == value[0,2]
59
+ decoded_key = key if key.length == 1
60
+ break
41
61
  end
42
62
  end
43
63
 
44
- if Common::DECODER_COMMAND_KEYS.include?(decoded_key)
45
- decoded_bin += decoded_key + "\n"
64
+ if decoded_key
65
+ if Common::DECODER_COMMAND_KEYS.include?(decoded_key.upcase)
66
+ if current_string != ""
67
+ decoded_bin += "STRING #{current_string}\n"
68
+ current_string = ""
69
+ end
70
+ decoded_bin += "#{decoded_key.upcase}\n"
71
+ elsif decoded_key.length == 1 || decoded_key == " "
72
+ current_string += decoded_key
73
+ else
74
+ if current_string != ""
75
+ decoded_bin += "STRING #{current_string}\n"
76
+ current_string = ""
77
+ end
78
+ decoded_bin += "#{decoded_key}\n"
79
+ end
46
80
  else
47
- decoded_bin += decoded_key
81
+ if current_string != ""
82
+ decoded_bin += "STRING #{current_string}\n"
83
+ current_string = ""
84
+ end
85
+ decoded_bin += "UNKNOWN\n"
48
86
  end
87
+
88
+ i += 4
89
+ end
90
+
91
+ if current_string != ""
92
+ decoded_bin += "STRING #{current_string}\n"
49
93
  end
50
94
 
51
95
  decoded_bin
@@ -1,3 +1,4 @@
1
+ # lib/rubber-ducky/version.rb
1
2
  module Rubber
2
3
  module Ducky
3
4
  VERSION = '1.0'.freeze
data/lib/rubber-ducky.rb CHANGED
@@ -1,8 +1,9 @@
1
+ # lib/rubber-ducky.rb
2
+ # ملف الرئيسي
1
3
  require_relative 'rubber-ducky/common'
2
4
  require_relative 'rubber-ducky/encoder'
3
5
  require_relative 'rubber-ducky/decoder'
4
6
 
5
-
6
7
  module Rubber
7
8
  module Ducky
8
9
  def self.encode(input_file, output: nil, language: 'us')
data/rubber-ducky.gemspec CHANGED
@@ -2,15 +2,14 @@ require File.expand_path('lib/rubber-ducky/version', __dir__)
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'rubber-ducky'
5
- spec.version = spec.version = '1.2'
5
+ spec.version = '1.3'
6
6
  spec.authors = 'MAVEN'
7
- spec.email = 'aszda33@gmail.com'
8
7
  spec.summary = 'A Ruby library for encoding and decoding Rubber Ducky scripts.'
9
8
  spec.description = 'This gem allows you to encode and decode Rubber Ducky scripts for penetration testing purposes.'
10
9
  spec.homepage = 'https://github.com/Abo5/rubber-ducky'
11
10
  spec.license = 'MIT'
12
11
  spec.platform = Gem::Platform::RUBY
13
- spec.required_ruby_version = '>= 2.7.0'
12
+ spec.required_ruby_version = '>= 2.5.0'
14
13
 
15
14
  # Include all files from git tracking, excluding test, spec, and features
16
15
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -25,7 +24,6 @@ Gem::Specification.new do |spec|
25
24
  # Define runtime and development dependencies
26
25
  spec.add_runtime_dependency 'json', '~> 2.0'
27
26
 
28
-
29
27
  spec.add_development_dependency 'bundler', '~> 2.0'
30
28
  spec.add_development_dependency 'rake', '~> 13.0'
31
29
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubber-ducky
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - MAVEN
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-16 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: '3.0'
69
69
  description: This gem allows you to encode and decode Rubber Ducky scripts for penetration
70
70
  testing purposes.
71
- email: aszda33@gmail.com
71
+ email:
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -84,6 +84,7 @@ files:
84
84
  - README.md
85
85
  - Rakefile
86
86
  - examples/example1.rb
87
+ - lib/languages/ar.json
87
88
  - lib/languages/be.json
88
89
  - lib/languages/br.json
89
90
  - lib/languages/ca-fr.json
@@ -124,14 +125,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
125
  requirements:
125
126
  - - ">="
126
127
  - !ruby/object:Gem::Version
127
- version: 2.7.0
128
+ version: 2.5.0
128
129
  required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  requirements:
130
131
  - - ">="
131
132
  - !ruby/object:Gem::Version
132
133
  version: '0'
133
134
  requirements: []
134
- rubygems_version: 3.0.3.1
135
+ rubygems_version: 3.3.3
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: A Ruby library for encoding and decoding Rubber Ducky scripts.