smartdust-client 1.3.2 → 1.3.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: 626d11e60ef6fec0b2bb5427799e640f4241fa2ef58ab4adf94af2f73140e730
4
- data.tar.gz: '072582406d885803b8afb8f724b2f0a297d8b62ca88cc7e8e6c80c41d52aca7f'
3
+ metadata.gz: 2ccb2e501ce1536eae8f61f60f29d58763d645fcf5598a0a5ddb990cf0a62f70
4
+ data.tar.gz: 65454900a8aa8915fe2bafb0bc363b1610fc49beaa16b276c4161ec71bcd2e58
5
5
  SHA512:
6
- metadata.gz: 9c82d5bf891b09ba4e174abaf599770fe22b4b8ca66d6b5f6b953a553272bdcb8a7f88a38dd1682c5de7bc0f7867bc405378ae93541ea8dd8532bad57abc67e9
7
- data.tar.gz: e636958492f295494cecdefe74cb85ce8a1c8eb82c103ccb3b9a00f3d85d0622dc9921dab83cb03294794049ba8888e94673c1551e017a5c4510c4b4107796d8
6
+ metadata.gz: 46bebb841cb1fce67e37d9d6513b96aa617e4b9d876acefd9cc0e43507d8d993a24d4100c322be07c0fa060e1d542563c734d5b7f905fc4668c19d8fe787edd2
7
+ data.tar.gz: ee49a28b2ee17791af1278083495c1093f927898166899476793bdbd320fc152faf2a7297164bc661976a4640c001d7c4fe5edd015d309b9137309a090330043
@@ -0,0 +1,31 @@
1
+ name: Docker Image
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+
14
+ - uses: docker/setup-qemu-action@v3
15
+
16
+ - uses: docker/setup-buildx-action@v3
17
+
18
+ - name: Login to DockerHub
19
+ uses: docker/login-action@v1
20
+ with:
21
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
22
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
23
+
24
+ - name: Build and push
25
+ uses: docker/build-push-action@v2
26
+ with:
27
+ context: ./
28
+ file: ./Dockerfile
29
+ platforms: linux/amd64,linux/arm64
30
+ push: true
31
+ tags: smartdust/smartdust-cli
@@ -0,0 +1,32 @@
1
+ name: Rubygem build and upload
2
+
3
+ on:
4
+ push:
5
+ # branches:
6
+ # - main
7
+
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: '3.0'
18
+
19
+ - run: bundle install
20
+
21
+ - run: gem build smartdust-client.gemspec
22
+
23
+ - name: Push gem to Nexus
24
+ run: |
25
+ gem install nexus
26
+ gem nexus --url https://repository.smartdust.me/repository/ruby/ --credential ruby-write:${{ secrets.NEXUS_CREDS }} smartdust-client-*.gem
27
+
28
+ - name: Push gem to RubyGems
29
+ run: |
30
+ gem push smartdust-client-*.gem
31
+ env:
32
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore CHANGED
@@ -101,3 +101,6 @@ build-iPhoneSimulator/
101
101
 
102
102
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
103
103
  .rvmrc
104
+
105
+ .idea
106
+ .DS_Store
data/Dockerfile ADDED
@@ -0,0 +1,17 @@
1
+ FROM ruby:3.0
2
+
3
+ RUN apt-get update && apt-get install -y android-tools-adb
4
+
5
+ WORKDIR /app
6
+
7
+ COPY . .
8
+
9
+ RUN bundle install
10
+
11
+ RUN gem build smartdust-client.gemspec
12
+
13
+ RUN gem install smartdust-client-*.gem
14
+
15
+ RUN cd / && rm -rf /app
16
+
17
+ ENTRYPOINT ["smartdust-client"]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smartdust-client (1.3.1)
4
+ smartdust-client (1.3.3)
5
5
  ADB (~> 0.5)
6
6
  dante (~> 0.2.0)
7
7
  dry-configurable (~> 0.1.4)
@@ -34,7 +34,7 @@ GEM
34
34
  ostruct
