Send an erase device command to this object

 @param passcode[String] a six-char passcode, required for computers & computergroups

 @return (see .send_mdm_command)
1090
def erase_device(passcode = '', preserve_data_plan: false)
      self.class.erase_device @id, passcode: passcode, preserve_data_plan: preserve_data_plan, api: @api
    end
560664
def _send_string_clipboard(self, string: str, paste_command: model.SendMode):
        
        backup = self.clipboard.text  # Keep a backup of current content, to restore the original afterwards.
        if backup is None:
            logger.warning("Tried to backup the X clipboard content, but got None instead of a string.")
        self.clipboard.text = string
        try:
            self.mediator.send_string(paste_command.value)
        finally:
            self.ungrab_keyboard()
        # Because send_string is queued, also enqueue the clipboard restore, to keep the proper action ordering.
        self.__enqueue(self._restore_clipboard_text, backup)
1095164
def mass_erase():
    """"""
    # Send DNLOAD with first byte=0x41
    __dev.ctrl_transfer(0x21, __DFU_DNLOAD, 0, __DFU_INTERFACE,
                        "\x41", __TIMEOUT)

    # Execute last command
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_BUSY:
        raise Exception("DFU: erase failed")

    # Check command state
    if get_status() != __DFU_STATE_DFU_DOWNLOAD_IDLE:
        raise Exception("DFU: erase failed")
750857
def a_send_password(password, ctx):
    
    if password:
        ctx.ctrl.send_command(password, password=True)
        return True
    else:
        ctx.ctrl.disconnect()
        raise ConnectionAuthenticationError("Password not provided", ctx.ctrl.hostname)
1327858
private String createPrintableCommand(final List<String> cmd) {
        final List<String> cmdToOutput = new ArrayList<>();
        cmdToOutput.addAll(cmd);

        int passwordIndex = cmdToOutput.indexOf("--password");
        if (passwordIndex > -1) {
            // The User's password will be at the next index
            passwordIndex++;
        }

        int proxyPasswordIndex = -1;
        for (int commandIndex = 0; commandIndex < cmdToOutput.size(); commandIndex++) {
            final String commandParameter = cmdToOutput.get(commandIndex);
            if (commandParameter.contains("-Dhttp.proxyPassword=")) {
                proxyPasswordIndex = commandIndex;
            }
        }

        maskIndex(cmdToOutput, passwordIndex);
        maskIndex(cmdToOutput, proxyPasswordIndex);

        return StringUtils.join(cmdToOutput, " ");
    }
1311997
def _makepass(password, hasher='sha256'):
    '''
    
    '''
    # Setup the hasher
    if hasher == 'sha256':
        h = hashlib.sha256(password)
    elif hasher == 'md5':
        h = hashlib.md5(password)
    else:
        return NotImplemented

    c = "abcdefghijklmnopqrstuvwxyz" \
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
        "0123456789!?.,:;/*-+_()"
    r = {
        'Method': h.name,
        'Salt': ''.join(random.SystemRandom().choice(c) for x in range(20)),
    }

    # Salt the password hash
    h.update(r['Salt'])
    r['Hash'] = h.hexdigest()

    return r
1243801
def SendCommand(self, Command):
        
        try:
            self._Api.send_command(Command)
        except SkypeAPIError:
            self.ResetCache()
            raise
17352
def oper(self, name, password):
        
        with self.lock:
            self.send('OPER %s %s' % (name, password))
            snomasks = ''
            new_umodes = ''
            if self.readable():
                    msg = self._recv(expected_replies=( \
                                                    'MODE', '381', '008'))
                    if msg[0] == 'MODE':
                            new_umodes = msg[2].replace(':', '', 1)
                    elif msg[0] == '381':
                            return new_umodes, snomasks
                    elif msg[0] == '008':
                            snomasks = msg[2].split('(')[1].split(')')[0]
1366781
def send(self, cmd, timeout, wait_for_string, password):
        """"""
        return self.target_device.send(cmd, timeout=timeout, wait_for_string=wait_for_string, password=password)
972244
def ExportNEP2(self, passphrase):
        
        if len(passphrase) < 2:
            raise ValueError("Passphrase must have a minimum of 2 characters")

        # Hash address twice, then only use the first 4 bytes
        address_hash_tmp = hashlib.sha256(self.GetAddress().encode("utf-8")).digest()
        address_hash_tmp2 = hashlib.sha256(address_hash_tmp).digest()
        address_hash = address_hash_tmp2[:4]

        # Normalize password and run scrypt over it with the address_hash
        pwd_normalized = bytes(unicodedata.normalize('NFC', passphrase), 'utf-8')
        derived = scrypt.hash(pwd_normalized, address_hash,
                              N=SCRYPT_ITERATIONS,
                              r=SCRYPT_BLOCKSIZE,
                              p=SCRYPT_PARALLEL_FACTOR,
                              buflen=SCRYPT_KEY_LEN_BYTES)

        # Split the scrypt-result into two parts
        derived1 = derived[:32]
        derived2 = derived[32:]

        # Run XOR and encrypt the derived parts with AES
        xor_ed = xor_bytes(bytes(self.PrivateKey), derived1)
        cipher = AES.new(derived2, AES.MODE_ECB)
        encrypted = cipher.encrypt(xor_ed)

        # Assemble the final result
        assembled = bytearray()
        assembled.extend(NEP_HEADER)
        assembled.extend(NEP_FLAG)
        assembled.extend(address_hash)
        assembled.extend(encrypted)

        # Finally, encode with Base58Check
        encrypted_key_nep2 = base58.b58encode_check(bytes(assembled))
        return encrypted_key_nep2.decode("utf-8")
