Netzgemeinde/Hubzilla

Parámetros Línea de Comandos. Rust

{ROOR} Revista On-line Occam's Razor
Parámetros Línea de Comandos. Java

{ROOR} Revista On-line Occam's Razor
Parámetros Línea de Comandos. TCL

{ROOR} Revista On-line Occam's Razor
Parámetros Línea de Comandos. Bash

{ROOR} Revista On-line Occam's Razor
Parámetros Línea de Comandos. Ruby

{ROOR} Revista On-line Occam's Razor
Parámetros Línea de Comandos. Perl

{ROOR} Revista On-line Occam's Razor
Why bother with argv[0]?

The first argument of a program’s command line, typically reflecting the program’s name/path and often referred to as argv[0], can in most cases be set to an arbitrary value without affecting the process’ flow. Making the case against argv[0], this post demonstrates how it can be used to deceive security analysts, bypass detections and break defensive software, across all main operating systems.

Why bother with argv[0]?

The first argument of a program’s command line, typically reflecting the program’s name/path and often referred to as argv[0], can in most cases be set to an arbitrary value without affecting the process’ flow. Making the case against argv[0], this post demonstrates how it can be used to deceive security analysts, bypass detections and break defensive software, across all main operating systems.

My zshrc contains the following:

setopt autocd
function cd () {
if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
[[ ! -e ${1:h} ]] && return 1
builtin cd ${1:h}
else
builtin cd "$@"
fi
}
alias ...='../..'
alias ....='../../..'
alias .....='../../../..'

This allows things like `cd /etc/fstab` to go to `/etc`, `...` to go 2 directories up and `/blah/fasel` to go to `/bla/fasel` without explicit `cd`.

I am basically lost on machines without that. 😿