35
35
  hashdiff (1.0.1)
36
36
  json (2.6.3)
37
- logger (1.6.6)
37
+ logger (1.7.0)
38
38
  ostruct (0.6.1)
39
39
  public_suffix (5.0.1)
40
40
  rack (1.6.13)
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # Smartdust CLI client
6
6
  ![smartdust-logo-text-2021.png](smartdust-logo-text-2021.png)
7
- Documentation: https://docs.smartdust.me/docs/cli-client.
7
+ Documentation: https://docs.smartdust.me/docs/CLI%20Lab%20client/cli-client-1-3
8
8
 
9
9
  Automation client for connecting to Smartdust Lab devices via adb from a terminal.
10
10
  Designed with the following scenario in mind:
@@ -26,7 +26,6 @@ e.g. all unique names of devices in the lab instance.
26
26
  - Android dependencies:
27
27
  - adb (Android Debug Bridge)
28
28
  - iOS dependencies:
29
- - idevice_id (libimobiledevice)
30
29
  - usbfluxd (https://github.com/corellium/usbfluxd/tree/master) (this needs to be patched to connect to multiple devices from the same Lab instance)
31
30
 
32
31
  ## Installation
@@ -39,13 +38,15 @@ e.g. all unique names of devices in the lab instance.
39
38
  - "cd" into the directory where the repository is cloned
40
39
  - Run the following commands: (adding "sudo" might be needed)
41
40
  - ```gem build smartdust-client.gemspec```
42
- - ```gem install smartdust-client-1.2.0.gem``` (or different version, see output of the previous command)
41
+ - ```gem install smartdust-client-1.3.3.gem``` (or different version, see output of the previous command)
42
+
43
+ - Run it by simply entering ```smartdust-client```
43
44
 
44
45
  ## Usage
45
46
 
46
47
  ```
47
48
  NAME
48
- smartdust-client - Smartdust Lab client (version 1.2.0)
49
+ smartdust-client - Smartdust Lab client (version 1.3.3)
49
50
 
50
51
  SYNOPSIS
51
52
  smartdust-client [global options] command [command options] [arguments...]
data/lib/stf/client.rb CHANGED
@@ -55,7 +55,7 @@ module Stf
55
55
  end
56
56
 
57
57
  def destroy_tunnel(ip, port)
58
- response = execute "/api/v1/tunnel/{ip}/{port}", Net::HTTP::Delete, {ipAddress: ip, port: port}.to_json
58
+ response = execute "/api/v1/tunnel/#{ip}/#{port}", Net::HTTP::Delete
59
59
  return response.success
60
60
  end
61
61
 
@@ -11,35 +11,20 @@ module Stf
11
11
 
12
12
  def execute(device)
13
13
 
14
- if DI[:connect_ios].ios_serials_to_urls.keys.include? device.serial
14
+ if DI[:connect_ios].ios_serials_to_urls.has_key? device.serial
15
15
  DI[:connect_ios].disconnect(DI[:connect_ios].ios_serials_to_urls[device.serial])
16
16
  elsif devices.include? device.serial
17
17
  execute_adb_with 30, "disconnect #{remote_connect_url}"
18
18
  end
19
19
 
20
20
  if DeviceList.new(DI[:stf].get_user_devices).asArray.map {|d| d.serial}.include? device.serial
21
- success = false
22
- 1..10.times do
23
- begin
24
- success = DI[:stf].stop_debug(device.serial)
25
- break if success
26
- rescue
27
- end
28
-
29
- logger.error 'Can\'t stop debug session. Retrying'
30
- end
31
-
32
- 1..10.times do
33
- begin
34
- success = DI[:stf].remove_device(device.serial)
35
- break if success
36
- rescue
37
- end
38
- logger.error 'Can\'t remove device from user devices. Retrying'
39
- end
21
+
22
+ success = close_tunnel(device)
23
+ success = stop_debug(device)
24
+ success = release_control(device)
40
25
 
41
26
  if success
42
- logger.info "Successfully removed #{device.serial}"
27
+ logger.info "Removed #{device.serial}"
43
28
  else
44
29
  logger.error "Error removing #{device.serial}"
45
30
  end
@@ -47,6 +32,46 @@ module Stf
47
32
 
48
33
  success
49
34
  end
35
+
36
+ def close_tunnel(device)
37
+ provider_ip = device.getValue("provider")["ip"]
38
+ port = device.getValue("remoteConnectUrl").split(":")[1].to_i
39
+ success = false
40
+ 1..10.times do
41
+ begin
42
+ success = DI[:stf].destroy_tunnel(provider_ip, port)
43
+ break if success
44
+ rescue
45
+ end
46
+ logger.error "Can't close tunnel for device #{device.serial}. Retrying"
47
+ end
48
+ success
49
+ end
50
+
51
+ def stop_debug(device)
52
+ success = false
53
+ 1..10.times do
54
+ begin
55
+ success = DI[:stf].stop_debug(device.serial)
56
+ break if success
57
+ rescue
58
+ end
59
+ logger.error 'Can\'t stop debug session. Retrying'
60
+ end
61
+ success
62
+ end
63
+
64
+ def release_control(device)
65
+ 1..10.times do
66
+ begin
67
+ success = DI[:stf].remove_device(device.serial)
68
+ break if success
69
+ rescue
70
+ end
71
+ logger.error 'Can\'t remove device from user devices. Retrying'
72
+ end
73
+ end
74
+
50
75
  end
51
76
 
52
77
  end
data/lib/stf/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Stf
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.3'
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Stf::VERSION
9
9
  spec.authors = ['Smartdust']
10
10
  spec.email = ['jordan@smartdust.me']
11
- spec.summary = %q{Connect to devices from Smartdust Lab via adb from cli}
12
- spec.homepage = 'https://docs.smartdust.me/docs/cli-client'
11
+ spec.summary = %q{Connect to devices from Smartdust Lab from cli}
12
+ spec.homepage = 'https://docs.smartdust.me/docs/CLI%20Lab%20client/cli-client-1-3'
13
13
  spec.license = 'MIT'
14
14
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
15
  spec.require_paths = ['lib']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartdust-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smartdust
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -206,7 +206,7 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0.2'
209
- description:
209
+ description:
210
210
  email:
211
211
  - jordan@smartdust.me
212
212
  executables:
@@ -214,10 +214,13 @@ executables:
214
214
  extensions: []
215
215
  extra_rdoc_files: []
216
216
  files:
217
+ - ".github/workflows/docker-build.yml"
218
+ - ".github/workflows/ruby-build.yml"
217
219
  - ".gitignore"
218
220
  - ".rspec"
219
221
  - ".simplecov"
220
222
  - ".travis.yml"
223
+ - Dockerfile
221
224
  - Gemfile
222
225
  - Gemfile.lock
223
226
  - LICENSE.txt
@@ -247,11 +250,11 @@ files:
247
250
  - lib/stf/view/cli.rb
248
251
  - smartdust-client.gemspec
249
252
  - smartdust-logo-text-2021.png
250
- homepage: https://docs.smartdust.me/docs/cli-client
253
+ homepage: https://docs.smartdust.me/docs/CLI%20Lab%20client/cli-client-1-3
251
254
  licenses:
252
255
  - MIT
253
256
  metadata: {}
254
- post_install_message:
257
+ post_install_message:
255
258
  rdoc_options: []
256
259
  require_paths:
257
260
  - lib
@@ -266,8 +269,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
269
  - !ruby/object:Gem::Version
267
270
  version: '0'
268
271
  requirements: []
269
- rubygems_version: 3.3.5
270
- signing_key:
272
+ rubygems_version: 3.2.33
273
+ signing_key:
271
274
  specification_version: 4
272
- summary: Connect to devices from Smartdust Lab via adb from cli
275
+ summary: Connect to devices from Smartdust Lab from cli
273
276
  test_files: []