mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:33:24 +02:00
Upgrading STF for security reasons (#813)
* Upgrading STF for security reasons Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update semaphore files Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * upgrading STF for security reasons v2 Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update yarn.lock file Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
91
lib/util/adbutil.js
Normal file
91
lib/util/adbutil.js
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Copyright © 2024 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
module.exports = function(options) {
|
||||
var adb = null
|
||||
|
||||
if (adbkit.hasOwnProperty('Adb')) {
|
||||
// adbkit 3.x version
|
||||
adb = {
|
||||
client: typeof options === 'undefined' ?
|
||||
adbkit.Adb.createClient() :
|
||||
adbkit.Adb.createClient({
|
||||
host: options.adbHost
|
||||
, port: options.adbPort
|
||||
})
|
||||
, Keycode: adbkit.KeyCodes
|
||||
, Parser: adbkit.Parser
|
||||
, util: adbkit.Adb.util
|
||||
, readdir: function(serial, path) {
|
||||
return this.client.getDevice(serial).readdir(path)
|
||||
}
|
||||
, stat: function(serial, path) {
|
||||
return this.client.getDevice(serial).stat(path)
|
||||
}
|
||||
, openLocal: function(serial, path) {
|
||||
return this.client.getDevice(serial).openLocal(path)
|
||||
}
|
||||
, openLogcat: function(serial, options) {
|
||||
return this.client.getDevice(serial).openLogcat(options)
|
||||
}
|
||||
, shell: function(serial, command) {
|
||||
return this.client.getDevice(serial).shell(command)
|
||||
}
|
||||
, push: function(serial, contents, path, mode) {
|
||||
return this.client.getDevice(serial).push(contents, path, mode)
|
||||
}
|
||||
, pull: function(serial, path) {
|
||||
return this.client.getDevice(serial).pull(path)
|
||||
}
|
||||
, install: function(serial, apk) {
|
||||
return this.client.getDevice(serial).install(apk)
|
||||
}
|
||||
, installRemote: function(serial, apk) {
|
||||
return this.client.getDevice(serial).installRemote(apk)
|
||||
}
|
||||
, uninstall: function(serial, pkg) {
|
||||
return this.client.getDevice(serial).uninstall(pkg)
|
||||
}
|
||||
, clear: function(serial, pkg) {
|
||||
return this.client.getDevice(serial).clear(pkg)
|
||||
}
|
||||
, reboot: function(serial) {
|
||||
return this.client.getDevice(serial).reboot()
|
||||
}
|
||||
, waitBootComplete: function(serial) {
|
||||
return this.client.getDevice(serial).waitBootComplete()
|
||||
}
|
||||
, getPackages: function(serial) {
|
||||
return this.client.getDevice(serial).getPackages()
|
||||
}
|
||||
, getProperties: function(serial) {
|
||||
return this.client.getDevice(serial).getProperties()
|
||||
}
|
||||
, startActivity: function(serial, options) {
|
||||
return this.client.getDevice(serial).startActivity(options)
|
||||
}
|
||||
, createTcpUsbBridge: function(serial, options) {
|
||||
return this.client.createTcpUsbBridge(serial, options)
|
||||
}
|
||||
, trackDevices: function() {
|
||||
return this.client.trackDevices()
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// adbkit 2.x version
|
||||
adb = typeof options === 'undefined' ?
|
||||
adbkit.createClient() :
|
||||
adbkit.createClient({
|
||||
host: options.adbHost
|
||||
, port: options.adbPort
|
||||
})
|
||||
adb.Keycode = adbkit.Keycode
|
||||
adb.Parser = require('@devicefarmer/adbkit/lib/adb/parser')
|
||||
adb.util = adbkit.util
|
||||
}
|
||||
return adb
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright © 2019 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
* Copyright © 2019-2014 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
const Promise = require('bluebird')
|
||||
@@ -184,7 +184,7 @@ apiutil.setIntervalWrapper = function(fn, numTimes, delay) {
|
||||
return fn().then(function(result) {
|
||||
if (result.status || ++counter === numTimes) {
|
||||
if (!result.status && counter === numTimes) {
|
||||
log.debug('%s() failed %s times in a loop!', fn.name, counter)
|
||||
log.warn('%s() failed %s times in a loop!', fn.name, counter)
|
||||
}
|
||||
clearInterval(interval)
|
||||
resolve(result.data)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/**
|
||||
* Copyright © 2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var util = require('util')
|
||||
|
||||
var adb = require('@devicefarmer/adbkit')
|
||||
var adb = require('./adbutil')()
|
||||
var Promise = require('bluebird')
|
||||
|
||||
var keyutil = module.exports = Object.create(null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright © 2022 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
// Copyright © 2022-2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
//
|
||||
|
||||
// ISSUE-100 (https://github.com/openstf/stf/issues/100)
|
||||
@@ -8,7 +8,7 @@
|
||||
// Setting TCP_KEEPALIVE option true, to all the zmq sockets
|
||||
// won't let it die
|
||||
|
||||
var zmq = require('zeromq')
|
||||
var zmq = require('zeromq/v5-compat')
|
||||
|
||||
var log = require('./logger').createLogger('util:zmqutil')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user