475321
def erase_all(self):
        
        assert self._active_operation == self.Operation.ERASE
        assert self.is_erase_all_supported

        # update core register to execute the erase_all subroutine
        result = self._call_function_and_wait(self.flash_algo['pc_eraseAll'])

        # check the return code
        if result != 0:
            raise FlashEraseFailure('erase_all error: %i' % result, result_code=result)
1364397
function passthrough(devicename, baudrate, initialCommand=null){
    return new Promise(function(resolve, reject){

        // try to open the serial port
        const _device = new _serialport(devicename, {
            baudRate: parseInt(baudrate),
            autoOpen: false
        }); 

        // new length parser
        const parser = _device.pipe(new _lengthParser({length: 1}));

        // handle low-level errors
        _device.on('error', reject);

        // listen on incomming data
        parser.on('data', function(input){
            // passthrough
            process.stdout.write(input.toString('utf8'));
        });

        // open connection
        _device.open(function(err){
            if (err){
                reject(err);
            }else{
                // prepare
                if (process.stdin.isTTY){
                    process.stdin.setRawMode(true);
                }
                
                process.stdin.setEncoding('utf8');

                // initial command set ?
                if (initialCommand !== null){
                    _device.write(initialCommand + '\n');
                }

                // pass-through
                process.stdin.on('data', function(data){
                    // ctrl-c ?
                    if (data == '\u0003'){
                        _device.close(function(e){
                            if (e){
                                reject(e);
                            }else{
                                resolve();
                            }
                        });
                    }else{
                        // passthrough stdin->serial
                        _device.write(data);
                    }
                });
            }
        });
    });
}
826982
def create_LM_hashed_password_v1(passwd):
    """"""

    # if the passwd provided is already a hash, we just return the first half
    if re.match(r'^[\w]{32}:[\w]{32}$', passwd):
        return binascii.unhexlify(passwd.split(':')[0])

    # fix the password length to 14 bytes
    passwd = passwd.upper()
    lm_pw = passwd + '\0' * (14 - len(passwd))
    lm_pw = passwd[0:14]

    # do hash
    magic_str = b"KGS!@#$%"  # page 57 in [MS-NLMP]

    res = b''
    dobj = des.DES(lm_pw[0:7])
    res = res + dobj.encrypt(magic_str)

    dobj = des.DES(lm_pw[7:14])
    res = res + dobj.encrypt(magic_str)

    return res
619069
def send_command(command)
      SerialPort.open(self.device_path, 9600, 8, 1) do |port|
        # flush anything existing on the port
        port.flush
        flush_read_buffer(port)

        byte_string = command.to_bytes.pack('C*')

        begin
          while byte_string && byte_string.length != 0
            count = port.write_nonblock(byte_string)
            byte_string = byte_string[count,-1]

            port.flush
          end
        rescue IO::WaitWritable
          if IO.select([], [port], [], 5)
            retry
          else
            raise IOError, "Timeout writing command to #{self.device_path}"
          end
        end

        # wait for expected confirmation signals
        got_eot = false
        got_soh = false
        loop do
          begin
            c = port.read_nonblock(1)

            case c
              when "\x04"
                if ! got_eot
                  got_eot = true
                else
                  raise IOError, "Got EOT reply twice from #{self.device_path}"
                end
              when "\x01"
                if got_eot
                  if ! got_soh
                    got_soh = true

                    break
                  else
                    raise IOError, "Got SOH twice from #{self.device_path}"
                  end
                else
                  raise IOError, "Got SOH before EOT from #{self.device_path}"
                end
            end
          rescue IO::WaitReadable
            if IO.select([port], [], [], 3)
              retry
            else
              raise IOError, "Timeout waiting for command reply from #{self.device_path}.  EOT:#{got_eot} SOH:#{got_soh}"
            end
          end
        end
      end

      self
    end
911653
def delete_certificate(ctx, slot, management_key, pin):
    
    controller = ctx.obj['controller']
    _ensure_authenticated(ctx, controller, pin, management_key)
    controller.delete_certificate(slot)
1358963
def write_block(self, block, data, erase=True):
        
        if block < 0 or block > 255:
            raise ValueError("invalid block number")
        log.debug("write block {0}".format(block))
        cmd = "\x54" if erase is True else "\x1B"
        cmd = cmd + chr(block) + data + self.uid
        rsp = self.transceive(cmd)
        if len(rsp) < 9:
            raise Type1TagCommandError(RESPONSE_ERROR)
        if erase is True and rsp[1:9] != data:
            raise Type1TagCommandError(WRITE_ERROR)
1039294
def Erase(self, partition, timeout_ms=None):
        
        self._SimpleCommand(b'erase', arg=partition, timeout_ms=timeout_ms)